pnbruckner/ha-sun2

Error log

Closed this issue · 2 comments

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'

More from the error log:

Logger: homeassistant.util.logging
Source: util/logging.py:105
First occurred: 5:13:20 AM (4 occurrences)
Last logged: 5:13:20 AM

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: 'zoneinfo.ZoneInfo' object has no attribute 'localize'

@bschatzow sorry, I don't work on HA much anymore. But it looks like to me that you hadn't upgraded to the latest release (2.0.2) of this custom component which should solve your problem.