Giter Site home page Giter Site logo

ha-sun2's People

Contributors

metbril avatar pnbruckner avatar skrashevich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ha-sun2's Issues

Getting errors in my logs from the Sun2 component

Here are my environment settings, and the errors I'm receiving below:

System Health

version core-2021.6.6
installation_type Home Assistant Core
dev false
hassio false
docker false
virtualenv true
python_version 3.9.0
os_name Darwin
os_version 10.16
arch x86_64
timezone America/New_York
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 4278
Installed Version 1.13.2
Stage running
Available Repositories 856
Installed Repositories 94
Home Assistant Cloud
logged_in true
subscription_expiration July 16, 2021, 8:00 PM
relayer_connected true
remote_enabled true
remote_connected true
alexa_enabled true
google_enabled false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Lovelace
dashboards 4
resources 54
views 24
mode storage
Spotify
api_endpoint_reachable ok
Logger: homeassistant.components.sensor
Source: custom_components/sun2/sensor.py:43
Integration: Sensor (documentation, issues)
First occurred: 3:50:41 PM (2 occurrences)
Last logged: 3:50:41 PM

Error adding entities for domain sensor with platform sun2
Error while setting up sun2 platform for sensor
Traceback (most recent call last):
  File "/Users/homeassistant/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity_platform.py", line 383, in async_add_entities
    await asyncio.gather(*tasks)
  File "/Users/homeassistant/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity_platform.py", line 588, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/Users/homeassistant/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 614, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/Users/homeassistant/.homeassistant/custom_components/sun2/sensor.py", line 158, in async_added_to_hass
    self._setup_fixed_updating()
  File "/Users/homeassistant/.homeassistant/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
    next_midn = next_midnight(dt_util.now(self._tzinfo))
  File "/Users/homeassistant/.homeassistant/custom_components/sun2/sensor.py", line 43, in next_midnight
    return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'zoneinfo.ZoneInfo' object has no attribute 'localize'
Logger: homeassistant.util.logging
Source: util/logging.py:105
First occurred: 3:53:00 PM (42 occurrences)
Last logged: 3:53:17 PM

Exception in async_loc_updated when dispatching 'sun2_loc_updated': () Traceback (most recent call last): File "/Users/homeassistant/.homeassistant/custom_components/sun2/sensor.py", line 145, in async_loc_updated self._loc_updated() File "/Users/homeassistant/.homeassistant/custom_components/sun2/sensor.py", line 140, in _loc_updated self._setup_fixed_updating() File "/Users/homeassistant/.homeassistant/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating next_midn = next_midnight(dt_util.now(self._tzinfo)) File "/Users/homeassistant/.homeassistant/custom_components/sun2/sensor.py", line 43, in next_midnight return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time())) AttributeError: 'zoneinfo.ZoneInfo' object has no attribute 'localize'

High CPU Load

Hi,

If I use your nice Integration on my Dashboard within a browser on a remote raspberry pi 3. I face an very high cpu load for it.
For trying to get an evidence that it comes realy from ha-sun2, I put the integration onto a new blank tab Page as the only element and all Time I switch onto that tab the Raspberry CPU load is going up to 75% - 90%. If I switch back to other Stuff on parallel Pages e.g. Weather or mini media panel it is alway goes down to less then 5% to 10% of CPU load.
If I let the browser window on that tab with your integration, CPU load raises until the raspberry shows up a temperatur alarm on the upper right corner.
I did no special configuration for the configuration on lovelace:

entities:
max_elevation: sun.sun
moon: sensor.moon
noon: sensor.solar_noon
sunrise: sensor.sunrise
sunset: sensor.sunset
meridiem: false
name: Sonnenstand
type: 'custom:sun-card'

Do someone have the same behavier or a hint to prevent it ?

Error log

Logger: homeassistant.components.sensor
Source: custom_components/sun2/sensor.py:43
Integration: Sensor (documentation, issues)
First occurred: 4:40:31 AM (2 occurrences)
Last logged: 4:40:32 AM

Error adding entities for domain sensor with platform sun2
Error while setting up sun2 platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 587, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 681, in add_to_platform_finish
await self.async_added_to_hass()
File "/config/custom_components/sun2/sensor.py", line 158, in async_added_to_hass
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'zoneinfo.ZoneInfo' object has no attribute 'localize'

No version not allowed by Home assistant

Hello Got a warning ...

Logger: homeassistant.loader
Source: loader.py:802
First occurred: 11:16:04 (3 occurrences)
Last logged: 11:16:08

No 'version' key in the manifest file for custom integration 'sun2'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'sun2'

