Ok, next noob issue - Automations

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.

Oh, the automation does show on the home page:

image

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.

image

You need a domain on your entity Id. I would image it’s either a sensor or binary sensor.

Take a look at your states page to see what the domain should be.

Yeah, I played around with that as well. In the states under binary_sensor:

new_entity_id: binary_sensor.dome_motion_detector_sensor

For the light switch, I guess it would be:

new_entity_id: light.leviton_dz6hd1bz_decora_600w_smart_dimmer_level

So, now the automation file is:

  • 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.

Sorry about that, I had tried earlier with a single tick.

I changed it using the automation builder whithin HA to try and simplify things, just concentrating on getting the light to turn on:

  - data:
      entity_id: light.house_light
    service: light.turn_on
  alias: When motion in MB WC turn light on
  condition: []
  id: '1521348793067'
  trigger:
  - entity_id: binary_sensor.sensor
    from: 'off'
    platform: state
    to: 'on'

Geesh, finally got the simple case to work with:

  - data:
      entity_id: light.level
    service: light.turn_on
  alias: When motion in MB WC turn light on
  condition: []
  id: '1521348793067'
  trigger:
  - entity_id: binary_sensor.sensor
    from: 'off'
    platform: state
    to: 'on'

Trying to figure out this domain.entitiy. Does it log this somewhere besides the “Logbook” ? I did not see anything go into “home-assistant.log”.

Next I want to add a condition if there is no illumination, then don’t activate the light.

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

Here’s a CP from mine with the same sensor.

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.

Coolie, what do you have in your zwave_device_config.yaml file for the entity? I can’t get mine to poll.

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.

They are all set to " polling_intensity: 0"

As @zarthan said, I don’t think you need to poll the device it reports on status changes.

Look at the history for the sensor.

image

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.

Interesting, I see:

image

So not seeing the light changes.

Oh, an hour ago I bounced the pi.

Looks like you are right, as far as the reporting go.

Looks like the light changes are reported on motion trigger, which makes sense for my log, as someone is always up and about in my house.

You can confirm the light level reporting, by triggering the motion a couple times at different intervals, and observe the history.

I would read the manual or check the manufacturer’s website for more information on your device. See what triggers the device to update its data.

Try adjusting option 7:
image