Closed hidra000 closed 1 year ago
My guess is that your sleep_entity input_boolean.cl_nacht_modus
is not defined. Can you check you entities in HASS and be sure that it exists?
My guess is that your sleep_entity
input_boolean.cl_nacht_modus
is not defined. Can you check you entities in HASS and be sure that it exists?
Just checked the entity. input_boolean.cl_nacht_modus is present. Also all the other entities are present.
I used CL for over a year without issues.
It doesn't seem like the hass.states.get() API has changed: https://dev-docs.home-assistant.io/en/dev/api/core.html#homeassistant.core.StateMachine.get
The call returns None if the entity_id is not found. Have you tried logging the self._sleep_entity
just before line 285 in switch.py
?
Okey i fixed my issue. I had moved 1 group of lights from z2m to an HA group. Therefore 1 entity id whas changed that i was using in an CA group. Not the one in the example above i use multiple CL switches. So i changed the entity for the licht in the CL Switch and now everything is working again. Thanks for the support.
With this release or before the circadian switches are not working anymore.
Looks like AttributeError: 'NoneType' object has no attribute 'state' is the main reasen it dont work.
Logger: homeassistant.components.switch Source: custom_components/circadian_lighting/switch.py:285 Integration: Schakelaar (documentation, issues) First occurred: 12:58:52 (10 occurrences) Last logged: 12:58:52
Logging:
Error adding entities for domain switch with platform circadian_lighting Error while setting up circadian_lighting platform for switch Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 673, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 776, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 573, in _async_write_ha_state attr.update(self.extra_state_attributes or {}) File "/config/custom_components/circadian_lighting/switch.py", line 269, 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 291, in _color_temperature if not self._is_sleep() File "/config/custom_components/circadian_lighting/switch.py", line 285, in _is_sleep and self.hass.states.get(self._sleep_entity).state in self._sleep_state AttributeError: 'NoneType' object has no attribute 'state'
Here the config for one of my circadian_lighting switch
platform: circadian_lighting name: CL Schuur lights_ct: