pnbruckner / ha-sun2

Home Assistant Sun2 Sensor
The Unlicense
223 stars 20 forks source link

Sensors for golden hour and blue hour #129

Open voidzero opened 1 month ago

voidzero commented 1 month ago

I was wondering if it's possible for you to add sensors for golden hour and blue hour. It would be eight additional sensors: blue/golden hour, dusk/dawn, start/end.

That way I could add them to my dashboard.

voidzero commented 1 month ago

Just thinking out loud -- this morning I noticed that golden hour is taking too long:

image

I'm going by the times as displayed in my Mobile Observatory Android app. Here's a screenshot for that:

So golden hour for today at my location, according to this app, would be from 6:03 to 7:16 (elevation of the sun is between 0° and 10°) and tonight from 20:02 to 21:14. Blue hour would be from between 4:57 and 5:48, and in the evening from 21:29 to 22:20 (elevation is between 8° and 2° below the horizon).

I wrote down all the times from Mobile Observatory, in order. There is some overlap.

    01 astro dawn 2:48
    02 nautical dawn 4:15
03 blue dawn start 4:55
    04 civil dawn 5:13
05 blue dawn stop 5:46
    06 sunrise 5:55
07 golden dawn start 6:02
08 golden dawn end 7:14
    09 transit culminatie 13:39
10 golden dusk start 20:03
11 golden dusk end 21:16
    12 sunset 21:22
13 blue dusk start 21:31
    14 civil dusk 22:04
15 blue dusk end 22:22
    16 nautical dusk 23:01
    17 astro dusk 0:31
    18 antitransit ondermeridiaan 1:39
pnbruckner commented 3 weeks ago

I was wondering if it's possible for you to add sensors for golden hour and blue hour. It would be eight additional sensors: blue/golden hour, dusk/dawn, start/end.

That way I could add them to my dashboard.

The phase sensor has three attributes -- blue_hour, golden_hour & rising -- that you could use to create (binary) template sensors. Would that help?

Or do you really need sensors that indicate when each of these periods start & end?

pnbruckner commented 3 weeks ago

Just thinking out loud -- this morning I noticed that golden hour is taking too long:

image

It looks like you're using Sun2's "deCONZ Daylight" sensor. That sensor was designed to mimic HA's built-in deCONZ Daylight Sensor. Even though the description implies the state is golden_hour_1 during the morning golden hour, that's not how it actually works. I think that sensor is very misleading, but like I said, it was made to mimic an already existing sensor. Someone had asked for that a long time ago because they had used the deCONZ Daylight Sensor for a long time, had automations based on it, but for whatever reason couldn't use the real integration anymore. So, I obliged and created this sensor. I don't actually think it's very useful. Which is why I created the phase sensor which I believe is much more useful.

So golden hour for today at my location, according to this app, would be from 6:03 to 7:16 (elevation of the sun is between 0° and 10°)

That's not the definition of golden hour that I have seen. FYI, the phase sensor (and its attributes) are based on blue hour being defined as the sun's elevation between -6 & -4 degrees, and golden hour being between -4 & +6 degrees.

pnbruckner commented 3 weeks ago

@voidzero you could also do what was suggested here:

https://community.home-assistant.io/t/enhanced-sun-component/63553/658

voidzero commented 1 week ago

Hi Phil:

Much thanks and sorry for the delay with replying, I became very ill, my situation is improving now. I'll have a look and check back in. Thanks.

pnbruckner commented 6 days ago

No problem. Sorry to hear you've been ill, and glad to hear your condition is improving! Let me know if you have any other questions, or if you'd need help implementing any of the suggestions.

voidzero commented 6 days ago

Thanks so much Phil. By the way, is this integration compatible with HACS version >= 2?

pnbruckner commented 6 days ago

By the way, is this integration compatible with HACS version >= 2?

I have no idea. I haven't tried upgrading HACS yet.