Regards Frank

Automation based on rising attribute fails

I have a really strange problem. I have an integration that has a condition that checks the rising attribute of the sun_phase sensor for rising is false. For some reason it always fails. Below is a capture of the condition:
Screen Shot 2022-08-24 at 8 26 09 PM

And here is a capture of the current state of the sensor:

Screen Shot 2022-08-24 at 8 26 23 PM

I must missing something simple, but the condition fails and the automation never fires, even though the attribute rising is false.

Any clue what I am doing wrong?

Enhancement Request: Date configuration/Next transition

This is a nice bit of work!

Looking at your code I see that you are doing calculations for solar elevations in the future. With that in mind could you:

  1. Make a sensor configuration parameter of "date"? That being tomorrow or some other day in the future, i.e., what time is sunrise tomorrow? Ideally, this would be a date offset, e.g., "today + 1", "tomorrow"

  2. My intent for this is to determine the next transition, i.e., if it's currently day time, the next transition will be "sunset" and it will happen in "hh:mm:ss"

Sadly, I'm not a Python programmer, so I can provide you with a code PR.

Thanks.

Elevation stops updating

Just recently I noticed that the elevation sensor doesn't update regularly anymore, which is breaking automations that use the sensor.

Right now it's 9 AM and the sun is above the horizon, but it tells me that the next update is in the afternoon and the sun is below the horizon. I haven't changed any configuration, other than updating HA to the latest version. After rebooting HA it works again for about a day, before it stops updating regularly again.

CleanShot 2021-01-27 at 08 59 37

sun2: Error on device update! From HA version 2021.5.0dev20210402

I can’t use anymore this integration from this Dev version
Log is:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 482, in async_device_update
    await task
  File "/config/custom_components/sun2/binary_sensor.py", line 284, in async_update
    cur_elev = astral_loc().solar_elevation(cur_dttm)
AttributeError: 'tuple' object has no attribute 'solar_elevation'

Regards

Request additional timestamps

Hello,

I wanted to ask, if it is possible to create timestamps for user defined eleveation:
triggering on specific elevation is possible, but the calculation of the respective timestamp can only be done for the next cycle.

In order to visualize the upcomming times, I would like to have the timestamps for the last cycles, as you have it for dusk and dawn (yesterday, today, tomorrow)

I found no support for this feature, maybe it is possible to consider, if this can be implemented in one of the next releases.

Spartacus

New Home Assistant Requirement

No 'version' key in the manifest file for custom integration 'sun2'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'sun2'

Error with HA 2021.5.0

After upgrading to HA 2021.5.0 I get this error:

This error originated from a custom integration.

Logger: homeassistant.config
Source: custom_components/sun2/sensor.py:5
Integration: sun2 (documentation, issues)
First occurred: 9:41:17 AM (2 occurrences)
Last logged: 9:45:38 AM

Platform error: sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 853, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 493, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 498, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/sun2/sensor.py", line 5, in <module>
    from astral import AstralError
ImportError: cannot import name 'AstralError' from 'astral' (/usr/local/lib/python3.8/site-packages/astral/__init__.py)

Needs a version number. As of Home Assistant 2021.6 sun2 will not be loaded

Logger: homeassistant.loader
Source: loader.py:786
First occurred: April 9, 2021, 4:30:17 PM (1 occurrences)
Last logged: April 9, 2021, 4:30:17 PM

No 'version' key in the manifest file for custom integration 'sun2'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'sun2'

Sun card stopped working after 105.4

Sun card stopped working after 105.4 (and 105.5). I only get the picture, but no info on the sun2 entities. I cannot find any sun2 entities under the developer tools either. I have installed the 1.6 version. My sensor looks like (which I didn't change)

`platform: sun2
monitored_conditions:

  • sunrise
  • sunset
  • daylight
  • night
  • elevation
  • solar_noon
  • max_elevation`

I got this in the log:

2020-02-18 13:46:16 ERROR (MainThread) [homeassistant.setup] Setup failed for sun2: No setup function defined.

Error adding entities

Some of the entities are not loading properly, such as dawn, dusk, max_elevation and min_elevation. The home assistant log shows the error:

2021-06-29 00:16:19 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform sun2 Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 383, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 588, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 614, in add_to_platform_finish await self.async_added_to_hass() File "/config/custom_components/sun2/sensor.py", line 158, in async_added_to_hass self._setup_fixed_updating() File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating next_midn = next_midnight(dt_util.now(self._tzinfo)) File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time())) AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize' 2021-06-29 00:16:19 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up sun2 platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 258, in _async_setup_platform await asyncio.gather(*pending) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 383, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 588, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 614, in add_to_platform_finish await self.async_added_to_hass() File "/config/custom_components/sun2/sensor.py", line 158, in async_added_to_hass self._setup_fixed_updating() File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating next_midn = next_midnight(dt_util.now(self._tzinfo)) File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time())) AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'

