Im a blockly user, but blockly does not support seconds, so im out of luck there :/
Im looking for a very basic script, turning switch off->on defined number of times with defined interval. Is this done how ?
Thank you in advance

Moderator: leecollings
Nope, i need secondssnellejellep wrote: ↑Friday 28 August 2020 20:07 does the timer function of a switch not fill your needs?
What should trigger the actions ?tontze wrote: ↑Friday 28 August 2020 20:43Nope, i need secondssnellejellep wrote: ↑Friday 28 August 2020 20:07 does the timer function of a switch not fill your needs?Otherwise i would have been doing it with blockly ..
certain time of day, like 20:00, switch is on, then it switches off and on 6 times in 1 sec interval, and stays on.
Il look in to it, thnxsnellejellep wrote: ↑Friday 28 August 2020 21:00 you can do it in dzvents with for example <switchname>.switchOff().afterSec(5) which switches it off after 5 seconds
this should do the trick, turning it on and off 6 times and then leaving it on at 20:00tontze wrote: ↑Friday 28 August 2020 22:00Il look in to it, thnxsnellejellep wrote: ↑Friday 28 August 2020 21:00 you can do it in dzvents with for example <switchname>.switchOff().afterSec(5) which switches it off after 5 seconds
Code: Select all
return {
on ={
timer={
'at 20:00' -- the time at which this script should trigger
}
},
execute = function(dz, device)
local lamp = dz.devices("yourlampnameoridx")
lamp.switchOn()
lamp.switchOff().afterSec(1)
lamp.switchOn().afterSec(2)
lamp.switchOff().afterSec(3)
lamp.switchOn().afterSec(4)
lamp.switchOff().afterSec(5)
lamp.switchOn().afterSec(6)
lamp.switchOff().afterSec(7)
lamp.switchOn().afterSec(8)
lamp.switchOff().afterSec(9)
lamp.switchOff().afterSec(10)
lamp.switchOn().afterSec(11)
end
}
dzVents version
Code: Select all
return
{
on =
{
timer =
{
'at 20:00',
},
},
execute = function(dz)
light = dz.devices('Flicker')
for i = 0, 12, 2 do
light.switchOff().afterSec(i)
light.switchOn().afterSec(i + 1)
end
end
}
Code: Select all
local executionTime = '20:00'
local light = 'Flicker' -- Name of your light
commandArray = {}
if os.date('%H:%M') == executionTime then
for i = 0, 12, 2 do
commandArray[#commandArray + 1] = { [light] = 'Off AFTER ' .. i }
commandArray[#commandArray + 1] = { [light] = 'On AFTER ' .. (i + 1) }
end
end
return commandArray
Users browsing this forum: No registered users and 1 guest