Help with automation based on zwave node_event and basic_level

I’d like to setup an automation based on a z-wave node_event. When I press “On” on my z-wave switch, it sends a node_event with the basic_level set to the current dim level (between 1-99). When I press “On”, I want to turn on the light by my side of the bed. The following automation works as expected (assuming the dim level is 99):

- alias: MBR Master Switch On pressed
  trigger:
    platform: event
    event_type: zwave.node_event
    event_data:
      entity_id: zwave.mbr_master_switch
      basic_level: 99
  action:
    service: homeassistant.turn_on
    entity_id: light.mbr_dad

Since the basic_level can be anything greater than 0, I’d like to check for that (so that it works if the light switch is set to dim). I tried the following, but it didn’t work:

- alias: MBR Master Switch 'On' pressed
  trigger:
    platform: event
    event_type: zwave.node_event
    event_data:
      entity_id: zwave.mbr_master_switch
      value_template: '{{ basic_level > 0 }}'
  action:
    service: homeassistant.turn_on
    entity_id: light.mbr_dad

Help?

Isn’t there a light entity in HA that corresponds to that Z-Wave node? I guess I’m wondering why you’re not using the light entity for the trigger of your automation.

In any case, you can test for the basic_level being greater than zero in the automation’s condition:

- alias: MBR Master Switch On pressed
  trigger:
    platform: event
    event_type: zwave.node_event
    event_data:
      entity_id: zwave.mbr_master_switch
  condition:
    condition: template
    value_template: "{{ trigger.event.data.basic_level > 0 }}"
  action:
    service: homeassistant.turn_on
    entity_id: light.mbr_dad

I would assume basic_level is an int (i.e., not a string), but if not then you might need to add the |int filter.

1 Like

Thanks - that worked.

I’m not using the light entity because I want a way to “override” a motion detector. I have a motion detector in my bathroom - it turns the light on when I walk in the room. It turns the light off after 5 minutes of no motion. Sometimes my wife likes to take a long bath - she didn’t like the idea of having to wave her hands every 5 minutes to keep the lights on. :slight_smile: So now I can setup the motion detection automation to be ignored if the light switch was manually triggered (even if the light was turned on automatically via the motion detection).

I also have a z-wave switch by the bedroom door – but it doesn’t control any lights. I’m using that to send a lights on/off to the Hue lights by our bed. The “problem” is that once the light is on, the switch won’t send a z-wave command to HA when you press on, but it will send a node_event if you setup a group and join the HA z-wave controller to it.

BTW, any advice on how I cat set the light level? I tried changing the action to:

action:
  service: homeassistant.turn_on
  data:
    entity_id: light.mbr_dad
    brightness: 255

but that did not work.

Thanks again for all your help.

Use the light.turn_on service:

action:
  service: light.turn_on
  data:
    entity_id: light.mbr_dad
    brightness: 255
1 Like

Thanks again!