Zwave switch event automation vs mqtt change

Good morning,

I have a couple automations that listen to an mqtt event from a Aeon ‘dual nano’ switch that lives at the front door and controls my porch and flood lights outside.

Short story long, I divorced the physical switch from the relay because I moved to individual wifi enabled bulbs. So I created an mqtt trigger to listen for the node to send 0 or 255 (on endpoint 1 or 2) and this works fine.

But a recent zwave JS update apparently changed the event a little and broke my automation. Easy fix, but while searching for a way to limit these changes causing problems (with regex or something) I discovered that HA created devides that can track these value changes.

I can watch the ‘value’ swap from 0 to 255 in real time. SO, I thought instead of capturing an mqtt even I could just use this device in my automation. So I disabled the mqtt trigger and used the device stat, value attribute watching for it to switch from 0 to 255 and vice versa to turn on/off the light group ‘porch’ and ‘floods’.

But this does not work, this entry does not trigger the automation, and I’m not sure why. Any help would be appreciated. Below shows part of the original and the new trigger.

I believe the attribute field should be empty.

sorry, I didn’t get any notification that you replied. I will try that change.

I just tried by removing the attribute, and leaving from 0, and to 255. When that didn’t work I tried removing 0 and just leaving 255. But neither seem to work.

The value of ‘value’ (in developer options) is definitely changing from 0 to 255 when switching the switch ‘on’ and back to 0 from 255 when switching ‘off’

Inside of the Z-Wave JS Integration you should see a section called sensors, a section called events and another section called controls. Things listed in the control section can be used to control the device while things listed in the sensor and events section are only used to report information from the device. The reason why its not working is because you are trying to set a value to an event entity which is read only.

If you go into Z-Wave JS integration you should see a list of things you can control in the control section. The icon next to the device tells you whether the device is a light or a switch or something else. If you you click on the device name then click the gear icon you should the entity id. the greyed out section followed by a period is called the domain. This is another way to tell what typ of device a device is. For example my entity id is switch.power_meter. The switch. tells me the device is a switch. Lets say I wanted to turn the switch on in my automation. All I would do is click add action then search for the switch: Turn On action. Then click the choose entity button and it will automatically display a list of switches for you to control.

Thanks for the reply.

So, I am trying to just ‘read’ the value change when I flip the physical switch. This is a relay/switch that is in the wall and wired to two physical switches that operate it. (aeon dual nano).

Right now when I flip one of the physical switches (dumb switches) that sends a signal to the relay which would in turn flip the relay on. In zwave JS, I have that disabled, so flipping the physical switch ON/OFF does not trigger the relay, it instead sends a message only. I am trying to trigger off that message. Below shows the configuration changed from operating the ‘load’ to controlling the association group 3 and 4 (setting 122 and 123)

I did this because my outside lights now need power 100% of the time (they are individual wifi bulbs)) to be controlled. So, instead of the default of switch trigger = relay trigger, I modified it to send a signal.

My groups setting for the dual nano is as follows.

This all works when I ‘trigger’ on the MQTT message showing the message, and value change from 0-255 and back.

But after some update the MQTT message changed slightly breaking my trigger event. During that troubleshooting I found that there is a Home Assistant device that can SEE those events right from the developer section. The only reason I was trying to switch away from the original of watching the MQTT event is it can clearly change after an update. When I found the below entity, I thought "oh, i should be able to trigger on the ‘value’ change.

I am not trying to modify the value in my automation, just trigger from it’s change by flipping a switch.

You need to check the value in a condition, not in a trigger. See example in the docs: https://www.home-assistant.io/integrations/event/#event-types

Ok, I’ve tried a couple ways to move this into a ‘condition’ vs a direct trigger.

I believe I need a basic trigger, so I removed the payload of the MQTT message and left it at any time that topic gets a message. (this may or may be the best way to do that).

Then I moved the ‘checking’ of the value into the condition area of the automation. I tried both stat and numeric value but neither seem to work.

AND

Looking at the trace for the state I’m not sure why it’s not catching it. is it the single quotes? (string vs a number?)

The MQTT trigger has nothing to do with the event entities. You would trigger on the event entity.

Instead of screenshots posting the actual YAML code of the whole automation is preferred.

I prefer using the scene events instead of the entities, so you can actually trigger on the payload, similar to MQTT. https://www.home-assistant.io/integrations/zwave_js/#scene-events-value-notification. I find the need to use conditions instead of simple trigger IDs just makes the automation more complicated.

I wasn’t 100% sure where you were referring to, but believe you’re talking about the device details when clicking on the zwave entity of the device. When I click on the zwave device for the ‘dual nano’ I get what I believe is the screen you’re referring to, and as I tried to explain, under control section. the two switches need to stay on always so the wifi bulbs always have power They are switch.devices (two sub devices hence the dual nano like. switch.dual_nano_switch_1 and switch.dual_nano_switch_2). I have them divorced from the dumb switch through the z-wave JS UI configuration section and instead of switching the ‘load’ (aka turning on/off the relay and therefor power) to the lights it is set to just send a notification that I can use to trigger a light group to turn on/off (the 6 Lifx wifi flood lights).

So, when I throw the dumb switch, it tells the duel nano that it was turned ‘on’ but the relay is already on and stays on regardless of the dumb switch position. But what it does do is send some messages. To MQTT and to HA.

