aqara wall switch selector switch

Moderator: leecollings

Post Reply
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

aqara wall switch selector switch

Post by tjabas »

Hi!

i have an Aqara zigbee wireless wall switch with 2 buttons, in domoticz it shows an an selector switch, in the device manager it shows as only one switch, my plan was to use this aqara switch to control 2 diferent lights but with only one selector switch in domoticz i really dont know how i can use it in blocky.

do you have any suggestions?
domogijs
Posts: 99
Joined: Monday 17 August 2015 23:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: aqara wall switch selector switch

Post by domogijs »

Hi


Aqara wall swich uses 4 states; off, switch 1, switch 2, BothClick

I dont use blocky but dzevents. the script looks something like this:

Code: Select all

return {
	on = {
		devices = {
			'wallswitch'
		}
	},
	execute = function(domoticz, switch)
	   if (switch.state == 'Switch 2') then 
	     
	     domoticz.devices('lamp').toggleSwitch()
		
	end
end
}
Hopes this helps

Greets Gijs (noob but trying to contribute to the community)
Raspberry Pi3, RFlink, PiZigate, Yeelight, klikaanklikuit, Kodi, harmony hub, Zwave, ThermoSmart, XiaomiGateway (Aqara), Google home hub, roomba,
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: aqara wall switch selector switch

Post by tjabas »

thanks, but i dont use script, i really dont know how to use it, im stuck with blocky, is it possible to do all in blocky?
gerbenvanasselt
Posts: 74
Joined: Friday 07 September 2018 14:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta 4.1
Location: Netherlands
Contact:

Re: aqara wall switch selector switch

Post by gerbenvanasselt »

Hi Tjabas,

This is an example of a blocky with using a selector switch. I hope this is what you are searching for.
Just place a variable in domosettings --> uservariables.

Image

this is the xml to import it:
Blocklyxml.txt
(4.41 KiB) Downloaded 113 times
Attachments
blockly.JPG
blockly.JPG (73.75 KiB) Viewed 4131 times
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: aqara wall switch selector switch

Post by tjabas »

Thank you, that is exactly what im looking for :)
gerbenvanasselt
Posts: 74
Joined: Friday 07 September 2018 14:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta 4.1
Location: Netherlands
Contact:

Re: aqara wall switch selector switch

Post by gerbenvanasselt »

You're welcome, if I can save you the research time it is great.

Verstuurd vanaf mijn ONEPLUS A6003 met Tapatalk

tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: aqara wall switch selector switch

Post by tjabas »

sorry but i didnt have any luck with this blocky, i made an user variable, like this: 6 toggle switch String [0,1,2] 2019-08-30 23:08:28

i dont know if its right.

but i cant seem to understand where i should ad the light buld that i want to turn on by this aqara switch. in blocky i mean
gerbenvanasselt
Posts: 74
Joined: Friday 07 September 2018 14:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta 4.1
Location: Netherlands
Contact:

Re: aqara wall switch selector switch

Post by gerbenvanasselt »

You have to replace the url part with the light name and add status on or of.
You can use json url to dim a bulb.

Verstuurd vanaf mijn ONEPLUS A6003 met Tapatalk

tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: aqara wall switch selector switch

Post by tjabas »

i found this: http://127.0.0.1:8080/json.htm?type=com ... cmd=Toggle


works great , thank you all for the help :)
gerbenvanasselt
Posts: 74
Joined: Friday 07 September 2018 14:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta 4.1
Location: Netherlands
Contact:

Re: aqara wall switch selector switch

Post by gerbenvanasselt »

Yes indeed, did not know about the json toggle version. Thanks for sharing. But nowadays I start dzvents which has a toggling option in it.

Verstuurd vanaf mijn ONEPLUS A6003 met Tapatalk

joostvanwijk
Posts: 1
Joined: Sunday 27 December 2020 14:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: aqara wall switch selector switch

Post by joostvanwijk »

gerbenvanasselt wrote: Friday 30 August 2019 22:10 This is an example of a blocky with using a selector switch. I hope this is what you are searching for.
Just place a variable in domosettings --> uservariables.

Image

this is the xml to import it:
Blocklyxml.txt
Thanks for the xml! I was looking for a way to use the aqara switch as a dimmer. Is this the right blocky script to do this?
I don't get the togglecount though... where do you use this for? This is not a value in my domoticz? Do I need something to do first in order to get this?

Thanks in advance!
gerbenvanasselt
Posts: 74
Joined: Friday 07 September 2018 14:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta 4.1
Location: Netherlands
Contact:

Re: aqara wall switch selector switch

Post by gerbenvanasselt »

The toggle count is used for creating a circle which will take it off state when highest number is reached.

This way you can use one button to do more actions. Every toggle count number is another action with one button.

Verstuurd vanaf mijn ONEPLUS A6003 met Tapatalk


tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: aqara wall switch selector switch

Post by tjabas »

can i use this switch to dim up or down a light?
gerbenvanasselt
Posts: 74
Joined: Friday 07 September 2018 14:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta 4.1
Location: Netherlands
Contact:

Re: aqara wall switch selector switch

Post by gerbenvanasselt »

I think you can do a cycle with dimming from minimal bright to bright in the number off steps you want and then ending with off.

Verstuurd vanaf mijn ONEPLUS A6003 met Tapatalk

Valiran
Posts: 13
Joined: Thursday 17 February 2022 0:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: aqara wall switch selector switch

Post by Valiran »

Hello,

Sorry to dig this, but I'm facing an issue with my dual wallswitch Aqara model WXKG02LM.
I'm on rPi4 + ZigateDin.
When I add the switch, it's defined as a selector with switch 1, switch 2, BothClick. Off is hidden by default.
The problem I'm facing is that the switch stay un position.
So when I click on left (Switch 1), it stays on Left even if I release. That mean the blockly script given upper is rolling in infinte loop because the Switch value is always equal to the last button you push.
Do you know I can "park" the switch value when not pressing?

EDIT: physically, the switch is not broken, the blue light is off when I release and is blue when I press, so I believe it's only on domoticz side, or Zigate plugin side maybe?
User avatar
waltervl
Posts: 5149
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: aqara wall switch selector switch

Post by waltervl »

In zigate there is a advanced setting about the off value related to Domoticz issue #4143. You can try to switch on the setting and restart plugin.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Valiran
Posts: 13
Joined: Thursday 17 February 2022 0:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: aqara wall switch selector switch

Post by Valiran »

Hello!
That still doesn't work, the selector stays on "Switch 1" for like 2-4 seconds, and during this time, the light blink because there are 2 actions on the button: on and off :(
Valiran
Posts: 13
Joined: Thursday 17 February 2022 0:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: aqara wall switch selector switch

Post by Valiran »

Nevermind...

A simple "http://IP_DOMO:PORT_DOMO/json.htm?type=command&param=switchlight&idx=IDX_OF_LIGHT&switchcmd=Toggle" did the trick.
Now each of my switch on my 2 gangs Aqara work like and old fashioned dual light switch and that's exactly what I wanted :D

If light is off, a push put light on, and vice versa :)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest