I just coupled an Aqara Wireless Switch with Openhab (Openhabian on RPi with CC2531). It was discovered in PaperUI and now shown as below with one Switch channel:
However, the channel was ON since discovery. If I press the switch, nothing happens. If I toggle it OFF in PaperUI and then press the switch, it flips back to ON.
Most people seem to use the Xiaomi Home binding with the Xiaomi Gateway so I couldnāt find a solution for my setup anywhereā¦
Do you get a channel triggered event in your log when pressing the button? Than you wouldnāt need to link it to an item at all as you can use those events in rules. If not a work around would be to link the switch channel to a switch item with the expire binding set to expire to off after 1 second. That way yo could use the changed to ON as a rule trigger etc.
Johannes
2019-06-26 17:04:54.725 [vent.ItemStateChangedEvent] - zigbee_device_70dd630e_00158d0002041455_00158D0002041455_1_switch changed from OFF to ON
So Iād have to base my rule on this and set the state back to OFF after execution for this work-around. Not my preferred solution because of the more complex code but Iāll keep it in the back of my mind, thank you
So in fact I think what @JGKK wrote above is probably the correct approach. The events are being received, but the device only ever reports ON state, and in this case it seems you will need to use this to trigger a rule.
What āchimeā are you looking for? Iām not sure that there will be a lot more that we can do if the device doesnāt send On and Off, and instead only sends On.
It could be possible to change this to a trigger channel, but ultimately that will still do exactly the same thing.
The possibility of changing the channel type for zigbee buttons to a trigger channel type (like the rocker switch channel type in the enocean binding) would be a nice addition to remove the expire binding workaround.
I donāt know if there is zigbee buttons that support functionality like long press or double press but this would be a great match for a trigger channel like this.
Best regards Johannes
So is the aquara wireless switch just reporting itself as a switch instead of a pushbutton although it is a button and the fault is on the manufacturers side for implementing the Zigbee standard wrong or should the binding actually be changed to correctly implement this button type? Or are we in a grey area?
Sorry for asking all this. Just trying to wrap my head around the Zigbee stuff in more detail.
Johannes
The important bit here is the cluster=On_OFF part.
Probably there is scope to change the binding. Itās possible to manually define things in the binding, so this could be possible now, or if not if could be added.
As I said though, for this device it would fundamentally still be the same - youād simply get a rule trigger each time the button is pressed.
Why use the expire binding at all? I guess youāre using it as youāre using this as a switch, but why not simply trigger a rule with the āOn Updateā trigger and it will be the same as if you had a trigger channel wouldnāt it?
Comment: using the expire binding,you can have a linked Switch Item set its state back to OFF after a delay of your choice.
Rules can then use conventional Item state triggers e.g. changed, Group based etc.
But canāt rules just use the conventional item state trigger āreceived updateā - itās the same thing isnāt it and it avoids the expire binding if thatās what you want.
The discussion was about changing the binding to use trigger channels for this switch. I think donāt have a UI do they? I think using a trigger channel in this instance is the same as using the āreceived updateā trigger in the rule?
Nearly. Thereās no āGroupā equivalent triggering for event channels at this time.
You can hardcode a load of āorā channel triggers, together with receivedEvent to approximate the functionality.
I replied to @zzzZZZzzz who wanted to know how to use his switch now, this wasnāt intended to be any input to binding enhancements,