aqara wall selector switch

Moderator: leecollings

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

aqara wall selector switch

Post by tjabas »

Hi!

im trying to get my aqara wall switch to control a lightbulb , but i dont understand even a bit of this dzVents programming stuff, since it is an selector switch it makes it difficult, im used to blocky, but this selector switch doesnt seem to work wit blocky, this is my script so far:

Code: Select all

return {
	on = {
		devices = {
			'Hallen_extra'
		}
	},
	execute = function(domoticz, switch)
	   if (switch.state == 'Right_klick') then 
	     
	     domoticz.devices('Hall_lampor').toggleSwitch()
		
	end
end
}
And its not working at all :(

What im trying to do is that when i press Right_klick on the aqara wallswitch it should turn on Hall_lampor

but its not working.
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 selector switch

Post by gerbenvanasselt »

Here is an example,

for me it workes like this:

Code: Select all

return {

   on = { devices = { 'lumi.switch'}        -- Name of your button
    },           
   execute = function(dz, item, device)
        if item.state == '1 Click' then
            dz.devices('Woonkamer_Lamp2').toggleSwitch()    -- Name of your light
            dz.log(device.state, dz.LOG_INFO)
        end
   end
}
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: aqara wall selector switch

Post by waaren »

tjabas wrote: Friday 30 August 2019 17:22 im trying to get my aqara wall switch to control a lightbulb. What im trying to do is that when i press Right_klick on the aqara wallswitch it should turn on Hall_lampor
but its not working.
What might give you an idea on what is happening is to add some log statements.

Code: Select all

return {
	on = {
		devices = {
			'Hallen_extra'
		}
	},
	execute = function(domoticz, switch)
		 domoticz.log('state of ' .. switch.name .. ' is now ' .. switch.state, domoticz.LOG_INFO)		
		 domoticz.log('state of Hall_lampor  is ' .. domoticz.devices('Hall_lampor').state, domoticz.LOG_INFO)
	   	if (switch.state == 'Right_klick') then -- could this be a typo ?
     			domoticz.log('state of Hall_lampor  will be toggled', domoticz.LOG_INFO)
			domoticz.devices('Hall_lampor').toggleSwitch()
		else
			domoticz.log('no action needed for Hall_lampor', domoticz.LOG_INFO)
		end
	end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest