#ZHA: How to change behavior of what messages are sent from an Ikea e1766 button?

1 messages · Page 1 of 1 (latest)

normal brook
#

Set up zigbee for the first time this week (Nabu Casa zbt-1 (ZHA)). Added an Ikea e1766 button and am wanting to set up automations based on short, long, and double press events. But it appears the button only provides the following:

Physical Action - Event Sent From Device
short press - "short press"
long press - "Short Press" immediately, then "Long Release"
Double press - "short press" and another "short press"

In talking with another user, it was mentioned that I might be able to change the behavior of what presses trigger by using the ZHA configuration tools? My biggest hang up is that a long press immediatly fires the "short press" event. So I feel like I need some sort of logic that takes that into consideration and doesn't trigger "short press" events until a "long release" event is confirmed to have happened or not.

blazing cape
#

Probably simplest to look for a blueprint from someone who has already solved this. Ought to be a way to make it work from the events as they exist. I'm not aware you can change the device behavior unless you change the firmware or something.

normal brook
#

That's kind of what I thought, but I've struck out on blueprints. But I admit I probably am not using the right terms to search with.

#

Are blueprints able to be created in a way that allows for entering the users custom device id, and then defining that devices hardcoded events?

blazing cape
#
blissful fern
#

Yes, blueprints can be set up to listen to ZHA events from a device ID (via a device ID selector). I've used some of the "Awesome HA Blueprints" ones before, but one thing to be aware of is that they're a bit out of date - some Ikea remotes have had firmware updates which changes the events so they're no longer compatible.

#

The thing to remember about these Ikea remotes is that they're not intended to be used to provide user input to a home automation system - they are designed to be bound directly to the devices they control, so button pressess on them actually make them send various device control commands. When used with ZHA, by default the device gets bound to the zigbee controller (i.e. HA itself), and the commands received get re-interpreted back to the original button presses (when not ambiguous)

#

The exception is the scene controller remotes - those are designed to provide user input to a home automation system, and actually provide a decent set of single, double, and long press events :)

#

The most common problem you'll run into with the events produced by the ikea remotes is that long press on the up or down buttons sends distinct commands that tell the connected device to start moving up or down, but releasing from the long press sends a "stop" command which is the same for both buttons.

#

The "Awesome HA Blueprints", and some of my own blueprints (although I don't have one for the E1766…) deal with that by using a helper entity to store the previous received event, and check that to determine which button was being held (and so has now been released).

normal brook
#

That makes sense. And I was thinking that a helper could be created to make it possible to have calculated "double", "long", etc. Unfortunately, I have no idea how to write that kind of logic. And so far, my google-fu is coming up short of any successful solutions.

blissful fern
#

did you try the blueprint linked above? taking a quick look at it, it might work; and if not, it probably just needs minor changes to fix the names of the zha events.

#

if you want to find out exactly what events the device is producing for various button presses, open up the HA Developer Tools, Events tab, and start listening for "zha_event"

#

oh, interesting. the zha quirk for the E1766 got updated at some point, so now it remembers the "opening" vs "closing" state and emits separate events when the up vs. down buttons are released.

normal brook
#

I haven't tried it yet. Had family plans last night and didn't get a chance to sneak away to the HA lair.

#

And, while i don't know the history, yes, each button does provide unique state names. I generalized my questions the other day to just "short", but it's actually "short press - open" or "short press - close"

blissful fern
#

it doesn't look like that device provides any way to distinguish between short presses and the start of a long press, unfortunately. An automation can implement double-press via clever use of delays, restart mode, and saved state in a helper. But if you want a simple two button (up/down or on/off) zigbee remote that supports a full set of single/double/long press actions, consider the ikea SOMRIG shortcut button.