The Wayback Machine - http://web.archive.org/web/20201204095556/https://github.com/danobot/entity-controller/issues/212
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

Override Entity ('NoneType' object has no attribute 'state') does not exist. #212

Open
danielbrunt57 opened this issue Oct 30, 2020 · 8 comments

Comments

@danielbrunt57
Copy link
Contributor

@danielbrunt57 danielbrunt57 commented Oct 30, 2020

<<< 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:

  1. Create an entity with multiple overriding entities via overrides:

Expected behavior

This is how the component should work:

  1. No error should be created in HA logs

Actual Behaviour

This is what actually happened:

  1. 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
@danobot
Copy link
Owner

@danobot danobot commented Oct 31, 2020

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.

@danobot danobot added the triage label Oct 31, 2020
@danielbrunt57
Copy link
Contributor Author

@danielbrunt57 danielbrunt57 commented Oct 31, 2020

@danielbrunt57
Copy link
Contributor Author

@danielbrunt57 danielbrunt57 commented Nov 11, 2020

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?

@danobot
Copy link
Owner

@danobot danobot commented Nov 11, 2020

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.

@danielbrunt57
Copy link
Contributor Author

@danielbrunt57 danielbrunt57 commented Nov 12, 2020

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

@danielbrunt57
Copy link
Contributor Author

@danielbrunt57 danielbrunt57 commented Nov 12, 2020

EC is not broken by this... Just like cleaning up errors!

@danobot
Copy link
Owner

@danobot danobot commented Nov 13, 2020

Feel free to clean it up and submit a PR. Happy to merge it, if the error is misleading

@danielbrunt57
Copy link
Contributor Author

@danielbrunt57 danielbrunt57 commented Nov 13, 2020

I will, time permitting and if I can figure it out!

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.