SmartIR: AttributeError: 'NoneType' object has no attribute 'state'

Home Assistant version 2021.2.1

SmartIR version 1.16.0

SmartIR configuration



smartir:

climate:
  - platform: smartir
    name: guestroom AC
    unique_id: guestroom_ac
    device_code: 1181
    controller_data: remote.rm4_pro_remote
    temperature_sensor: sensor.a4c138139232_temperature
    humidity_sensor: sensor.a4c138139232_humidity
    power_sensor: binary_sensor.0x158d000542b4fa_contact
  - platform: smartir
    name: bedroom AC
    unique_id: bedroom_ac
    device_code: 1181
    controller_data: remote.rm_mini_remote
    temperature_sensor: sensor.a4c138139232_temperature
    humidity_sensor: sensor.a4c138139232_humidity
    power_sensor: binary_sensor.0x158d000544b576_contact


Describe the bug

I see error in log my server.

Debug log


Logger: homeassistant
Source: custom_components/smartir/climate.py:404
First occurred: 15:07:14 (2 occurrences)
Last logged: 15:07:14

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/smartir/climate.py", line 404, in _async_power_sensor_changed
    if new_state.state == old_state.state:
AttributeError: 'NoneType' object has no attribute 'state'

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (5 by maintainers)

Commits related to this issue

Most upvoted comments

This is not fixed. I see error after starting.

Replace line 404 in climate.py from if new_state.state == old_state.state: to if old_state is not None and new_state.state == old_state.state: