github pnbruckner/ha-sun2 3.1.1
Fix display of period-of-time sensors w/ HA 2024.2

latest releases: 3.3.3, 3.3.2, 3.3.1...
7 months ago

Starting in HA 2024.2, the frontend no longer displays sensors with a duration device_class as HH:MM:SS if the entity has a suggested_display_precision set, or the user has manually set a display_precision for the entity.

Previously, the period-of-time sensors (daylight/night) had a suggested_display_precision of 3. This change removes that setting.

Unfortunately, there's a bug in the sensor component that doesn't properly remove suggested_display_precision from the entity registry. Therefore, this change also forcibly removes it from the registry if necessary.

Also, add a state_class of measurment to period-of-time sensors (which was not possible for duration sensors in much older HA versions.)

Lastly, change the description of the elevation configuration option to "observer's elevation above ground level at specified location" instead of "location's elevation above sea level." Unfortunately, Home Assistant incorrectly describes the elevation option (in the general system configuration section) as elevation above sea level. This is not correct for the purpose of determining sun related events. If you've experienced the values returned by this integration were a bit different from other sources (such as weather websites, etc.), this is probably the reason why.

Therefore, the following are suggested:

  • If you've set a display precision for any of the daylight or night sensors, remove that setting (i.e., return it to default.)
  • Change the elevation option for all your Sun2 configurations per the discussion above. In most cases that probably means changing it to zero (or maybe 1 or 2 meters.)

Don't miss a new ha-sun2 release

NewReleases is sending notifications on new releases.