Zwave reads "KeyPressed" string in "KeyPressed2x" event

I have set up a couple of automations using my Zooz on/off switch, and they work, more or less. However I’m observing an odd behavior that suggests that when I double press, the first press is being activated for a brief moment before the double press automation is fully triggered.

1x Press = full brightness daylight scene on 4 smart bulbs
2x Press = low brightness warm light scene on same 4 smart bulbs

When I press 1x, full brightness scene activated as expected.
When I press 2x, the bulbs turn on full brightness for a brief moment then dim to warm light scene.
When I press 3x, full brightness is activated. This is odd because I don’t have any automations registered at all for a 3x trigger.

I’ve tried using the zwave_js_value_notification as well as the Zwave device triggers in the automation. They behave the same. I also swapped the scenes on the automations, and sure enough if scene 2 is registered on the 1x automation trigger, it is activated immediately without jumping through full brightness.

What am I missing here? I didn’t know how to put this into words or search for it successfully. Forgive me if this has been addressed.

I know the Fibaro devices have a default “full brightness on double-click” that needs to be disabled in the configuration to get the double-click to work reliably. Could it be something similar with your devices?
-David

This particular switch isn’t a dimmer, and I have the relay turned off, so it should strictly be triggering an automation in HA. It’s throwing me for a loop that 3x, 4x, and 5x presses are all triggering the 1x automation when I don’t have those values registered to trigger anything at all. Even using the zwave js listener tells me the value is indeed “KeyPressed2x” or “KeyPressed3x” for instance, but each command on the switch initially seems to be registering as a “KeyPressed” (1x) value apparently.

I tried replacing my 1x press (value = KeyPressed) automation’s trigger with the “KeyReleased” value. I obviously have to hold down the button then release to get it to trigger, but the 2x automation works correctly in this scenario. I think that HA is reading any “KeyPressed_x” automation as a “KeyPressed” value as well. It makes sense if it’s reading the notification value as a string and sees “KeyPressed” in the value string. It would be better if the switch sent a “KeyPressed1x” value or some other unique string. I’m not sure how to solve this yet, but it makes more sense now.

This is backed up by the fact that even on the scene controller switch I just installed, I’m seeing the same behavior. I haven’t registered any 2x, 3x, 4x, or 5x key press triggers, but all of those are activating the “KeyPressed” value trigger on my automations.

Any ideas?

Post your automation code. If you’re using the zwave_js_value_notification event trigger then it means the event parameters have to match exactly (the subset at least), HA doesn’t match any substrings, not everything is even a string.

As for the Device trigger, there was a UI bug for generating KeyPressed triggers that has been fixed, not sure if it has been added to a patch version, or will be available in 2023.01.

2 Likes

Yea I’m seeing a weird UI bug that you might be referring to. When I choose the zwave device and the trigger, I seem unable to choose the “KeyPressed” value and save it. It’s always blank when I come back. When I browse to automations.yaml, only one of these automations seems to have a “value”, and it’s a number instead of “KeyPressed2x”. It’s weird because other than the glitch I’m troubleshooting, this is working with a 2x press.

from automations.yaml:

- id: '1671252902139'
  alias: Bathroom Vanity Candlelight
  description: ''
  trigger:
  - platform: device
    device_id: e4536ddd2ed36cee0e16851a9fe2f828
    domain: zwave_js
    type: event.value_notification.central_scene
    property: scene
    property_key: '001'
    endpoint: 0
    command_class: 91
    subtype: Endpoint 0 Scene 001
    value: 3
  condition: []
  action:
  - service: scene.turn_on
    data: {}
    target:
      entity_id: scene.bathroom_candlelight
  mode: single

UI:
**


**

I’m going to try reconfiguring this with the zwave_js_value_notification event trigger again and report back. It didn’t make a difference the other day.

Yeah, that’s the bug I’m referring to. Since the value is not saved, the trigger matches all values, which would explain the behavior you see.

I would be surprised if there’s an issue here, others have reporting converting to the event trigger w/o issue, but let’s see.

You’re totally right. It’s working fine now! I think the other day I only reset one instead of both “up button” automations. Derp.

I’m looking forward to that bug fix! I have a house full of switches to configure in coming weeks.