Integration sun2 not found

Hi, I am getting this error:

Screen Shot 2022-06-08 at 5 34 52 pm

I've installed manually and with HACS with the same result. The files are in my config/custom_components so I am not sure whats wrong

Add optional prefix config variable

E.g.:

sensor:
  - platform: sun2
    monitored_conditions: [daylight, sunrise, sunset]
    prefix: solar

Which results in:

sensor.solar_daylight
sensor.solar_sunrise
sensor.solar_sunset

astral V. 3.2 - Moon data

Looks like the package now has the calculations for
Moon rise, set, azimuth and zenith.

https://pypi.org/project/astral/1.2/#history

Any chance you can enhance your Sun2 with a moon sensor with state like on/off or up/ down and attributes for the rest of the moon data?

Maybe appropriate to rename the integration to Sun and Moon.

WARNING: Sun elevation will not reach -12.000000 again until 2020-07-28

Thank you for a nice add-on to HA, @pnbruckner.
I would not call this an error, nor would I expect a WARNING for the fact the sun will not be lower than -12 or -18 in the summer months.

I live in the Oslo region, at 59 degrees North.
We love the long summer nights up here :-)
2020-05-24 22:50:20 WARNING (MainThread) [custom_components.sun2.binary_sensor] Sun elevation will not reach -12.000000 again until 2020-07-28 2020-05-24 22:50:20 WARNING (MainThread) [custom_components.sun2.binary_sensor] Sun elevation will not reach -18.000000 again until 2020-08-18

cannot import "astral_event"

after upgrading to the new version (2.0.1) I get this error from the configuration check

Platform error sensor.sun2 - cannot import name 'astral_event' from 'custom_components.sun2.helpers' (/config/custom_components/sun2/helpers.py)

Request/Enhancement Sensor Daylight "actual_state"

In the past i used Deconz addon, which provided Daylight sensor (as you know i guess...)
I searched for a replacement and found this. But i am missing a beloved feature :)

I don't want to work with several different sensors therefore it would be nice to have a actual_state sensor (i dont care for the naming)
which just shows the string of the actual Sun state depending on the calculations.

E.g.
sensor.sun2_actual_state = "solar_noon"
switch to
sensor.sun2_actual_state = "sunset"
switch to
sensor.sun2_actual_state = "dusk"
switch to ... etc.

Anyone else thinks that this may be useful?

Thanks in advance

Cannot import name 'astral_event' from 'custom_components.sun2.helpers'

Logger: homeassistant.components.hassio
Source: components/hassio/init.py:482
Integration: Home Assistant Supervisor (documentation, issues)

Platform error sensor.sun2 - cannot import name 'astral_event' from 'custom_components.sun2.helpers' (/config/custom_components/sun2/helpers.py)

Some other information about the environment:

  • Sun2 version: 2.0.0
  • Home Assistant OS: 2021.5.0

Deprecation notice with homeassistant 2022.3.3+

Hey there,

first of all (as you might hear that from anyone who is reporting an issue while just consuming your awesome addons without giving anything back ;-)) thanks for your components. I use these for at least 2 years now and they helped me a lot in making my life a little bit more smart.


I haven't had too much time to investigate more on this, but I've seen some messages regarding this component in my logs and thus wanted to create an issue first before I dive deeper into this.

Entity sensor.sunrise (<class 'custom_components.sun2.sensor.Sun2PointInTimeSensor'>) implements device_state_attributes. Please report it to the custom component author.

If I find some time this weekend, I might have a look on this.

Request/Enhancement: Azimuth (or direction)

Thank you for your work on this. Very hand so far. I would like certain automations to differ based on where the sun is coming from (for example, if it is pouring in through the side that has windows, or if it is behind the garage). Is it a lot of work to get azimuth or direction? Thank you for considering it.

Elevation sensors are not working

For some reason I don't understand, the elevation sensors are not working for me.

I added the following to the configuration.yaml:

  - platform: sun2
    monitored_conditions:
      - sunrise
      - sunset
      - sun_phase
      - daylight
      - night
      - elevation
      - min_elevation
      - max_elevation

But I only see the following sensors:

  • binary_sensor.above_horizon
  • sensor.civil_daylight
  • sensor.daylight
  • sensor.night
  • sensor.sun_phase
  • sensor.sunrise
  • sensor.sunset

See also here:
2023-03-11 13 58 57 192 168 0 156 b11b807e66a7

Home Assistant 2023.3.3
Supervisor 2023.03.1
Operating System 9.5
Frontend 20230309.0 - latest

Feature request: add previous_* attributes

Interesting integration and a well-chosen name! ;-)

With the current sun integration I found no way to check if the current time is between today's sunrise + 1 hour, because as soon a the sun is up, the attribute updates to tomorrow's sunrise.
Therefore, I would like to still be able to access today's sunrise so I can do something like:

{{ is_state('sun2.sun', 'below_horizon') or (is_state('sun2.sun', 'above_horizon') 
and (as_timestamp(now()) - as_timestamp(states.sun2.sun.attributes.previous_rising)) | int > 3600)

HACS installation not working

Hi,

I tried to install the integration via HACS by addint the custom repository as described. It's then listed as imported repo, but even after a HA restart there's no new "sun2" integration available to add in HA.

Unfortunately, also the logs didn't output any error related to this. Is there anything else that could be checked?

Thanks in advance.

2021.12b0 warnings

Home Assistant 2021.12b0 reports a bunch of warnings for the Sun2 integration:

2021-12-04 13:04:42 WARNING (MainThread) [homeassistant.helpers.entity] Entity sensor.sunrise (<class 'custom_components.sun2.sensor.Sun2PointInTimeSensor'>) implements device_state_attributes. Please report it to the custom component author.
2021-12-04 13:04:42 WARNING (MainThread) [homeassistant.helpers.entity] Entity sensor.solar_noon (<class 'custom_components.sun2.sensor.Sun2PointInTimeSensor'>) implements device_state_attributes. Please report it to the custom component author.
2021-12-04 13:04:42 WARNING (MainThread) [homeassistant.helpers.entity] Entity sensor.sunset (<class 'custom_components.sun2.sensor.Sun2PointInTimeSensor'>) implements device_state_attributes. Please report it to the custom component author.
2021-12-04 13:04:42 WARNING (MainThread) [homeassistant.helpers.entity] Entity sensor.astronomical_dusk (<class 'custom_components.sun2.sensor.Sun2PointInTimeSensor'>) implements device_state_attributes. Please report it to the custom component author.
2021-12-04 13:04:42 WARNING (MainThread) [homeassistant.helpers.entity] Entity sensor.max_elevation (<class 'custom_components.sun2.sensor.Sun2MaxElevationSensor'>) implements device_state_attributes. Please report it to the custom component author.

Sensor naming(?)

Any chance to get an input parameter for the sensor which add a “name” to the sensor, like:

  - platform: sun2
    pre_name: "sun2_"
    monitored_conditions:
      - dawn
      - sunrise
      - solar_noon
      - sunset
      - dusk
      - daylight
      - night
      - elevation
      - max_elevation
      - min_elevation

Resulting in sensor names like:
sensor.sun2_elevation
sensor.sun2_max_elevation
sensor.sun2_min_elevation
sensor.sun2_dawn
sensor.sun2_sunrise
Just to be able to have a distinctive names for this package/sensor group (since it’s not default).

Cheers.

Error in log: sun2: Error on device update!

HA version: core-2021.5.4. Sun2 2.0.0.0.
The message appears only after HA restart and is logged twice at exactly the same time.

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/astral/sun.py", line 862, in dusk
return time_of_transit(
File "/usr/local/lib/python3.8/site-packages/astral/sun.py", line 343, in time_of_transit
hourangle = hour_angle(
File "/usr/local/lib/python3.8/site-packages/astral/sun.py", line 243, in hour_angle
HA = acos(h)
ValueError: math domain error

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 407, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 516, in async_device_update
await task
File "/config/custom_components/sun2/sensor.py", line 182, in async_update
self._update()
File "/config/custom_components/sun2/sensor.py", line 198, in _update
super()._update()
File "/config/custom_components/sun2/sensor.py", line 176, in _update
self._yesterday = self._get_data(today - _ONE_DAY)
File "/config/custom_components/sun2/sensor.py", line 172, in _get_data
return self._get_astral_event(self._event, date_or_dt)
File "/config/custom_components/sun2/sensor.py", line 169, in _get_astral_event
return astral_event(self._info, event, date_or_dt, self._solar_depression)
File "/config/custom_components/sun2/helpers.py", line 69, in astral_event
return getattr(loc, event)(date_or_dt, observer_elevation=elev)
File "/usr/local/lib/python3.8/site-packages/astral/location.py", line 416, in dusk
return astral.sun.dusk(observer, date, self.solar_depression, self.tzinfo)
File "/usr/local/lib/python3.8/site-packages/astral/sun.py", line 867, in dusk
raise ValueError(
ValueError: Sun never reaches 18.0 degrees below the horizon, at this location.

Sun_Phase Sensor not updating correctly

For a couple of days my sun phase sensor has been failing to update correctly in the morning.

It is just missing out some of the phases, I still get updates at noon and in the evening, but its staying at night until solar noon.
Error log:

This error originated from a custom integration.

Logger: custom_components.sun2.sensor
Source: custom_components/sun2/sensor.py:125
Integration: sun2
First occurred: November 4, 2022 at 23:52:43 (6 occurrences)
Last logged: November 4, 2022 at 23:52:43

London Sun Phase: Failed to find the time at elev: -12.000
London Sun Phase: Failed to find the time at elev: -6.000
London Sun Phase: Failed to find the time at elev: -4.000
London Sun Phase: Failed to find the time at elev: -0.833
London Sun Phase: Failed to find the time at elev: 6.000

my .yaml configuration:


- platform: sun2
  entity_namespace: London
  latitude: #########
  longitude: ########
  time_zone: Europe/London
  elevation: 11
  monitored_conditions:
    - sunrise
    - sunset
    - sun_phase
    - dawn
    - dusk
    - solar_noon
    - solar_midnight
    - daylight
    - night

Errors in Sun2 with 2021.6

It never ends... You maybe already know but 2021.6 is breaking sun2

2021-05-28 09:37:05 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform sun2
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 585, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 614, in add_to_platform_finish
await self.async_added_to_hass()
File "/config/custom_components/sun2/sensor.py", line 158, in async_added_to_hass
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:05 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up sun2 platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 257, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 585, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 614, in add_to_platform_finish
await self.async_added_to_hass()
File "/config/custom_components/sun2/sensor.py", line 158, in async_added_to_hass
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 WARNING (SyncWorker_1) [homeassistant.components.history] state_changes_during_period was called from average, this is a deprecated function. Use homeassistant.components.recorder.history.state_changes_during_period instead, please report this to the maintainer of average
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'
2021-05-28 09:37:15 ERROR (MainThread) [homeassistant.util.logging] Exception in async_loc_updated when dispatching 'sun2_loc_updated': ()
Traceback (most recent call last):
File "/config/custom_components/sun2/sensor.py", line 145, in async_loc_updated
self._loc_updated()
File "/config/custom_components/sun2/sensor.py", line 140, in _loc_updated
self._setup_fixed_updating()
File "/config/custom_components/sun2/sensor.py", line 130, in _setup_fixed_updating
next_midn = next_midnight(dt_util.now(self._tzinfo))
File "/config/custom_components/sun2/sensor.py", line 43, in next_midnight
return dt.tzinfo.localize(datetime.combine(dt.date() + _ONE_DAY, time()))
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'localize'

astronomical sensors return 'incorrect' state

please see: community post: https://community.home-assistant.io/t/enhanced-sun-component/63553/227?u=mariusthvdb

in short using:

sensor:
# https://github.com/pnbruckner/ha-sun2
  - platform: sun2
    entity_namespace: astro
    monitored_conditions:
      - solar_midnight
      - astronomical_dawn
      - nautical_dawn
      - dawn
      - sunrise
      - solar_noon
      - sunset
      - dusk
      - nautical_dusk
      - astronomical_dusk
      - daylight
      - civil_daylight
      - nautical_daylight
      - astronomical_daylight
      - night
      - civil_night
      - nautical_night
      - astronomical_night

gives:
Schermafbeelding 2019-06-22 om 15 04 57
Schermafbeelding 2019-06-22 om 15 05 39

The 'Invalid Date' and 'Unknown' seem to indicate a config error, while in fact they are unknown, because astronomical sensors are for when the sun is 18° below the horizon, which does not happen at my location at this time of the year (at least.)

so not a bug, but a misleading state. If this is beyond the integration (because the frontend handles the state display) this unfortunate. If a 'not set' or 'not available' could be displayed, that would describe the state more precisely.
if not possible, ill close.
thanks for a great (again) integration.

Add unique_id's to entities

Entities should have a unique ID so they can be modified via the UI, currently they do not and you get the following

image

Error on check config - new

Platform error sensor.sun2 - cannot import name 'astral_event' from 'custom_components.sun2.helpers' (/config/custom_components/sun2/helpers.py)

I can't install sun2

I can't install sun2 using hacs...I copied it to /hassio/homeassistant/custom_components folder, but sun2 is not in the hacs list, what am I doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.