entity-controller
entity-controller copied to clipboard
Override Entity ('NoneType' object has no attribute 'state') does not exist.
<<< Override Entity ('NoneType' object has no attribute 'state') does not exist >>>
Description
The entity for my fireplace light control has three override entities via the overrides: entry.
This seems to create an error in HA logs at startup.
Configuration
front_porch_light_control:
friendly_name: Front Porch Light Control
sensor: binary_sensor.lumi_lumi_sensor_motion_aq2_a2154d04_ias_zone
sensor_type: duration
entity: switch.nzw30_smart_switch_switch
start_time: sunset - 00:10:00
end_time: sunrise + 00:10:00
fireplace_light_control:
friendly_name: Fireplace Light Control
sensor: binary_sensor.lumi_lumi_sensor_motion_aq2_68988604_ias_zone
sensor_type: duration
entity: switch.switchlinc_relay_dual_band_1f_b7_25
start_time: sunset - 00:30:00
end_time: sunrise + 00:30:00
overrides:
- switch.switchlinc_relay_dual_band_1f_b3_c5
- switch.appliance_module_zl7201us_switch
- media_player.living_room_tv
bedroom_lights_control:
friendly_name: Bedroom Lights Control
sensor: binary_sensor.lumi_lumi_sensor_motion_aq2_19bc3f05_ias_zone
sensor_type: duration
state_attributes_ignore:
- color_temp
- brightness
entity: group.bedroom_lights
override:
- input_boolean.bedroom_motion_disabled
state_entities:
- light.bedroom_lamp_1_level_light_color_on_off
- light.bedroom_lamp_2_level_light_color_on_off
start_time: sunset - 00:30:00
end_time: sunrise + 00:30:00
office_lights_control:
friendly_name: Office Lights Control
sensor: binary_sensor.lumi_lumi_sensor_motion_aq2_ias_zone
sensor_type: duration
sensor_resets_timer: True
entity: light.osram_lightify_a19_tunable_white_ef4a0900_level_light_color_on_off
state_attributes_ignore:
- color_temp
- brightness
delay: 240
Steps to reproduce
Steps to reproduce the behavior:
- Create an entity with multiple overriding entities via
overrides:
Expected behavior
This is how the component should work:
- No error should be created in HA logs
Actual Behaviour
This is what actually happened:
- An HA error occurred
Logs
Logger: custom_components.entity_controller.fireplace_light_control
Source: custom_components/entity_controller/__init__.py:703
Integration: Entity Contoller (documentation)
First occurred: 3:55:11 PM (2 occurrences)
Last logged: 3:55:12 PM
Configuration error! Override Entity ('NoneType' object has no attribute 'state') does not exist. Please check for spelling and typos.
Version
v9.1.0
Did you check the spelling of those entities? If they dont have a state at start up that might cause this error to be shown as well.
I copied and pasted the entities into Developer States and each one is correct. Then I tested each one individually in EC by "#" two at a time, rebooting HA and checking logs. No warning when only one is listed. Then tried 1 & 2, 2 & 3 and 1 & 3, restarted HA and each of those combos created the warning. EC does work though and correctly changes to Overriden when any of those overrides are turned on. Strange...
Get BlueMail for Androidhttp://www.bluemail.me/r?b=16117 On Oct. 30, 2020, at 7:36 p.m., Daniel Mason <[email protected]mailto:[email protected]> wrote:
Did you check the spelling of those entities? If they dont have a state at start up that might cause this error to be shown as well.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/danobot/entity-controller/issues/212#issuecomment-719871807, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AL4JU3IKD3NYJZ6U5YTRCODSNNZ4HANCNFSM4TFQIP3Q.
Here is where/when the error is logged:
2020-11-10 15:50:35 INFO (MainThread) [homeassistant.setup] Setup of domain webostv took 2.1 seconds
2020-11-10 15:50:35 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.webostv
2020-11-10 15:50:35 INFO (MainThread) [homeassistant.components.notify] Setting up notify.webostv
2020-11-10 15:50:35 DEBUG (MainThread) [custom_components.entity_controller.fireplace_light_control] override_state_change :: Override state change entity=media_player.living_room_tv, old=None, new=<state media_player.living_room_tv=off; friendly_name=Living Room TV, supported_features=20413, device_class=tv @ 2020-11-10T15:50:35.952115-08:00>
2020-11-10 15:50:35 ERROR (MainThread) [custom_components.entity_controller.fireplace_light_control] Configuration error! Override Entity ('NoneType' object has no attribute 'state') does not exist. Please check for spelling and typos.
It looks like the problem might be the state change from old=None following the set up of the entity by HA? 2020-11-10 15:50:35 DEBUG (MainThread) [custom_components.entity_controller.fireplace_light_control] override_state_change :: Override state change entity=media_player.living_room_tv, old=None, new=<state media_player.living_room_tv=off; friendly_name=Living Room TV, supported_features=20413, device_class=tv @ 2020-11-10T15:50:35.952115-08:00>
Is it possible for entity_controller to wait for the states to become available in HA?
Can you check the revision history if something was accidentally deleted? I'm sure it used to check if old is none at some point.
I reviewed the change log back to inception and the only thing similar is: 3.1.2 (2019-03-03) Check that the block timer handle is not None before accessing attr. (#38) (2b36093) Unfortunately the embedded links to those are not working for me... https://gitlab.danielha.tk/HA/appdaemon-motion-lights/compare/v3.1.1...v3.1.2 https://gitlab.danielha.tk/HA/appdaemon-motion-lights/issues/38 https://gitlab.danielha.tk/HA/appdaemon-motion-lights/commit/2b36093
EC is not broken by this... Just like cleaning up errors!
Feel free to clean it up and submit a PR. Happy to merge it, if the error is misleading
I will, time permitting and if I can figure it out!
'Is it possible for entity_controller to wait for the states to become available in HA?' That is exactly the thing that has been annoying me ever since I started using EC, and which is frustratingly difficult to get around, lacking any restart possibilities ...
That, and the lack of templating ...
Hi Paul, I've hit a roadblock implementing templates and haven't been able to get any help from the community. There is some added complexity involved. Haven't looked at waiting for states to become available. You could add the "unavailable" state to be detected as "off". I think it's called custom state strings in the docs.