Safe sleeping notifications

Simple demonstration on to automate safe sleeping notifications with Home Assistant

Safe sleeping notifications

With both George and Alfie being born coming into the summer, it has always been a worry of ours not knowing what sleepwear to put them in on any given night.

There are multiple different scenarios for different temperatures. You dont want them to get too hot, but also you dont want them to get too cold either.

Whilst this isn’t a baby safe sleeping guide and how to dress your baby for night, it’s how I used Home Assistant to notify us of temperatures and any changes throughout the night. This then helped to remind us what to use and when.

Since moving in we have had temperature sensors around the house and we have them in their rooms already. I have already wrote a blogpost on how I use these and send the data over to influx DB, this can be found here https://deveritt.me/storing-home-assistant-sensor-data-in-influxdb/

The temperature sensors I use are these XIAOMI bluetooth ones. They are great and can be flashed with custom firmware. More on that another time possibly. They are hooked into the home assistant through ESPhome and this then enables me to see the data within Home Assistant and node red. (at the time of writing, Home assistant has JUST released Bluetooth support for these temp sensors now, HOW AWSOME!)

I use node red purely because I just find it easier to visualise things and get this up and running much faster.

Within node read, we can use the Inject node to trigger the flow at a certain given time, when you look at the bottom of the Inject Node you will see the below:


If you click the dropdown box you can select “at a given time”:


This is great because if you were to use a timer and your home assistant instance broke at all, it would then trigger your automation on the best timer finishing and then triggering your flow.

Next up I would like to check if we or one of us is at home. If none of us are at home I wouldn’t want to send the notification as it’s not really needed, to do this we can check the “current family state” (more on how to set this up later):


But what if we are not in when the automation runs but come in later on? Well… if we are not in then it would just drop the flow and stop the check, so we can put in a “wait for node” to wait for us to get home before carrying on with the flow:

Now the group is currently configured that it will only need one of us to be home in order to set the whole group as “home”, this is useful for quickly checking things like that, so it would need ALL of us to be away for the house / group to be in the “away” state. This is again useful for like alarms and other house automations like “no one home, turn all non essential electrical items off”.

Next we grab the temperature through a Currents state node then pass this into a Switch node, within the switch node we are able to specify our temperature guide lines we want to watch for:


Each one of these numbers and ranges will give us a unique output to trigger a different section of our flow:

Using this switch node we can branch off to separate sub flows based on the temperature ranges. Next up we need to a call service node and start to input the data we need as shown below, we need a name, which server you are using (defualt is “home assistant”) the domain of service “notify” the service is my phone then the Json data to be sent to my phone

“{"title":"Nursery Temp Check","message":"Recommended 2 tog, Baby Grow, long sleeved vest"}”


Now we have the basics input we can leave all the rest as default then repeat these for the remaining switch end points:


As you can see I have already tested this and this comes through to my phone as a push notification as shown below:


This is a rather “basic” setup and can be tuned for anything at all, I might write another post on how you can automate dumb fans to come on to try and cool and circulate air around the Nursery when the temperature is over a given threshold.

Node red really is great with keeping it rather simple, when you get over the basics it’s great to just play about with flows to add things on to the end of current automations and extend things out to include more points / checks.