Now that I have a z-wave motion sensor in the configuration and several wifi and an a single z-wave Leviton switch, I setup an automation, but I don’t see it kicking in. I put the following in my automations.yaml:
alias: Turn on MB WC light when there is movement
trigger:
platform: state
entity_id: zwave.dome_motion_detector
to: ‘on’
action:
service: homeassistant.turn_on
entity_id: zwave.leviton_dz6hd1bz_decora_600w_smart_dimmer
alias: Turn off MB WC light when there is no movement
trigger:
platform: state
entity_id: zwave.dome_motion_detector
to: ‘off’
for:
minutes: 5
action:
service: homeassistant.turn_off
entity_id: zwave.leviton_dz6hd1bz_decora_600w_smart_dimmer
The configuration.yaml has the include for this at the end of the configuration.yaml, but not sure if the location in the file matters. I can see in the OZW_Log.txt the motion sensor being activated and deactivated but I don’t see anything in home-assistant.log about the activation being kicked off and the Leviton switch is never turned on. I am using the example motion sensor example from the hass.io website.
Any pointers? I tried reloading the automations as well as rebooting the pi, but no love.
Here is the logbook. You can see it initializing the automations and you can see where I am activating the motion sensor, but the automation does not start.
alias: Turn on MB WC light when there is movement
trigger:
platform: state
entity_id: binary_sensor.dome_motion_detector_sensor
to: ‘on’
action:
service: homeassistant.turn_on
entity_id: light.leviton_dz6hd1bz_decora_600w_smart_dimmer_level
alias: Turn off MB WC light when there is no movement
trigger:
platform: state
entity_id: binary_sensor.dome_motion_detector_sensor
to: ‘off’
for:
minutes: 5
action:
service: homeassistant.turn_off
entity_id: light.leviton_dz6hd1bz_decora_600w_smart_dimmer_level
But still the automation is not being kicked off. Still not sure if I am selecting the right domain.entity_id. The dome sensor also has an alarm, but I think that is for light level.
If I trigger it on the home screen it shows as triggered in the logbook, but nothing is logged to the home-assistant.log nor is the light turned on.
please post how your automation.yaml actually looks with the proper spacing. in order to post this correctly, you need to put it into a code block. You need to use 3 of this ``` to start it and 3 ``` to end it.
Proper spacing is the key to yaml. Make sure you are using spaces and not tabs as well.
to figure out the entity_id to use. Go the left pane, down to the developer tools and click the “<>” Icon. The left column is the entity id.
Also, consider editing the .yaml file directly, the automation editor makes a mess of the order. For example, here’s one of mine that turns on a light when you open a door:
- alias: Attice Lights Auto-On
trigger:
- platform: state
entity_id: binary_sensor.attic_door
to: 'on'
action:
- service: light.turn_on
entity_id: light.attic_light
If you wanted a condition, you put it like so:
- alias: Attice Lights Auto-On
trigger:
- platform: state
entity_id: binary_sensor.attic_door
to: 'on'
condition:
- condition: sun
before: sunrise
action:
- service: light.turn_on
entity_id: light.attic_light
automation:
- alias: Turn on MB WC light when there is movement
initial_state: 'on'
trigger:
platform: state
entity_id: binary_sensor.dome_motion_detector_sensor
to: 'on'
condition:
- condition: numeric_state
entity_id: sensor.dome_motion_detector_luminance
below: 'XX'
action:
service: homeassistant.turn_on
entity_id: light.leviton_dz6hd1bz_decora_600w_smart_dimmer
Thanks guys, I did fumble through and got this working. Learning a lot as I got. I got my Dome motion sensor working but for luminance, I think I need to setup a polling interval, which I just did. I still do not see the state changing with a poling interval of 60000. Will do a heal on the device and see what happens.
Forget polling you don’t need it. Battery powered devices are mostly asleep and so can’t be reached by HA, they contact HA when they have something to say.
Well, this may be true for something like a motion sensor, but for a light sensor, you need to check it periodically. It is not like it knows to activate as it gets darker.
Battery powered devices report a change. When light levels change it will report. There is nothing you can do to query a battery powered device. You will need to create an automation, script or whatever to respond to a change that is reported to HA by that sensor.