WTH can't Sun integration provide a sensor with current day state (dawn, dusk, day, night) for automation trigger/condition?

Sun integration provides dawn, dusk, etc… hours, but why can’t it provide a sensor with the current day state?

It could then be used as trigger or condition in automations.

I am not entirely sure about what you want, but maybe Sun2 can provide it.
It is a vastly better sun sensor than the builtin.

1 Like

I’ve seen it, I don’t know why it was rejected, but it seems confusing (nautical? astronomical? civil?).

And it doesn’t seem to provide current day state either.

I don’t care about times, I want a simple sensor state/status for automation triggers/conditions.

then create a template sensor for that :slight_smile:

1 Like

what do you mean with “current day state”?

1 Like

There’s more than just one kind of sunrise/sunset. The one you’re probably familiar with is civil sunrise/sunset.

Diagram from timeanddate.com

3 Likes

Sunrise and sunset have technical definitions that can be calculated based on positional data. As the link provided by @123 shows there are 3 technical definitions each for dawn and dusk. Different cultures, governments, and individuals define the “states” of the day differently. There are options in HA to define your “day state” the way that works for you, where you live.

Time of Day Sensors

Template Sensors: Example 1, Example 2

Ok, so what you’re saying is that even the official sun integration is wrong :stuck_out_tongue:

next_* should be renamed to next_civil_* and additional next_{nautical|astronomical}_* should be provided.

What could be done is sensors like civil_daystate, nautical_daystate and astronomical_daystate, allowing user to choose.

About “Time of Day Sensors”, the “Sun Card” author complains that “Home assistant seems to provide next events instead today’s one”.
That would explain why every formula found in the forum have a short “night” between “dawn” and “day” for example.

I’ll try “Sun Phase Sensor” from Sun2 integration.

Based on the picture @123 posted I’m going to try with the elevation attribute of sun.

No, HA provides only todays events, but that is probably also what the author complains about.
At 2 minutes to midnight it still have the value of the todays sunset (that have past) and no value for tomorrows (next coming) sunset.
Sun2 is so much better in that it have yesterdays, todays and tomorrows values and you can get every version you would like, whether it be civil, nautical or whatever.