Carpe Diem: 6 October, 2024

Bedroom Floor Automated Night Light

This post may contain affiliate links. Please see our disclaimer for more info.

I need to be able to see where I’m walking in the master bedroom at night without bothering my wife. My wife goes to bed before me; as a result, I’m finding myself navigating the steps to my bed at night much like navigating a dark cave. In addition to not being able to see, my kid and cats like leaving things on the ground for me to trip on. I can’t simply turn on a room light as that would bother the wife and using my phone for a flashlight is annoying. The solution? Of course, Home Assistant with a few gadgets and automations.

In this post, I’ll be detailing setup and operation of a motion sensor controlled smart bulb driven by HA.

Ingredients

Equipment

I’m using a Zooz Z-Wave multisensor v2. Not only does it report motion (quite quickly as well I should mention), it captures temp, humidity, and luminance. With all these sensors, the device is still surprisingly small. This sensor costs a little more than just a motion sensor, but for a few bucks more, you get a handful of more features amazon link.  Overall I’ve been very happy with the zooz multisensor. It does everything well as advertised and has a nice battery life. 8/20/19 update: Still very happy with the zooz multi-sensor; been working flawlessly and haven’t needed to replace the battery yet
 
For the bulb, I’m using a Sengled Zigbee smart bulb. I use these bulbs all around the house and am pleased with the benefits for the low cost. See my more detailed post on the bulbs here. Along with the bulb, we just need a socket to plug it into. I’m using one of these and have the bulb sitting under my bed. This illuminates the floor nicely without casting too much light on the rest of the room.

Integration

The Zooz multisensor is a z-wave certified device meaning it’s seamless to add to home assistant. Simply follow the regular instructions to add a z-wave device. One oddity with this device however, is it creates a handful of sensor entities that are a bit confusing at first. Luckily, fellow home assistant users on the forums already figured out what’s important and what’s not. You’ll want to add a couple templates to take the readings from the device and hide other entities – this will make your interface clean and straightforward.
 
Note that I’ve changed the entity names so that they are more clear for where I’ve placed the devices. You can see the original names in this post. The important part is the template – I’m taking the ‘alarm level’ sensor from the Zooz and transforming it into a binary motion sensor – this is a lot more intuitive vs a number and also will make automations simpler.
 
The bulbs are very easy to pair with HA. Just see my other post here.

Zooz Multisensor Integration

## configuration.yaml

binary_sensor:
  - platform: template
    sensors:
      masterbed_motion:
        friendly_name: "Master Bed Motion
        device_class: motion
        value_template: "{{ states('sensor.masterbed_zooz_alarm_level')|float > 0 }}"


## customize.yaml

sensor.masterbed_zooz_alarm_level:
  hidden: true
sensor.masterbed_zooz_alarm_type:
  hidden: true
sensor.masterbed_zooz_sourcenodeid:
  hidden: true
sensor.masterbed_zooz_burglar:
  hidden: true
sensor.masterbed_zooz_power_management:
  hidden: true
binary_sensor.masterbed_zooz_sensor:
  hidden: true
sensor.masterbed_zooz_emergency:
  hidden: true

Automation

Getting things automated correctly turned out to be the most difficult part of this project. Not because turning the bulb on and off with motion is hard, but instead because of all the considerations I wanted to incorporate into the logic. Essentially, the bulb turns on when motion is detected and there isn’t other light on in the room (natural or artificial). Then a loop checks every 10 seconds if there is no longer motion or another light turned on and will turn off, or keep the bulb on if the conditions haven’t been met.

There is a luminance sensor on the Zooz Multisensor, while this appears accurate, it doesn’t update as often as I need to use it reliably in automation.

I’ve put together the psuedo code below to help you map out your automation.

IF
 Motion detected in master bedroom
THEN
  IF
    Bedroom light isn't on
    Pseudo sun isn't on
    It is after sunset
  THEN
    Turn on floor bulb - Transition to 40% brightness over 3 seconds
  END IF

  LOOP
    Start 10 second timer
    IF
      Bedroom light is on
      Pseudo sun isn't on ## see my sunrise alarm clock post here
      It's during daylight
      No motion detected
    THEN
      Turn off the floor bulb with a 4 second transition
    END IF
  END LOOP
END IF

2 Comments

  1. Rosario Reply

    hello form Italy congratulations for the project
    I wanted to ask you but if the cat enters the bedroom at night, does the light turn on?

    1. Alex Post author Reply

      Thank you!

      Yes – sometimes the cat triggers the motion sensor. Also sometimes moving in the bed can trigger the motion sensor which can be annoying. Luckily many motion detectors have a sensitivity setting where you can edit them to be less sensitive to smaller movements which helps.

Leave a Reply

Your email address will not be published.