Option to set a delay before and after sunrise and sunset

Good evening,

I’m digging up this post to ask a newbie question.

I’d like to manage an automatic switch-on without a light sensor. I tried with this function, but it doesn’t work (it seems).

To be clearer (well, I hope), is there a function that handles « after sunset » and « after sunrise »?

Thanks for your answers.

Good evening @l.dolle
I use this to control a shutter in a scene: as the condition I set sunset, then I add a delay depending on how long I want it to wait before closing after sunset. I don’t know if that can help you?

Good evening @Psoy,

Actually, I’m trying to manage turning lights on and off after sunset. But right now, during my test the next day while the sun is up, the lights still turn on. I’d like to be able to manage a day/night function that handles the lights every time I enter the room and turns them off when I leave during the night (I have a Sonoff motion sensor). This sensor is great because it detects presence even without movement, but it doesn’t have an ambient light sensor.

Hello @l.dolle
With two scenes it can work, you need to create a virtual dawn sensor. (One small extra scene).

And does your Sonoff sensor have a latency between two detections?

I made this scene for the exterior light, but I added a delay to the turn-off.

Try this:
1st scene
condition : if Sonoff sensor = on

action 1
retrieve the last state: of the virtual dawn sensor

action 2
continue only if: virtual dawn sensor = false

action 3
turn on the room light

2nd scene
condition : if Sonoff detects nothing
action : turn off the room lamp

the sensor needs to be reliable, otherwise you’ll have to move a bit to turn the light back on :grinning:

or you can delay the lamp turn-off in the first scene, but if you stay in the room longer than the delay, you’ll be in the dark.
There you go, good luck testing

Hello @Psoy
Thanks for your reply. But I’m just starting out in the Gladys world.
Can you tell me how to create the virtual sunrise sensor?
I couldn’t find it on the site.

It’s an MQTT sensor that you need to create and name capteur-virtuel-lever-jour (for example) and which will be 0 (false, sun not risen) or 1 (true, sun risen).
Here is an example (but I never know exactly which MQTT functionality to choose):


An on/off lighting should be able to work, and you also have a sun icon :wink:

1 Like

Good evening @l.dolle and @mutmut
That’s exactly what @mutmut shows you, I use this feature as well
image.

Then you create a scene :


in home : you select the name in the dropdown list
2) action :
![image|690x227](upload

Good evening,
Thanks @mutmut and @Psoy for your advice.
I followed your instructions and it works well.
I tried with another feature « Input state » without much success.
Is there documentation that lists all the MQTT features?
Have a good evening.

1 Like

you’ll find documentation on scenes here
(here it’s at the very top of that page in the title Docs, then Scene) :wink:
That already gives a good idea, but after that it’s up to your imagination and testing :smile:
Good luck

1 Like

Good evening,
I just improved my sunset scene. Because the lamp only turned on when I was detected by the sensor after sunset.
So I also added the case where I’m already in front of the sensor at the moment of sunset.
This way, I cover both cases: absent or present at sunset.

1 Like