Skip to content

AttributeError: 'NoneType' object has no attribute 'state' #182

@paulius2k

Description

@paulius2k

When reloading template entities yaml config, I get this error:

Logger: homeassistant
Source: custom_components/irrigationprogram/zone.py:243
integration: Irrigation controller ([documentation](https://github.com/petergridge/irrigation-v5), [issues](https://github.com/petergridge/irrigation-v5/issues))
First occurred: 13:43:53 (1218 occurrences)
Last logged: 20:20:13

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/config/custom_components/irrigationprogram/zone.py", line 499, in calc_next_run
    v_error = await self.handle_validation_error()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/irrigationprogram/zone.py", line 355, in handle_validation_error
    while await self.next_run_validation() == CONST_PAUSED:
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/irrigationprogram/zone.py", line 456, in next_run_validation
    self.rain_sensor == CONST_ON
    ^^^^^^^^^^^^^^^^
  File "/config/custom_components/irrigationprogram/zone.py", line 243, in rain_sensor
    return self.hass.states.get(self._zonedata.rain_sensor).state
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'

Could you help me fix this issue?
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions