pnbruckner / ha-sun2

Home Assistant Sun2 Sensor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error adding entities

ultimateguy opened this issue · comments

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'

@ultimateguy have you upgraded to the latest version?

Sorry, somehow I missed the new version. All is well now.