pnbruckner / ha-sun2

Home Assistant Sun2 Sensor
The Unlicense
236 stars 22 forks source link

Sensors for golden hour and blue hour #129

Closed voidzero closed 3 weeks ago

voidzero commented 3 months 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 3 months 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 months 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 months 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 months ago

@voidzero you could also do what was suggested here:

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

voidzero commented 2 months 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 2 months 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 2 months ago

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

pnbruckner commented 2 months ago

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

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

pnbruckner commented 1 month ago

@voidzero can you provide an update on the current status of your original request?

voidzero commented 3 weeks ago

Hi Phil I'm sorry for the delay. Stuff got much worse here but hopefully I'm on the rebound now. (Crohn's and related immune system shenanigans)

I don't have time for it today but I'll pick it up this week and follow up, is that okay?

Btw - I can confirm it's fully compatible with hacs 2 or at least I haven't had issues since upgrading.

voidzero commented 3 weeks ago

Here is the configuration I wrote based on the link you provided where someone posted their json. It goes into configuration.yaml.

This should be sufficient to allow people to create their automation on based on BH/GH.

sun2:
  - unique_id: Home
    location: YOUR_CITY
    latitude: YOUR_LAT
    longitude: YOUR_LONG
    time_zone: Europe/Amsterdam
    sensors:
      - unique_id: bh_rising_start
        name: Blue Hour Rising (start)
        time_at_elevation: -6.0
        direction: rising
        icon: mdi:weather-sunset-up
      - unique_id: gh_rising_start
        name: Blue Hour Rising (end) / Golden Hour Rising (start)
        time_at_elevation: -4.0
        direction: rising
        icon: mdi:weather-sunset-up
      - unique_id: gh_rising_end
        name: Golden Hour Rising (end)
        time_at_elevation: 6.0
        direction: rising
        icon: mdi:weather-sunset-up

      - unique_id: gh_setting_start
        name: Golden Hour Setting (start)
        time_at_elevation: 6.0
        direction: setting
        icon: mdi:weather-sunset-down
      - unique_id: bh_setting_start
        name: Golden Hour Setting (end) / Blue Hour Setting (start)
        time_at_elevation: -4.0
        direction: setting
        icon: mdi:weather-sunset-down
      - unique_id: bh_setting_end
        name: Blue Hour Setting (end)
        time_at_elevation: -6.0
        direction: setting
        icon: mdi:weather-sunset-down

Thank you for your patience.