Bathroom light on for a specific amount of time

Moderator: leecollings

Post Reply
User avatar
kuifje
Posts: 36
Joined: Wednesday 25 October 2017 16:38
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Heemskerk
Contact:

Bathroom light on for a specific amount of time

Post by kuifje »

Hello there,
I have a question that I can not answer.
I want my bathroom light to stay on for 1 hour but when I turn it off within the hour the time set should go to nil.
Now I have build a working blocky but the time goes on after i turned of the light. When i turn the light on within the first time set, say after 50 minutes, then the light turns off in 10 minutes. I want the time to set again for a hour.
Is there anyone who knows how to build this in blocky?
Thanks in advance,
Herbert
Attachments
Knipsel.JPG
Knipsel.JPG (34.91 KiB) Viewed 2710 times
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Bathroom light on for a specific amount of time

Post by tozzke »

You should change to the other If-block (with the blue icon on top) and add a variable like so:

Image
In this case the 'Else if' turns the switch off again, but turning it off with this blockly results in the cancellation of the timed off from the first 'If' statement.
The variable prevents retriggering
User avatar
kuifje
Posts: 36
Joined: Wednesday 25 October 2017 16:38
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Heemskerk
Contact:

Re: Bathroom light on for a specific amount of time

Post by kuifje »

Thanks tozzke i will give it a try,and it works like a charm.
greetings,
Herbert
User avatar
Antori91
Posts: 136
Joined: Sunday 12 February 2017 17:12
Target OS: NAS (Synology & others)
Domoticz version: 4.10717
Location: France
Contact:

Re: Bathroom light on for a specific amount of time

Post by Antori91 »

Hello,
I've tried such Blockly in a Raspberry using the latest Domoticz release.
It doesn't work in my environment. The first time I switch ON "Hue gen2 3", I can see "TEST_badkamer" taking the value 1 (initial value 0) and then "Hue gen2 3" automatically switched OFF after 30 seconds.
BUT it seems the Else If code part is never executed when "Hue gen2 3" goes down. So the timer off cancellation never happens and because "TEST_badkamer" keeps the value 1 instead of going to zero, next time you switch ON "Hue gen2 3", it is for always.
Any idea?
Domoticz High Availability Cluster: Synology Dz V4.10693 (Main) - Raspberry Dz V4.10717 (Backup) - Scripts Node.js
Alarm server: Raspberry - motionEye - iot_ALARM-SVR Node.js
Sensors/Actuators: ESP8266-Arduino
https://github.com/Antori91/Home_Automation
User avatar
Antori91
Posts: 136
Joined: Sunday 12 February 2017 17:12
Target OS: NAS (Synology & others)
Domoticz version: 4.10717
Location: France
Contact:

Re: Bathroom light on for a specific amount of time

Post by Antori91 »

Sorry, in fact IT JUST WORKS FINE !!
My Blockly had a nasty error in the Else If part (see below)
Capture2.GIF
Capture2.GIF (87.56 KiB) Viewed 1854 times
Domoticz High Availability Cluster: Synology Dz V4.10693 (Main) - Raspberry Dz V4.10717 (Backup) - Scripts Node.js
Alarm server: Raspberry - motionEye - iot_ALARM-SVR Node.js
Sensors/Actuators: ESP8266-Arduino
https://github.com/Antori91/Home_Automation
User avatar
Antori91
Posts: 136
Joined: Sunday 12 February 2017 17:12
Target OS: NAS (Synology & others)
Domoticz version: 4.10717
Location: France
Contact:

Re: Bathroom light on for a specific amount of time

Post by Antori91 »

Hello,

Finally, I've modified a little bit the code (remove second condition of the first if). See code below. I suggest this modification because :
- the code I've removed doesn't seem necessary to do the job,
- in case of unattended Domoticz shutdown when "Hue gen2 3" is ON, at Domoticz restart, "TEST_badkamer" will be still equal to 1. So, the next time you switch ON "Hue gen2 3", it is for ever (no timer countdown anymore) unless you manually switch OFF "Hue gen2 3".

PS: in my blockly version, ENTREE is "Hue gen2 3" and TWILIGHT is "TEST_badkamer"
Capture3.GIF
Capture3.GIF (71.71 KiB) Viewed 1832 times
Domoticz High Availability Cluster: Synology Dz V4.10693 (Main) - Raspberry Dz V4.10717 (Backup) - Scripts Node.js
Alarm server: Raspberry - motionEye - iot_ALARM-SVR Node.js
Sensors/Actuators: ESP8266-Arduino
https://github.com/Antori91/Home_Automation
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest