Aquara Wall Switch no channel triggering

Hi,

I have both Aquara Wall Switch and Aquara Wireless Switch, but only the Wall version dosen’t work with the following rule:

    	rule "Turn Light"
	when
		Channel "mihome:ctrl_ln1:158d0002c20996:ch1" triggered
	then
		var cmd = receivedEvent.getEvent()
		switch(cmd) {
			case "SHORT_PRESSED": {
				//do something 1
			}
			case "DOUBLE_PRESSED": {
				//do something 2
			}
			case "LONG_PRESSED": {
				//do something 3
			}
		}
	end

Item:

Switch Wall_Switch "Wall Switch" { channel="mihome:ctrl_ln1:158d0002c20996:ch1" }

Thing:

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

try this :

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 …

1 Like

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.

I tried out your suggestion.

Approach 1:

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:

The Button channel in the Wireless Switch is greyed out, while Wall Switch has a blue Switch channel.

Above, I gave you a working code. How does it not suit you?

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.

I am using this function right now. Nothing change in both cases.

The Wireless Switch gives the following log once I press it:

 mihome:86sw1:158d000317723f:ch1 triggered SHORT_PRESSED

, but the Wall Switch doesn’t.

I’m pretty shure it should, at least when this logic function is active. Maybe the Binding is bugged?

I tried, translated into a logical in the application mihome and I also have no reaction, sorry, but I have no more options.

log:set trace org.openhab.binding.mihome

No reaction to pressing the switch when the option is on is logical :frowning:
I’m sorry.
If you find a solution, please share it here.

1 Like

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.