Again, when i was fixing the mqtt trigger because of the change to the mqtt message, I stumbled across the event device ID that was actually sending/tracking the value change from off (0) to on (255) as a discrete entity and thought it would be simple to just switch to that as the trigger. Clearly not.

event.dual_nano_switch_event_value_1 and event.dual_nano_switch_event_value_2 exist but HA just tracks that an ‘event’ happened. but within that even the a ‘value’ is updated to 0 or 255.

I’m not sure I am following you. I probably went about this wrong, and got where I am from a different ‘angle’. I originally installed this relay to control the 3 porch and 6 flood lights outside. (all just standard BR30 lights). This year I ‘upgraded’ them all to RGB LifX smart bulbs making the smart relay a bit obsolete. it doesn’t make sense to power the wifi bulbs off because it takes them time to reconnect to wifi.

Since the relay is in the wall, I didn’t want to dig it out, but I didn’t want my wife switching the ligths off/on, so I googled around and discovered I could ‘divorce’ the dumb switch toggling from the relay, so toggling the switch does not toggle the relay. That way I can have the 9 lights always have power. BUT still use the dumb switches to control the light groups (porch/flood) by flipping them on/off.

In the other screen shots, above I was trying to show how i did that configuration, and how I was capturing that mqtt message trigger by just listening to the events ‘flipping’ the dumb switch sent.

I have not messed with any scenes, as I was just trying to stop the switches from being able to power off the bulbs, but still allow them to operate the light groups (making the wife happy :slight_smile: ).

As I said, my automation works perfectly fine as is, I just discovered last week, updating zwave JS can apparently cause changes to the payload which will break my automation. Easy fix, but if I can make it update proof (or at least resistant) I’d change it.

Below is a working automation of the flood lights (which is endpoint 2 of the dual nano)

alias: Turn on Flood Lights with magic
description: ""
triggers:
  - trigger: mqtt
    topic: zwave/_EVENTS/ZWAVE_GATEWAY-Mosquitto/node/node_value_updated
    payload: >-
      {"data":[{"id":9,"inited":true,"name":"Dual Nano
      Switch","location":"Outside","status":4,"isControllerNode":false,"interviewStage":5,"deviceClass":{"basic":"Routing
      End Node","generic":"Binary Switch","specific":"Binary Power
      Switch"},"zwavePlusVersion":1,"ready":true,"zwavePlusRoleType":5,"isListening":true,"isFrequentListening":false,"canSleep":false,"isRouting":true,"supportedDataRates":[40000,100000],"maxDataRate":100000,"supportsSecurity":false,"isSecure":false,"supportsBeaming":true,"protocolVersion":3,"firmwareVersion":"2.2","manufacturerId":134,"manufacturer":"AEON
      Labs","productId":132,"productDescription":"Dual Nano Switch with Energy
      Metering","productType":259,"productLabel":"ZW132","deviceDatabaseUrl":"https://devices.zwave-js.io/?jumpTo=0x0086:0x0103:0x0084:2.2","keepAwake":false,"protocol":0},{"commandClassName":"Basic","commandClass":32,"endpoint":2,"property":"event","value":255,"propertyName":"event","newValue":255,"stateless":true}]}
conditions: []
actions:
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.flood_lights_2
mode: single

I was asking for the YAML automation code for the new automation, the one that isn’t working. You showed screenshots of an MQTT trigger with event entity conditions, which will never work because they weren’t part of the trigger (not MQTT based).

For your MQTT trigger you would probably have much better reliability if you used a template, parsed the JSON and matched on specific properties of the payload, such as the node ID, endpoint and value, instead of the entire payload which may vary over time.

The Z-Wave integration’s scene trigger is similar to the MQTT version, except it’s much easier to match on partial fields.

Sorry for the 100 replies, but I did get this working not using mqtt, basically from reading more of the link you sent. I am not using scene-events but the changes I made or maybe just by default, that device IS sending zwave_js_value_notifications. I went to developer options/events and listened to zwave_js_value_notifications and when I flip the dumb switch for endpoint 1 (porch lights) I got the following.

event_type: zwave_js_value_notification
data:
  domain: zwave_js
  node_id: 9
  home_id: 4200620142
  endpoint: 1
  device_id: c6010f84dd4c23fb3b6c39590e82350b
  command_class: 32
  command_class_name: Basic
  label: Event value
  property: event
  property_name: event
  property_key: null
  property_key_name: null
  value: 255
  value_raw: 255
origin: LOCAL
time_fired: "2025-04-22T02:36:55.777369+00:00"
context:
  id: 01JSDNP331SEYS60M2SS6H35SR
  parent_id: null
  user_id: null

From here a bit of googling to trigger an automation from a notification event lead me to creating this test automation.

alias: TEST JS_NOTIFICATION Trigger magic
description: ""
triggers:
  - event_type: zwave_js_value_notification
    event_data:
      node_id: 9
      endpoint: 1
      value: 255
    trigger: event
conditions: []
actions:
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.porch_lights
mode: single

This seems to work, and should be a little more resilient to updates as the node ID and endpoint should stay consistent.

Thanks for all the replies. I still feel like I just ‘muddled’ through this which is how I created the first one :slight_smile:

1 Like

That’s perfect.