Page 1 of 1

Aqara wired wall 1-button switch (QBKG04LM, no neutral) decoupled mode

Posted: Sunday 05 April 2020 16:43
by tarantino
I'm using RPi with cc2531 and cann't add this switch to Domoticz correctly. Found the way to enable decoupled mode through json commands and MQTT Explorer now shows "release" and "hold" states, but in Domoticz I only can turn on and off it as a relay, but so far didn't find the way to use it as wireless switch. Is there anyone who uses this switch in wireless mode with domoticz?

Re: Aqara wired wall 1-button switch (QBKG04LM, no neutral) decoupled mode

Posted: Sunday 05 April 2020 16:59
by azonneveld
I use the agara switch.
To switch lights or something, I used a devicebased script.

commandArray = {}

for deviceName,deviceValue in pairs(devicechanged) do
if (deviceName=='AgaraSwitch') then
if deviceValue == "On" then
commandArray[#commandArray + 1] = {['LivingRoomLights'] = "On"}
elseif deviceValue == "Off" then
commandArray[#commandArray + 1] = {['LivingRoomLights'] = "Off"}
end
end
end

return commandArray

Re: Aqara wired wall 1-button switch (QBKG04LM, no neutral) decoupled mode

Posted: Sunday 05 April 2020 17:48
by tarantino
azonneveld wrote: Sunday 05 April 2020 16:59 commandArray = {}

for deviceName,deviceValue in pairs(devicechanged) do
if (deviceName=='AgaraSwitch') then
if deviceValue == "On" then
commandArray[#commandArray + 1] = {['LivingRoomLights'] = "On"}
elseif deviceValue == "Off" then
commandArray[#commandArray + 1] = {['LivingRoomLights'] = "Off"}
end
end
end

return commandArray
This way it's working as is, but this is for hardware (wired) part, isn't it? I mean how to us it in wireless mode, when it returns "release" and "hold" states?

Re: Aqara wired wall 1-button switch (QBKG04LM, no neutral) decoupled mode

Posted: Sunday 05 April 2020 18:43
by azonneveld
tarantino wrote: Sunday 05 April 2020 17:48 This way it's working as is, but this is for hardware (wired) part, isn't it? I mean how to us it in wireless mode, when it returns "release" and "hold" states?
Ah, I misunderstood, I have the wireless (battery operated) version of the switch.

Re: Aqara wired wall 1-button switch (QBKG04LM, no neutral) decoupled mode

Posted: Monday 06 April 2020 9:38
by tarantino
I found the reason of the problem - there is an error in zigbee2mqtt plugin. It has no separate QBKG04LM.py and using it just as a simple switch, without decoupled and wireless modes. I modified _init_.py, made my own QBKG04LM.py and got my wireless mode clicks in Domoticz! Now I think I have to move this question to zigbee2mqtt plugin discussion.

Re: Aqara wired wall 1-button switch (QBKG04LM, no neutral) decoupled mode

Posted: Friday 10 April 2020 8:24
by azonneveld
tarantino wrote: Monday 06 April 2020 9:38 I modified _init_.py, made my own QBKG04LM.py
Please post your modifications to the github page, so this could be included in the releases: https://github.com/Koenkk/zigbee2mqtt

Re: Aqara wired wall 1-button switch (QBKG04LM, no neutral) decoupled mode

Posted: Saturday 11 April 2020 22:36
by tarantino
azonneveld wrote: Friday 10 April 2020 8:24
tarantino wrote: Monday 06 April 2020 9:38 I modified _init_.py, made my own QBKG04LM.py
Please post your modifications to the github page, so this could be included in the releases: https://github.com/Koenkk/zigbee2mqtt
Already done and new version of plugin supports all switch modes :!: