question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2021.6 Errors in Log

See original GitHub issue

Still digesting, but trying to figure out what changed:

Logger: homeassistant.components.switch
Source: custom_components/adaptive_lighting/switch.py:1045
Integration: Switch (documentation, issues)
First occurred: 1:53:37 PM (8 occurrences)
Last logged: 1:53:37 PM

Error adding entities for domain switch with platform adaptive_lighting
Error while setting up adaptive_lighting platform for switch
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/adaptive_lighting/switch.py", line 634, in async_added_to_hass
    await self.async_turn_on(adapt_lights=not self._only_once)
  File "/config/custom_components/adaptive_lighting/switch.py", line 723, in async_turn_on
    await self._update_attrs_and_maybe_adapt_lights(
  File "/config/custom_components/adaptive_lighting/switch.py", line 851, in _update_attrs_and_maybe_adapt_lights
    self._settings = self._sun_light_settings.get_settings(
  File "/config/custom_components/adaptive_lighting/switch.py", line 1146, in get_settings
    percent = self.calc_percent()
  File "/config/custom_components/adaptive_lighting/switch.py", line 1109, in calc_percent
    today = self.relevant_events(now)
  File "/config/custom_components/adaptive_lighting/switch.py", line 1097, in relevant_events
    events = [
  File "/config/custom_components/adaptive_lighting/switch.py", line 1098, in <listcomp>
    self.get_sun_events(now + timedelta(days=days)) for days in [-1, 0, 1]
  File "/config/custom_components/adaptive_lighting/switch.py", line 1053, in get_sun_events
    else _replace_time(date, "sunrise")
  File "/config/custom_components/adaptive_lighting/switch.py", line 1045, in _replace_time
    utc_time = self.time_zone.localize(date_time).astimezone(dt_util.UTC)
AttributeError: 'str' object has no attribute 'localize'
This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/adaptive_lighting/switch.py:1045
Integration: Adaptive Lighting
First occurred: 1:57:14 PM (**253 occurrences**)
Last logged: 3:30:41 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/adaptive_lighting/switch.py", line 738, in _async_update_at_interval
    await self._update_attrs_and_maybe_adapt_lights(
  File "/config/custom_components/adaptive_lighting/switch.py", line 851, in _update_attrs_and_maybe_adapt_lights
    self._settings = self._sun_light_settings.get_settings(
  File "/config/custom_components/adaptive_lighting/switch.py", line 1146, in get_settings
    percent = self.calc_percent()
  File "/config/custom_components/adaptive_lighting/switch.py", line 1109, in calc_percent
    today = self.relevant_events(now)
  File "/config/custom_components/adaptive_lighting/switch.py", line 1097, in relevant_events
    events = [
  File "/config/custom_components/adaptive_lighting/switch.py", line 1098, in <listcomp>
    self.get_sun_events(now + timedelta(days=days)) for days in [-1, 0, 1]
  File "/config/custom_components/adaptive_lighting/switch.py", line 1053, in get_sun_events
    else _replace_time(date, "sunrise")
  File "/config/custom_components/adaptive_lighting/switch.py", line 1045, in _replace_time
    utc_time = self.time_zone.localize(date_time).astimezone(dt_util.UTC)
AttributeError: 'str' object has no attribute 'localize'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
yurnihcommented, Jun 3, 2021

I got the same issue after upgrading. See also home-assistant/core#49643, with that merge the pytz timezone object changed to a string. I figured out that with a change of line 1045 to utc_time = date_time.replace(tzinfo=dt_util.DEFAULT_TIME_ZONE).astimezone(dt_util.UTC) the issue got solved for 2021.6.

1reaction
LeChuck2909commented, Jun 2, 2021

I also noticed, that some of my adaptive light integrations not work anymore. I found, that the one where sunrise_time is still “None”, works, the other one where sunrise_time was 07:00:00 did not work anymore. by removing the 07:00:00 and replace it with “None” again, i bring all adpative light integrations to work again. so i guess the issue is related to sunrise_time etc…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pro Tools 2021.6 Complete Bug Fix List
Here is the complete list of all the bug fixes included in Pro Tools 2021.6. Check it out to see if the bug...
Read more >
Pro Tools 2021.6 crashing on start : r/protools - Reddit
I'm a relative new user to pro tools and recently just updated from the 2020.9. 1 version when I originally started to the...
Read more >
Loading log files of add-ons stopped working since updating ...
In the supervisor log I come across error log entries like: 2021-06-22 16:44:34 ERROR ... What is version of Home Assistant Core has...
Read more >
2021.6: A little bit of everything - Home Assistant Community
There is no error in Supervisor-log, everything is green. In earlier Home Assistant versions all logs are showing instant.
Read more >
ZBrush 2021.6 Does Not Launch and No Error Message
Win 10 here and get ntdll.dll error which is reported in the event log. Can't start ZB at all:(
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found