Even the SHORT_PRESSED command doesn’t work. I also tried to change the switch into the “wireless” one in the Xiaomi app, but still no triggers from the channel. Only state change can be recognised with the Wall_Switch item.
Am I doing something wrong, or this device just doesn’t support button press events?
rule "Wall_Switch"
when
Item Wall_Switch changed from OFF to ON or
Item Wall_Switch changed from ON to OFF
then
if(Wall_Switch.state == ON) {
logInfo("RULE","<-- ON")
} else {
logInfo("RULE","<-- OFF")
}
end
rule "Aqara Wirelss Light Control (1 Button)"
when
Channel "mihome:86sw1:<GwID>:<ID>:ch1" triggered SHORT_PRESSED
then
<ACTION>
end
rule "Aqara Wirelss Light Control (2 Button)"
when
Channel "mihome:86sw2:<GwID>:<ID>:ch1" triggered SHORT_PRESSED
then
<ACTION>
end
Wall switch don’t work with double-pressed or long_pressed …
These rules are for Aquara Wireless Switches, not Wall Switches.
And it’s actually ctrl_ln1, not 86sw1. Will the channel "mihome:86sw1:158d0002c20996:ch1? work for the Wall Switch?
Having only the HORT_PRESSED would be good enough to me. I don’t mind double and long.
The whole problem is, that when I have smart bulb connected to the wall switch, then pressing the switch actually turns the power off for the bulb, so I have to turn it back on. Then it needs some time to boot and after that I can change color or whatever. In generall it works crappy. Getting switch pressed event instead of change of the relay state would be far better.
Switch Entrace_Switch "Włącznik Przy Wejściu" <wallswitch> { channel="mihome:ctrl_ln1:158d0002c20996:ch1" }
rule "dzialaj kurła"
when
Channel "mihome:ctrl_ln1:158d0002c20996:ch1" triggered SHORT_PRESSED
then
logInfo("lighting.rules","ENTRACE SHORT_PRESSED")
end
No logs
Approach 2:
Switch Entrace_Switch "Włącznik Przy Wejściu" <wallswitch> { channel="mihome:86sw1:158d0002c20996:ch1" }
rule "dzialaj kurła"
when
Channel "mihome:86sw1:158d0002c20996:ch1" triggered SHORT_PRESSED
then
logInfo("lighting.rules","ENTRACE SHORT_PRESSED")
end
No logs either…
I noticed the following difference between Wall Switch and Wireless Switch:
Yes, you’re right, and this is what I’m actually using now, but I wanted to improve it, as it doesn’t work well.
I have a Yeelight Smart Bulb connected to this Aquara Wall Switch, so I want the Wall_Switch to be turned ON all the time and have my Wall swtich controll the Bulb power directly, without changing the state of the relay. It can be only achieved by press events, such as SHORT_PRESSED trigger, without any crappy behaviour.
I red on some other topics, that someone managed to have this SHORT_PRESSED trigger from Wall Switch, but I cannot get it working.
in the MiHome application, you can change the behavior of the switch to logical, i.e. disconnect the relay. Have you tried this? I have not tried it myself, I don’t know if it works or not.
Ok then. At least I have my answer. Thanks for help anyway.
I decided to replace the Wall Switch to a Wireless Switch, so now it works as I wanted. This is a big disadvantage of Wall Switch to home automation lovers.
Perhaps this is not a switch problem, maybe it is not implemented in a binding. It would be nice if those who use zigbee2mqtt were told whether this works for them or not.