For example id like to check if lights are off after lets say 8pm,
if not id like to try switch them off and check in 5min,
if yes id like not to start script any more.
I hope you can understand my problem
Moderator: leecollings
Code: Select all
on = {
devices = { 'mylight' = { 'between 20:00 and 20:05' }Code: Select all
on = {
timer= { 'every 5 minutes between 20.00 and 23:59' }
}
execute = function(domoticz, security)
domoticz.devices('mylight').switchOff().checkFirst()
end
}
My preference would be to use the approach @emme used but if you don't want to execute your script, a dzVents solution could berkarolek wrote: Wednesday 03 October 2018 13:24 Is it possible to run script in specified time range, but only if some devices are off?
For example id like to check if lights are off after lets say 8pm,
if not id like to try switch them off and check in 5min,
if yes id like not to start script any more.
I hope you can understand my problem![]()
Code: Select all
-- active when function returns true ( )
local myTimerange = "at 15:33-15:55" -- your Timeslot
local myLightIDX = 535 -- Your light's idx
return {
active = function(domoticz) -- This function will be evaluated every minute by the dzVents system
myLight = domoticz.devices(myLightIDX)
return myLight.state == "On"
end,
on = { timer = { myTimerange .. " every 5 minutes" }},
execute = function(dz)
myLight.switchOff()
end
}script like the above does not mesh....rkarolek wrote: Wednesday 03 October 2018 15:28 yes, i know that, but script is triger and in case many scripts can make some mesh in network.
would be nice if script will triger for example between 8 and 10pm but only if specify device value is on.
Code: Select all
on = {
devices = {
'mylight' = { 'between 20:00 and 22:00' }
}
execute = function(domoticz, myLight)
domoticz.devices('mylight').cancelQueuedCommands()
if myLight.state == 'On' then
domoticz.devices('mylight').switchOff().afterMin(5)
end
end
}Let me try to help. Probably the confusing part isrkarolek wrote: Wednesday 03 October 2018 17:06 i try analyze waaren's code, but im new in dzvents, so its a bit strange for me, have to read more about it![]()
Code: Select all
active = function(domoticz) -- This function will be evaluated every minute by the dzVents system
myLight = domoticz.devices(myLightIDX)
return myLight.state == "On"
end,
Code: Select all
active = trueUsers browsing this forum: No registered users and 1 guest