Switch turns on/off every 15 min.

Must be cleaned all topics go to the right subforum
nedde
Posts: 3
Joined: Wednesday 04 January 2017 18:34
Target OS: Raspberry Pi
Domoticz version:
Contact:

Switch turns on/off every 15 min.

Postby nedde » Wednesday 11 January 2017 16:38

I want the switch to turn of after 15 minutes after it is turend on but it keeps
turning on/off every 15 min instead. What's am I doing wrong? Picture Attached.
Attachments
2017-01-11 15_37_08-Domoticz.png
2017-01-11 15_37_08-Domoticz.png (7.59 KiB) Viewed 412 times

anasazi
Posts: 31
Joined: Saturday 06 August 2016 9:53
Target OS: Windows
Domoticz version:
Location: Sweden
Contact:

Re: Switch turns on/off every 15 min.

Postby anasazi » Wednesday 11 January 2017 16:41

Shouldn't you be using "Off AFTER 15" instead of FOR.

User avatar
jumbotroll
Posts: 471
Joined: Tuesday 13 January 2015 15:36
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Oslo,Norway
Contact:

Re: Switch turns on/off every 15 min.

Postby jumbotroll » Wednesday 11 January 2017 16:45

Try this :-)

If Kaffe = On
Do
Set Kaffe = On For 15 minutes
Regards
Jumbotroll
http://www.jadahl.com

User avatar
emme
Posts: 372
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Switch turns on/off every 15 min.

Postby emme » Wednesday 11 January 2017 16:52

I think you cannot do that with blocky....
the script will loop all the time....

try LUA instead:

Code: Select all

commandArray = {}
     if devicechanged['Kaffe'] and otherdevices['Kaffe'] == 'On' then
          commandArray['Kaffe'] = 'On FOR 900'     -- the FOR instance works in secs
     end
return commandArray
That's one small step for a programmer, one giant leap for me!
- - - - -
Raspberry Pi3 + AeonStick G5 + RFXCOMM433 + iRTrans Server + NodeJS
There's no stress in the mess!!

Egregius
Posts: 2059
Joined: Thursday 09 April 2015 12:19
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: Beitem, BE
Contact:

Re: Switch turns on/off every 15 min.

Postby Egregius » Wednesday 11 January 2017 17:00

Or pass2php:

Code: Select all

<?php
if(apcu_fetch('sKaffe')=='On'&&apcu_fetch('tKaffe')<time-900sw(apcu_fetch('iKaffe'),'Off');
 

User avatar
StanHD
Posts: 461
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Switch turns on/off every 15 min.

Postby StanHD » Wednesday 11 January 2017 18:14

There is an "Off After X Seconds" block (900 seconds) ;)
Domotica - Intel nuc Celeron, Domoticz - Windows, RFXTRX433E. 1-Wire USB. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub, HA-Bridge with Amazon Echo / Alexa.

nedde
Posts: 3
Joined: Wednesday 04 January 2017 18:34
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: RE: Re: Switch turns on/off every 15 min.

Postby nedde » Saturday 14 January 2017 0:10

anasazi wrote:Shouldn't you be using "Off AFTER 15" instead of FOR.

Worked a lot better :) thx

Sent from my Nexus 6 using Tapatalk

User avatar
gielie
Posts: 52
Joined: Tuesday 12 January 2016 12:40
Target OS: Raspberry Pi
Domoticz version: latest B
Location: The Netherlands
Contact:

Re: Switch turns on/off every 15 min.

Postby gielie » Tuesday 21 February 2017 12:35

I have a question, i have this code.

Code: Select all

commandArray = {}
     if devicechanged['Koffie'] and otherdevices['Koffie'] == 'On' then
          commandArray['Koffie'] = 'On FOR 600'     -- the FOR instance works in secs
    if devicechanged['Koffie'] and otherdevices['Koffie'] == 'Off' then
          commandArray['SendNotification']='Koffie machine is uitgeschakeld'
     end
return commandArray


But when de koffie is Off Domoticz will spam me with messages, i only want to recieve 1 message after the event took place.
How can i do this?
- Vision ZU1401 USB Stick
- Aeotec MultiSensor 6
- FIBARO FGS222
- FIBARO FGWPE Wall Plug
- Everspring AN157
- Neo CoolCam Power plug
- Neo CoolCam PIR Sensor
- Popp Smoke Detector
- Toon
- Kodi Media Server

Nautilus
Posts: 490
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Switch turns on/off every 15 min.

Postby Nautilus » Tuesday 21 February 2017 13:27

gielie wrote:I have a question, i have this code.

Code: Select all

commandArray = {}
     if devicechanged['Koffie'] and otherdevices['Koffie'] == 'On' then
          commandArray['Koffie'] = 'On FOR 600'     -- the FOR instance works in secs
    if devicechanged['Koffie'] and otherdevices['Koffie'] == 'Off' then
          commandArray['SendNotification']='Koffie machine is uitgeschakeld'
     end
return commandArray


But when de koffie is Off Domoticz will spam me with messages, i only want to recieve 1 message after the event took place.
How can i do this?


The syntax is bit incorrect, not sure if this is the reason. Try:

Code: Select all

commandArray = {}
if devicechanged['Koffie'] == 'On' then
    commandArray['Koffie'] = 'On FOR 600'     -- the FOR instance works in secs
elseif devicechanged['Koffie'] == 'Off' then
    commandArray['SendNotification']='Koffie machine is uitgeschakeld'
end
return commandArray
Last edited by Nautilus on Tuesday 21 February 2017 13:37, edited 1 time in total.

User avatar
emme
Posts: 372
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Switch turns on/off every 15 min.

Postby emme » Tuesday 21 February 2017 13:31

could it be that the ON FOR 600 keep the device in the devicechanged table for 600 seconds?!
That's one small step for a programmer, one giant leap for me!
- - - - -
Raspberry Pi3 + AeonStick G5 + RFXCOMM433 + iRTrans Server + NodeJS
There's no stress in the mess!!

Nautilus
Posts: 490
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Switch turns on/off every 15 min.

Postby Nautilus » Tuesday 21 February 2017 13:35

emme wrote:could it be that the ON FOR 600 keep the device in the devicechanged table for 600 seconds?!


Not sure about this, but agreed that more logical would be:

Code: Select all

commandArray = {}
if devicechanged['Koffie'] == 'On' then
    commandArray['Koffie'] = 'Off AFTER 600'
elseif devicechanged['Koffie'] == 'Off' then
    commandArray['SendNotification']='Koffie machine is uitgeschakeld'
end
return commandArray

User avatar
gielie
Posts: 52
Joined: Tuesday 12 January 2016 12:40
Target OS: Raspberry Pi
Domoticz version: latest B
Location: The Netherlands
Contact:

Re: Switch turns on/off every 15 min.

Postby gielie » Tuesday 21 February 2017 16:47

U guys are great, it works, thanks a lot.

Is there also a way to create a countdown?
- Vision ZU1401 USB Stick
- Aeotec MultiSensor 6
- FIBARO FGS222
- FIBARO FGWPE Wall Plug
- Everspring AN157
- Neo CoolCam Power plug
- Neo CoolCam PIR Sensor
- Popp Smoke Detector
- Toon
- Kodi Media Server

Nautilus
Posts: 490
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Switch turns on/off every 15 min.

Postby Nautilus » Tuesday 21 February 2017 17:03

gielie wrote:Is there also a way to create a countdown?


Sure, with a time script (they run once each minute) you can at least have a once per minute count down timer...


Return to “Scripts [cleaning in progress]”

Who is online

Users browsing this forum: Failure404 and 2 guests