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

Error Message on Startup 2023.10.3 #238

Open
enkama opened this issue Oct 17, 2023 · 1 comment
Open

Error Message on Startup 2023.10.3 #238

enkama opened this issue Oct 17, 2023 · 1 comment

Comments

@enkama
Copy link

enkama commented Oct 17, 2023

Hey!

I am getting this error message on every startup 6 times in my log. What could it be about and can I fix it myself?

home-assistant:2023.10.3
circadian-lightning:2.1.4

2023-10-17 09:49:46.339 ERROR (MainThread) [homeassistant.components.switch] Error adding entities for domain switch with platform circadian_lighting
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1057, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 823, in _async_generate_attributes
    attr.update(self.extra_state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/circadian_lighting/switch.py", line 268, in extra_state_attributes
    return {"hs_color": self._hs_color, "brightness": self._brightness, "colortemp": self._color_temperature()}
                                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/circadian_lighting/switch.py", line 290, in _color_temperature
    if not self._is_sleep()
           ^^^^^^^^^^^^^^^^
  File "/config/custom_components/circadian_lighting/switch.py", line 284, in _is_sleep
    and self.hass.states.get(self._sleep_entity).state in self._sleep_state
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
@claytonjn
Copy link
Owner

My guess is that you have a sleep entity configured and that entity is not available at the time Circadian Lighting tries to start. Off the top of my head I think the best long-term solution would be to have Circadian Lighting create a switch entity that controls sleep mode and then rely on the user to create an automation for controlling that entity. I'm also considering abandoning the integration approach altogether and migrating Circadian Lighting to a blueprint, which I think better aligns with core Home Assistant team vision.

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

No branches or pull requests

2 participants