Sunrise/sunset condition

Hello, I’m creating a scene to turn on a light using a motion sensor. I don’t have a light sensor so I’d like to use sunset/sunrise as a condition instead of a time period. Is that possible with Gladys in its current state?

Thanks

Hello :slight_smile:

There is no native condition, but it’s possible to do it anyway!

You create a virtual sensor in the MQTT integration, which you call « Sunrise », and you set it as an On/Off outlet, or a motion sensor, it doesn’t matter as long as it’s binary.

Then you make 2 scenes:

  • The sun rises → set the sensor to ON (1)
  • The sun sets → set the sensor to OFF (0)

Then, in your scene, you use « Condition on variables » on that variable (optionally with an If… Then… Else if you want to handle 2 cases).

If you think it could be a good addition to Gladys, it could be a feature request in Demande de fonctionnalités :wink:

1 Like

Thanks @pierre-gilles for your solution, I’ll test it asap.

If I’m not the only one who wants this feature, it could be interesting.

3 Likes

Yes, absolutely, don’t hesitate to create the request and then, depending on the votes, it’ll come :slight_smile:

PRs welcome too if you know how to develop, it’s not very complicated :smiley:

1 Like