I would like to combine a shelly 1 and a physical switch (inside the house) and a light+PIR (outside the house). The light should be switched on/off by the PIR. But when I use the physical switch inside, the light should stay on until I switch it off with physical switch.
For this, I would need to get the info in a dzvents script, what triggered the switch (the physical switch or a dzvents script from the PIR).
I looked through the dzvents wiki, but could not exactly figure out which object or attribute would have this info.
I would be looking for a statement to replace the parts
'triggered by physical button'
'triggered by the PIR'
in the script below. I would be glade about any help,
best regards
Code: Select all
return
{
on =
{
devices = { 'switch.test' }
},
execute = function(domoticz, switch)
if (switch.state == 'On' ) then
domoticz.log('Hey! Switch was set to on!')
if( 'triggered by physical button' ) then
-- stay switched on and ignore the PIR
elseif( 'triggered by the PIR' ) then
-- stay on for just 3 min
elseif (switch.state == 'Off' ) then
domoticz.log('Hey! Switch was set to off!')
-- recognize PIR again
else
end
end
}