me every day

Background

I suffer from persistent adult night terrors as well as moderate sleep apnea. I’ve consistently struggled with constantly feeling fairly fatigued throughout the day as a result of this. I’ve worked with two different doctors, had four sleep studies, and have done a substantial amount of personal research in search of a solution. Unfortunately, all of this effort has not amounted to more than being put on a C-PAP with little results from the doctors regarding night terrors.

C-PAP Visual from Wikipedia

I am currently using a C-PAP system nightly as well as taking melatonin, however, it doesn’t seem to address my night terrors. If anything, usually my night terrors disrupt my C-PAP usage, as I will often rip off my mask. This project details my attempts to better understand what is happening when I sleep and hopefully find a solution. It should be noted that this research is still ongoing.

WyzeCam

WyzeCam from Wyze.com

Recently, I’ve outfitted my house with cheap security cameras /sensors from Wyze. These little cameras are very cheap, jam-packed with features, and do not require a recurring monthly subscription.

Wyzecam accepts local storage, records footage based on motion/sound, and even has impressive night vision capabilities. I’ve really enjoyed using them to protect my house but I wonder if I can do more with them.

WyzeCam Sleep Sensor?

Pic from “Smart Home Solver”

As aforementioned, WyzeCam offers impressive night vision capabilities; especially indoors. With this in mind, I set up an extra camera in the bedroom and pointed it at the bed so I could monitor motion during the night. Every time the camera detects motion it will start recording so I can get an accurate view of exactly what I’m doing during sleep. Note: for the duration of this study, I am the only one sleeping in the bed being monitored. Additionally, in an effort to reduce false positives and increase study accuracy, I’ve set the WyzeCam to only record events/motion from 10:30 pm — 6:30 am (the average time that I am in bed/waking up). After testing this for a couple of days, I was impressed with the results. I captured multiple night terrors, which while humorous at first, were rather concerning. I would get up out of bed, remove my C-PAP mask, and start walking around the room as if I was fully awake. I have no recollection of these events at all. Additionally, I discovered I am moving around A LOT at night. So maybe that's why I’m so tired…

Drilling Down Further — IFTTT & Google Sheets

Ok, so now that we have a reliable sensor to detect motion each night, how can we export this data to a more tangible format. Currently, I can just see entries within the Wyze app, which makes long term analysis rather limited. Additionally, Wyze has not made their API public or given an option for data exfiltration. Luckily IFTTT exists to solve problems like this. IFTTT, or “If This Then That”, is a service that allows automation of applications and sensors. “[IFTTT is the] easiest way to do more with your favorite apps and devices for free. Make your home more relaxing. Make your work more productive.”

Google Sheets IFTTT Wyze Output

With IFTTT, we can use a user-generated applet to automagically populate a Google Sheets document for every motion detection event.

Now we can get a better understanding of exactly how many events per night are occurring and at what time in an easy to read /analyze format.

But it can still be better…

Google Data Studio — Gods Gift to Nerds

“Data Studio (GDS) is Google’s reporting solution for power users who want to go beyond the data and dashboards of Google Analytics”

I’ve used GDS in the past for other research projects such as creating reports for Insecure Audio Visual Devices. GDS is a great tool for quickly generating reports/graphs from data sets such as google sheets and other data sources so it was perfect for this application. All we have to do is link the Google Sheet that IFTTT is writing to, and with some quick chart creation, we have an automatically updating live Sleep Study Dashboard.