Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working on 2021.05b #110

Closed
joselito11 opened this issue Apr 29, 2021 · 7 comments
Closed

Not working on 2021.05b #110

joselito11 opened this issue Apr 29, 2021 · 7 comments
Labels

Comments

@joselito11
Copy link

Logger: homeassistant.components.switch
Source: custom_components/adaptive_lighting/switch.py:1021
Integration: Stikalo (documentation, issues)
First occurred: 6:50:45 (6 occurrences)
Last logged: 6:56:25

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 364, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 558, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 580, in add_to_platform_finish
await self.async_added_to_hass()
File "/config/custom_components/adaptive_lighting/switch.py", line 604, 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 693, in async_turn_on
await self._update_attrs_and_maybe_adapt_lights(
File "/config/custom_components/adaptive_lighting/switch.py", line 821, in _update_attrs_and_maybe_adapt_lights
self._settings = self._sun_light_settings.get_settings(
File "/config/custom_components/adaptive_lighting/switch.py", line 1110, in get_settings
percent = self.calc_percent()
File "/config/custom_components/adaptive_lighting/switch.py", line 1073, in calc_percent
today = self.relevant_events(now)
File "/config/custom_components/adaptive_lighting/switch.py", line 1061, in relevant_events
events = [
File "/config/custom_components/adaptive_lighting/switch.py", line 1062, in
self.get_sun_events(now + timedelta(days=days)) for days in [-1, 0, 1]
File "/config/custom_components/adaptive_lighting/switch.py", line 1021, in get_sun_events
location.sunrise(date, local=False)
AttributeError: 'tuple' object has no attribute 'sunrise'

@adamrutt
Copy link

Same here, looks to be linked with Update to Astra 2.2

@bouwew
Copy link

bouwew commented Apr 30, 2021

Same here, rolling back to HA Core 2021.4.6

@pixeye33
Copy link

i was looking for a way to fix the issue, but instead found a way to circumvent it :

if a sunrise_time and sunset_time is defined in adaptive_lighting config the error can't happen anymore thanks to this : https://github.com/basnijholt/adaptive-lighting/blob/master/custom_components/adaptive_lighting/switch.py#L1022

i think the root cause is around the elevation

@basnijholt basnijholt changed the title Not workingon 2021.05b Not working on 2021.05b Apr 30, 2021
@basnijholt
Copy link
Owner

I believe (untested) that b5eed58 should fix it.

@basnijholt
Copy link
Owner

I just tested it and it works now!

It just required on other fix (20a37b4).

@pixeye33
Copy link

I confirm that it now works again, thanks for your quick fix !

@basnijholt
Copy link
Owner

I'll close this issue then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants