Page 1 of 1
switch off after
Posted: Wednesday 13 February 2019 12:05
by pvklink
Hi, i have an on/off switch that is set by measuring the usage of a washingmachine.
When it is finished my on/off switch is triggered to on and a wav file is played..
So far so good...
I also made a script for the on/of switch so that is will be turned off after 10 seconds...
This doed not work, and i dont know why... seems so easy...
-- switch
return {
on = {devices = {'voice_vorstalarm'}},
logging = { level = domoticz.LOG_DEBUG ,
marker = "Security"},
execute = function(dz, device, info)
if device.state == 'On' then
device.switchOff().afterSec(10)
end
end
}
Re: switch off after
Posted: Wednesday 13 February 2019 13:00
by waaren
pvklink wrote: Wednesday 13 February 2019 12:05
I also made a script for the on/of switch so that is will be turned off after 10 seconds...
This doed not work, and i dont know why... seems so easy...
What this script does is switch Off the voice_vorstalarm 10 seconds after it has been switched On. Is that what you intend ?
If so please add a log statements to see what happens.
Code: Select all
-- switch
return {
on = {devices = {'voice_vorstalarm'}},
logging = { level = domoticz.LOG_DEBUG ,
marker = "Security"},
execute = function(dz, device, info)
dz.log("device " .. device.name .. " switched to " .. device.state,dz.LOG_DEBUG)
if device.state == 'On' then
device.switchOff().afterSec(10)
end
end
}
Re: switch off after
Posted: Wednesday 13 February 2019 13:07
by pvklink
Yes, when it becomes colder then x-degrees i get a voice message but the switch stays on..
So i want it off again after a period of time....
added the log now wait for a temperature change
Re: switch off after
Posted: Wednesday 13 February 2019 13:26
by pvklink
mmm.. strange it works now
problem was the refresh timer of my dashticz
Re: switch off after
Posted: Wednesday 13 February 2019 13:47
by pvklink
does work when i manually set the switch on but when my temperature script triggers this switch i get this
2019-02-13 13:30:17.172 Status: dzVents: Debug: Security: Constructed timed-command: Off
2019-02-13 13:30:17.172 Status: dzVents: Debug: Security: Constructed timed-command: Off AFTER 10 SECONDS
2019-02-13 13:30:17.172 Status: dzVents: Debug: Security: device voice_vorstalarm switched to On
Re: switch off after
Posted: Wednesday 13 February 2019 14:34
by waaren
pvklink wrote: Wednesday 13 February 2019 13:47
does work when i manually set the switch on but when my temperature script triggers this switch i get this
2019-02-13 13:30:17.172 Status: dzVents: Debug: Security: Constructed timed-command: Off
2019-02-13 13:30:17.172 Status: dzVents: Debug: Security: Constructed timed-command: Off AFTER 10 SECONDS
2019-02-13 13:30:17.172 Status: dzVents: Debug: Security: device voice_vorstalarm switched to On
Seems the standard messages to me. Maybe confusing but that is what you normally see when debug mode is on and you use the afterXXX() method .
Re: switch off after
Posted: Wednesday 13 February 2019 14:42
by pvklink
mm.. it says device voice_vorstalarm switched to On ! instead of off
Re: switch off after
Posted: Wednesday 13 February 2019 14:58
by waaren
pvklink wrote: Wednesday 13 February 2019 14:42
mm.. it says device voice_vorstalarm switched to On ! instead of off
Yes. That comes from this line
Code: Select all
dz.log("device " .. device.name .. " switched to " .. device.state,dz.LOG_DEBUG)
The other lines are from internal dzVents / domoticz when line
is interpreted. Confusing part is probably the sequence.