Skip to content

AttributeError: 'AirDehumidifier' object has no attribute 'model' #1149

@nielsfaber

Description

@nielsfaber

Describe the bug
Code error.

Related to PR #1146 and syssi/xiaomi_airpurifier#206.
I tried to apply your PR locally to fix the broken integration.

Line 184 refers to self.model, but I guess this should be self._model as defined in Device.py.
Additionally, since the model is considered optional, a fallback is needed (was in the constructor which is removed by your changes).

Could you please take a look at this before releasing your changes?

Console output

  File "/usr/local/lib/python3.9/site-packages/miio/airdehumidifier.py", line 184, in status,
AttributeError: 'AirDehumidifier' object has no attribute 'model',
    self.model, AVAILABLE_PROPERTIES[MODEL_DEHUMIDIFIER_V1],
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run,
    result = self.fn(*self.args, **self.kwargs),
  File "/config/custom_components/xiaomi_miio_airpurifier/climate.py", line 435, in async_update,
    state = await self.hass.async_add_executor_job(self._device.status),
    await task,
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 618, in async_device_update,
    await entity.async_device_update(warning=False),
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity,
Traceback (most recent call last):,
2021-09-28 19:47:36 ERROR (MainThread) [homeassistant.components.climate] xiaomi_miio_airpurifier: Error on device update!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions