Skip to content

Issue with missing entity after Xiaomi MIoT Auto integration update #2452

@Conrdelis

Description

@Conrdelis

After today's update of the xiaomi_miot_auto integration, I encountered an issue with a missing entity that previously allowed me to turn the Xiaomi Air Purifier Compact 4 (identified in Home Assistant as xiaomi.airp.cpa4) on and off.

Details:
Device: Xiaomi Air Purifier Compact 4

Integration version: xiaomi_miot_auto (update performed today)

Problem:

After the update, I can no longer find the entity responsible for turning the device on and off.

Despite receiving a message that the entity is unavailable, the device still responds to actions such as turning on or off when clicked in the UI.

Logs:
Here is a log excerpt showing the error related to the device after the update:

`

Logger: custom_components.xiaomi_miot.core.device.xiaomi.airp.cpa4
Source: helpers/update_coordinator.py:380
Integration: Xiaomi Miot Auto (documentation, Issues)
First event: 19:05:35 (1150 events)
Last logged: 22:36:22

Unexpected error fetching 64:9e:31:05:7e:95-01JMT4VM60ESB8KXA0TR5NJ841-chunk_1 data
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 380, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 281, in _async_update_data
return await self.update_method()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/xiaomi_miot/core/device.py", line 536, in _update
result = await self.update_miot_status(mapping, chunk_services=chunk_services)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/xiaomi_miot/core/device.py", line 947, in update_miot_status
self.dispatch(self.decode(results))
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/xiaomi_miot/core/device.py", line 649, in dispatch
handler(data, only_info=only_info)
~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/xiaomi_miot/core/hass_entity.py", line 182, in on_device_update
self._async_write_ha_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1148, in _async_write_ha_state
self.__async_calculate_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1087, in __async_calculate_state
if state_attributes := self.state_attributes:
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/fan/init.py", line 403, in state_attributes
data[ATTR_PERCENTAGE_STEP] = self.percentage_step
^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/fan/init.py", line 360, in percentage_step
return 100 / self.speed_count
~~~~^~~~~~~~~~~~~~~~~~
ZeroDivisionError: division by zero

`
My questions:
Is there any configuration change required after the update to restore the entity?

Is there a way to regain full control over turning the device on/off, possibly by manually restoring the entity?

Request:
I would appreciate any assistance in resolving this issue or any guidance on how to work around it.

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions