Enabling / disabling a scene based on time of day?

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
rvorsten
Posts: 1
Joined: Tuesday 27 December 2016 23:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Enabling / disabling a scene based on time of day?

Post by rvorsten »

Folks -

New to Domoticz, I am trying to build my first scene to test if I am smart enough to use Domoticz...

I want to have the following functionality:
- when there is movement in the bathroom between 23:30 and 06:30, switch the LED lights to a soft dark blue light and go off after 60 seconds.

Here's what UI have built:
1) Fibaro RGB controller with LED strip - works fine
2) Fibaro Motion sensor - works fine
3) Added a scene: when motion is detected, set RGB-Blue to 10%, with 60 secs off-delay --> this scene works fine too

Now for the hard part: how can I make this work only between 23:30 and 06:30?

I have tried the following:
A) Added timers to the scene, but I do not understand how they impact the working of the scene. I can only select the command "On". "Off" is not in the pull-down.
B) I have created a blocky as follows:

if time == 23:00
do set scene "bathroom lights" = Active
else if time == 06:30
do set scene "bathroom lights" = Inactive

Whatever I try, the scene stays active.

What I am not getting?

Many thanks,
Ronald
pvm
Posts: 550
Joined: Tuesday 17 June 2014 22:14
Target OS: NAS (Synology & others)
Domoticz version: 4.10538
Location: NL
Contact:

Enabling / disabling a scene based on time of day?

Post by pvm »

Try something like:
If ((time > 23:00 and time <=23:59) or (time >0:00 and time < 6.30)) and movement == true then turn on scene
and keep the off delay in the scene
Synology NAS, slave PI3, ZWave (Fibaro), Xiaomi zigbee devices, BTLE plant sensor, DzVents, Dashticz on tablet, Logitech Media Server
sion
Posts: 113
Joined: Friday 08 January 2016 12:32
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Enabling / disabling a scene based on time of day?

Post by sion »

Haven't tried the above, but I do something similar with some of my lights.
I created a dummy switch called "night time" and set the timer on that switch so that it comes on at 11pm and off a 6.30 am .
You can then use this switch in as many blockeys/ scripts as you want - meaning if you want to adjust the times later you just have to change it once.

You blocky would just be :
If movement =true and "night time " = on
Set scene active.

I never seem to be able to get a scene to go inactive,
So always use groups - which you. An turn on or off.
You can set the off delay on the group.

Alternatively, and the way I do it, is to add the off deley in the blocky.

If night =on and motion=true
Set group x = on
Set group x = off after x seconds.
running domoticz 3.4834 on rpi2, with
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.

Next: harmony hub.
jimbo213Mo
Posts: 8
Joined: Friday 26 October 2018 21:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: United States
Contact:

Re: Enabling / disabling a scene based on time of day?

Post by jimbo213Mo »

I had the same question and @WAAREN was kind enough to provide this DzVents code:

local XtreeOff = "at 23:00"
local XtreeOn = "at 8:00"

return {
on = { timer = { XtreeOn, XtreeOff }},

logging = { level = domoticz.LOG_DEBUG, marker = "X-mas tree" },

execute = function(dz)
if dz.time.matchesRule(XtreeOff) then
dz.scenes("tree_off").switchOn()
else
dz.scenes("tree_on").switchOn()
end
end
}


But then he suggested that you can do the same in Domoticz using THIS scene feature:
SceneTimers.jpg
SceneTimers.jpg (14.73 KiB) Viewed 1028 times
I'm going to start playing with that in a few days.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest