Page 1 of 1

Enabling / disabling a scene based on time of day?

Posted: Tuesday 27 December 2016 23:25
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

Enabling / disabling a scene based on time of day?

Posted: Wednesday 28 December 2016 1:08
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

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

Posted: Wednesday 28 December 2016 1:41
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.

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

Posted: Monday 10 December 2018 18:36
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 1032 times
I'm going to start playing with that in a few days.