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 · 10 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@danielbrunt57
Copy link
Contributor

<<< 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 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 Unclear if issue is with EC or not label Oct 31, 2020
@danielbrunt57
Copy link
Contributor Author

danielbrunt57 commented Oct 31, 2020 via email

@danielbrunt57
Copy link
Contributor Author

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

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

@danobot
Copy link
Owner

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

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

@danobot danobot added good first issue Good for newcomers help wanted Extra attention is needed and removed triage Unclear if issue is with EC or not labels Nov 15, 2020
@Paul-Vdp
Copy link

'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 ...

@danobot
Copy link
Owner

danobot commented Jul 19, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants