Anyone who could help me with a scene

hello,
i’m stuck on a scene that should be simple, but i always get lost along the way

I would like, when my gate opens (I have a sensor), to turn on a projector but only when it’s dark, like 1 hour after sunset
so trigger gate open and if it’s night projector on

I get lost in the boxes and don’t know how to do it.

thanks for your help

Hi

In the trigger, you set „Every sunset“, you can specify after 60 min.

Then you need to retrieve the state of your sensor in a „Retrieve the last state“ action.

Then a „Condition on variable“ action to test the value of your sensor

And then an action to turn on the light.

This will only launch the scene once, not every time the portal opens. I don’t think this is possible in Gladys today. There’s a missing condition for whether the sun has set or not.

It is indeed not possible today directly in a single scene. But even if there was a condition on whether the sun is set or not, it would not quite meet your need since you want it to be night, so a little after sunset…

For your need, with what Gladys already allows, I think you should do this:

  • in the ‹ Virtual Mqtt Devices › integration, create a device of type ‹ switch › that you call for example « projector to turn on »
  • in a scene with a trigger « at each sunset » with the option « X minutes after » (you choose the X that pleases you), you use the action Control a device to change the value of « projector to turn on » to ‹ on ›
  • in a scene with a trigger « at each sunrise » with the option « X minutes before » (you choose the X that pleases you), you use the action Control a device to change the value of « projector to turn on » to ‹ off ›
  • in the scene you have already written, you indeed use the trigger « state change: the gate opens », you make an action Get the state of « projector to turn on », you add a Condition action on variable that checks if « projector to turn on » is ‹ on ›, and then you finish with the action to turn on the projector.

I hadn’t noticed every time it opens…

In this case, it’s also doable.

The trigger instead of the sun is the gate sensor..

Then either put a light sensor or test the sun with 2 other scenes next to it.

So a sunrise scene that sets an MQTT virtual sensor to 1.
Another sunset scene that sets this sensor to 0.
You can put a time condition in these scenes if needed.

And in the scene of the detected gate, the state of this virtual sensor.

When the gate opens, if the virtual sensor is at 0, it means it’s after sunset, so we turn on the light.

Personally, the virtual sensor triggered at sunrise and sunset is what I did in my install and I use it often

@pascal_sapin,

I do it with a virtual Mqtt device called ‹ night ›.

A scene sets it to ‹ 1 › twenty minutes after sunset. Another one sets it back to ‹ 0 › at sunrise.

I use it for many things, including this:

When you badge, you open the gate and check if it’s night. If so, you turn on the light…