Closed tcheronneau closed 4 years ago
I guess you should use state
property instead, like in example:
return {
on = {
devices = {
'Switch',
}
},
execute = function(domoticz, device)
if (device.state == 'Click') then
//Action 1
end
if (device.state == 'Double Click') then
//Action 2
end
end
}
I'm using it with a simple example found on internet :
return {
active = true,
on = {
devices = {
'Interrupteur'
}
},
execute = function(domoticz, switch)
if (switch.state == 'On' ) then
domoticz.notify('This rocks!', 'Turns out that it is getting warm here', domoticz.PRIORITY_LOW)
switch.switchOff()
end
end
}
If I put Click on state it's doing nothing.
Could you please make a screenshot of your device. Are you sure it is selector switch?
Yes it's a selector switch :
Then my script definitely should work as I have the same device with the same script
Yes that's what I thought too from what I've seen on internet but it's really not :) I've tried with Blockly and DZevents and working only when I put state to On or Off. Even when I change the selector from domoticz directly.
Do you have all these levels like "Click", "Double Click", etc in device menu?
Yes I have everything.
Then have no idea why it doesn't work. Just could recommend to check that you don't have devices with the same name in Domoticz and that when you perform action on physical device it changes state in Domoticz one.
Hi,
I'm not sure it's an real issue or me that's doing bad configuration. My setup is : Zigbee2Mqtt -> MQTT -> Domoticz. I've few Xiaomi devices and everything seems to work well. When I click the wireless switch I see event in Zigbee2MQTT : {"battery":100,"voltage":3002,"linkquality":68,"click":"single"}
When I check the log of the device on domoticz I see "Click" But when I do an automation I've only that event value : Status: dzVents: Info: Handling events for: "Interrupteur", value: "On"
So I cannot do any automation based on the number of click only On/off.
Is it something somebody already experienced and can help me with ?
Thanks