Hi,
I am using a magnetic switch on a garden gate to switch on a lamp.
When the switch changes I sent an On FOR 10 to the lamp.
But now it seems that when the gate changes 2 times within the 10 minutes, the lamp keeps ON forever.
Is this a bug?
What can I do to workaround?
on for, on for makes it ON forever, BUG? Topic is solved
Moderators: leecollings, remb0
-
Nautilus
- Posts: 722
- Joined: Friday 02 October 2015 12:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Finland
- Contact:
Re: on for, on for makes it ON forever, BUG?
The "On FOR" basically sets the switch to "On" status and then returns to original status after the given time period. If the switch is already on when "On FOR" command is given (as it is the case for the second trigger) then it will not turn off at all. You need to use two commands in your script, a plain "On" command followed by a "Off AFTER" command (which is is seconds I think, so use "Off AFTER 600"). Hope this helps... 
-
ensingg
- Posts: 65
- Joined: Saturday 22 April 2017 17:35
- Target OS: Windows
- Domoticz version:
- Contact:
Re: on for, on for makes it ON forever, BUG?
Can I do this in one command-array :
commandArray[#commandArray + 1] = {['Device_1']='On'} ...
commandArray[#commandArray + 1] = {['Device_1']=Off Ater'} ...
commandArray[#commandArray + 1] = {['Device_1']='On'} ...
commandArray[#commandArray + 1] = {['Device_1']=Off Ater'} ...
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: on for, on for makes it ON forever, BUG?
are you sure the contact is well positioned? could it be that it 'flaps' (sorry, cannot figure out another word to explain it better
) so it keeps change state on/off?
the complete script test the state change or the value in a specific moment?
try dzVents:
then check the log to see if it fires continuosly
ciao
M
the complete script test the state change or the value in a specific moment?
try dzVents:
Code: Select all
return {
on = {
devices = { 'myGardenDoor'},
},
execute = function(domoticz, device)
if (device.state == 'On') then
domoticz.devices('myGardenLamp').switchOn().for_min(10)
domoticz.notify('Garden info - The light is on',domoticz.LOG_FORCE)
end
end
}ciao
M
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
-
Nautilus
- Posts: 722
- Joined: Friday 02 October 2015 12:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Finland
- Contact:
Re: on for, on for makes it ON forever, BUG?
Correct, this kind of syntax should work in Lua (well, the amount of seconds is missing of course but I guess that was on purpose). You can of course use dzVents or Blockly as well, choose the one you like best...ensingg wrote: Wednesday 27 September 2017 8:56 Can I do this in one command-array :
commandArray[#commandArray + 1] = {['Device_1']='On'} ...
commandArray[#commandArray + 1] = {['Device_1']=Off Ater'} ...
But as emme suggests, one option is to check the witch state before giving the command so that "On FOR" would be triggered only when the switch is Off. However, this can result to the light turning of when you are still doing something in the yard as the timer does not reset to 10 minutes when you go through the gate if the light is already on. So I'd just stick with the "On" + "Off AFTER" option.
Who is online
Users browsing this forum: No registered users and 1 guest