With our small nut problem out of the way, we can get all the pieces to talk to Home Assistant and make it do things, like having the motion sensor control an out of reach light switch.
Out of the box the GE motion senor light switches automatically turn on the stairway light at the top of the stairs. Great! I haven’t even added it to home assistant at this point. But to do anything else with them they’ll need to be added to the Z-Wave network. I used the home assistant UI to add a node to the Z-wave network and then I followed the directions provided with the switch. That’s it, a few new light switch states were added to the network as some form of switch.ge_26931_smart_motion_switch_switch. I also like to keep all my automations in one folder called, creativly enough, automations. In our config you can add the entire directory like so:
automation: !include_dir_merge_list automation
, this will add all files in that directory. For this automation I have it in the basement.yaml file.
Auto Turn Off
I thought I should have a way to turn off the light when we go down stairs and don’t come up for a bit. I’m pretty sure the GE switches have some kind of auto off feature so really you don’t need to set this up in Home Assistant but I wanted control over the length of time it was on. I have it setup to turn off after 3 minutes like so:
- alias: Turn off basement stairs light 3 minutes after last movement
trigger:
platform: state
entity_id: sensor.zooz_motion_detect_template
to: 'standby'
for:
minutes: 3
action:
service: switch.turn_off
entity_id: switch.ge_26931_smart_motion_switch_switch_2
Turn me on Mister Motion Sensor
Now came the time to have the motion sensor we setup in the first part turn on the hallway light. Using that template we created we can easily setup the automation like so:
- id: basement_hall_motion
alias: "Motion Detected in Basement Hall - Turn on Stair Lights"
initial_state: True
hide_entity: False
trigger:
- platform: state
entity_id: sensor.zooz_motion_detect_template
from: "standby"
to: "motion detected"
action:
service: switch.turn_on
entity_id: switch.ge_26931_smart_motion_switch_switch_2
And that’s it, the motion sensor controls the light switch at the top of the stairs. Now I no longer need to climb the stairs in darkness.