Switch turns on/off every 15 min.

Moderator: leecollings

Post Reply
nedde
Posts: 3
Joined: Wednesday 04 January 2017 17:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Switch turns on/off every 15 min.

Post by nedde »

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 3716 times
anasazi
Posts: 43
Joined: Saturday 06 August 2016 9:53
Target OS: Windows
Domoticz version:
Location: Sweden
Contact:

Re: Switch turns on/off every 15 min.

Post by anasazi »

Shouldn't you be using "Off AFTER 15" instead of FOR.
User avatar
jumbotroll
Posts: 793
Joined: Tuesday 13 January 2015 14:36
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Oslo,Norway
Contact:

Re: Switch turns on/off every 15 min.

Post by jumbotroll »

Try this :-)

If Kaffe = On
Do
Set Kaffe = On For 15 minutes
If you like the work I do for synology and domoticz, I appreciate a donation.
https://paypal.me/Jumbotroll
Regards
Jumbotroll
http://www.jadahl.com
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Switch turns on/off every 15 min.

Post by emme »

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
The most dangerous phrase in any language is:
"We always done this way"
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Switch turns on/off every 15 min.

Post by Egregius »

Or pass2php:

Code: Select all

<?php
if(apcu_fetch('sKaffe')=='On'&&apcu_fetch('tKaffe')<time-900) sw(apcu_fetch('iKaffe'),'Off');
 
User avatar
StanHD
Posts: 347
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.

Post by StanHD »

There is an "Off After X Seconds" block (900 seconds) ;)
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
nedde
Posts: 3
Joined: Wednesday 04 January 2017 17:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by nedde »

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: 290
Joined: Tuesday 12 January 2016 11:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest β
Location: The Netherlands (Alkmaar)
Contact:

Re: Switch turns on/off every 15 min.

Post by gielie »

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?
- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Switch turns on/off every 15 min.

Post by Nautilus »

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 12:37, edited 1 time in total.
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Switch turns on/off every 15 min.

Post by emme »

could it be that the ON FOR 600 keep the device in the devicechanged table for 600 seconds?!
The most dangerous phrase in any language is:
"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: Switch turns on/off every 15 min.

Post by Nautilus »

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: 290
Joined: Tuesday 12 January 2016 11:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest β
Location: The Netherlands (Alkmaar)
Contact:

Re: Switch turns on/off every 15 min.

Post by gielie »

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

Is there also a way to create a countdown?
- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Switch turns on/off every 15 min.

Post by Nautilus »

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...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest