Hi,
Could you help me with a script for switching on a device if the source is x minutes On
For example:
I want to turn On a device after a light is x minutes On
I tried to make it with blocky but it is not possible to use a Control block IF and a Set block On for x minutes
Thanks
Turn on device after On state other device
Moderator: leecollings
-
- Posts: 20
- Joined: Friday 10 August 2018 19:29
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Turn on device after On state other device
Hi, this is de LUA code I used in Fibaro, how can I modify this to use it in Domoticz.
setTimeout(function()
local delayedCheck0 = false;
local tempDeviceState0, deviceLastModification0 = fibaro:get(31, "value");
if (( tonumber(fibaro:getValue(31, "value")) > 0 ) and (os.time() - deviceLastModification0) >= 120) then
delayedCheck0 = true;
end
local startSource = fibaro:getSourceTrigger();
if (
( delayedCheck0 == true )
or
startSource["type"] == "other"
)
then
fibaro:call(33, "turnOn");
fibaro:sleep(300000)
fibaro:call(33, "turnOff")
end
end, 120000)
setTimeout(function()
local delayedCheck0 = false;
local tempDeviceState0, deviceLastModification0 = fibaro:get(31, "value");
if (( tonumber(fibaro:getValue(31, "value")) > 0 ) and (os.time() - deviceLastModification0) >= 120) then
delayedCheck0 = true;
end
local startSource = fibaro:getSourceTrigger();
if (
( delayedCheck0 == true )
or
startSource["type"] == "other"
)
then
fibaro:call(33, "turnOn");
fibaro:sleep(300000)
fibaro:call(33, "turnOff")
end
end, 120000)
-
- Posts: 536
- Joined: Friday 23 December 2016 16:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: Netherlands Purmerend
- Contact:
Re: Turn on device after On state other device
I think you can use this example : https://www.domoticz.com/wiki/Event_script_examples
or the dzvents version :
From the domoticz examples online:
http://www.domoticz.com/wiki/Event_script_examples
or the dzvents version :
From the domoticz examples online:
http://www.domoticz.com/wiki/Event_script_examples
Code: Select all
[[Send a warning when the garage door has been open for more than 10 minutes
]]
return {
active = true,
on = {
['timer'] = {
'every minute',
}
},
execute = function(domoticz)
local door = domoticz.devices('Garage door')
if (door.state == 'Open' and door.lastUpdate.minutesAgo > 10) then
domoticz.notify('Garage door alert',
'The garage door has been open for more than 10 minutes!',
domoticz.PRIORITY_HIGH)
end
end
}
Who is online
Users browsing this forum: No registered users and 1 guest