ErikdeVries.com
ErikdeVries.com

Improve your sleep quality with white noise and Home Assistant

Published on Last updated on

Many factors can result in poor sleep quality, of which environmental noise is a common one. Unfortunately I also have experience with this, caused by a busy road in front of my house.

Years ago, I discovered that playing so-called "white noise" during the night improved my sleep. This constant sound in my bedroom makes external noises (like cars) less noticeable, resulting in more stable sleep.

Google Nest Mini on my bedside table

I used to play sounds through my iPhone. My experience is that the sound quality is lacking and I always have to be busy with my phone to start or end the sound.

The solution I came up with involves a Google Nest Mini for playing audio (2nd generation, which sounds significantly better than the first generation). A big plus for this device is the ability to disable the built-in microphone via a (hardware) switch.

Next, I attached a cheap IKEA TRÅDFRI Zigbee button to the edge of my bed. When I press the "on" button it runs an automation in Home Assistant that turns off all the lights in my house, adjusts the volume of the Nest Mini and starts playing a 10-hour mp3 with rain sound on the Nest Mini (I downloaded several different recordings from YouTube and stored them locally, each time I press the button it plays a random recording). When I press the "off" button, the Nest Mini stops playing immediately.

IKEA TRÅDFRI Zigbee button on the edge of my bed

Understanding my sleep pattern

Gaining insight in my sleep pattern was the next step. I decided to purchase the Withings Sleep Analyzer. This device is placed underneath the matrass and the rest happens by magic. It detects when you get in- and out of bed and monitors hearthrate, movement and sound to come up with a sleep score.

The next step was to connect the sleep analyzer with Home Assistant and create an automation that sents out a notification to my iPhone (in the evening) when last nights sleep score was to low. This results in some additional awareness.

Home Assistant sleep advice notification