home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.41k stars 30.3k forks source link

Xiaomi Miio Air Humidifier CA1 missing target_humidity #128172

Open mwitkow opened 9 hours ago

mwitkow commented 9 hours ago

The problem

I've had two zhimi.humidifier.ca1 working no problem for a while. After upgrading to 2024.9.1 (from 2024.6.4) and even now in 2024.10.1 there is a target_humidity attribute missing. It prevents the humidifier from actually operating well as you can't set it's target humidity and it humidifies into oblivion.

Logs that may seem to indicate the problem in /usr/local/lib/python3.12/site-packages/miio/miioprotocol.py" added the bug report. Not sure if they are related though.

What version of Home Assistant Core has the issue?

2024.9.01

What was the last working version of Home Assistant Core?

2024.6.4

What type of installation are you running?

Home Assistant Container

Integration causing the issue

xiaomi_miio

Link to integration documentation on our website

https://www.home-assistant.io/integrations/xiaomi_miio

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

I get a bunch of

Oct 11 16:29:07 cerberus docker[1248224]: 2024-10-11 17:29:07.483 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching Smartmi Evaporative Humidifier Movable data
Oct 11 16:29:24 cerberus docker[1248224]: 2024-10-11 17:29:24.341 INFO (MainThread) [homeassistant.components.xiaomi_miio] Fetching Smartmi Evaporative Humidifier Movable data recovered
Oct 11 16:30:48 cerberus docker[1248224]: 2024-10-11 17:30:48.485 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching Smartmi Evaporative Humidifier Movable data
Oct 11 16:31:05 cerberus docker[1248224]: 2024-10-11 17:31:05.329 INFO (MainThread) [homeassistant.components.xiaomi_miio] Fetching Smartmi Evaporative Humidifier Movable data recovered
Oct 11 17:10:18 cerberus docker[1248224]: 2024-10-11 18:10:18.465 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching Smartmi Evaporative Humidifier Bedroom  data
Oct 11 17:10:37 cerberus docker[1248224]: 2024-10-11 18:10:37.246 INFO (MainThread) [homeassistant.components.xiaomi_miio] Fetching Smartmi Evaporative Humidifier Bedroom  data recovered
Sep 19 13:07:03 cerberus docker[2486647]: 2024-09-19 14:07:03.926 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Unexpected error fetching Smartmi Evaporative Humidifier Bedroom  data
Sep 19 13:07:03 cerberus docker[2486647]: Traceback (most recent call last):
Sep 19 13:07:03 cerberus docker[2486647]:   File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh
Sep 19 13:07:03 cerberus docker[2486647]:     self.data = await self._async_update_data()
Sep 19 13:07:03 cerberus docker[2486647]:                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 19 13:07:03 cerberus docker[2486647]:   File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 271, in _async_update_data
Sep 19 13:07:03 cerberus docker[2486647]:     return await self.update_method()
Sep 19 13:07:03 cerberus docker[2486647]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 19 13:07:03 cerberus docker[2486647]:   File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/__init__.py", line 185, in update
Sep 19 13:07:03 cerberus docker[2486647]:     return await _async_fetch_data()
Sep 19 13:07:03 cerberus docker[2486647]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 19 13:07:03 cerberus docker[2486647]:   File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/__init__.py", line 180, in _async_fetch_data
Sep 19 13:07:03 cerberus docker[2486647]:     state = await hass.async_add_executor_job(device.status)
Sep 19 13:07:03 cerberus docker[2486647]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 19 13:07:03 cerberus docker[2486647]:   File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
Sep 19 13:07:03 cerberus docker[2486647]:     result = self.fn(*self.args, **self.kwargs)
Sep 19 13:07:03 cerberus docker[2486647]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 19 13:07:03 cerberus docker[2486647]:   File "/usr/local/lib/python3.12/site-packages/miio/click_common.py", line 184, in _wrap
Sep 19 13:07:03 cerberus docker[2486647]:     return func(self, *args, **kwargs)
Sep 19 13:07:03 cerberus docker[2486647]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 19 13:07:03 cerberus docker[2486647]:   File "/usr/local/lib/python3.12/site-packages/miio/integrations/humidifier/zhimi/airhumidifier.py", line 302, in status
Sep 19 13:07:03 cerberus docker[2486647]:     values = self.get_properties(properties, max_properties=_props_per_request)
Sep 19 13:07:03 cerberus docker[2486647]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 19 13:07:03 cerberus docker[2486647]:   File "/usr/local/lib/python3.12/site-packages/miio/device.py", line 240, in get_properties
Sep 19 13:07:03 cerberus docker[2486647]:     values.extend(self.send(property_getter, _props[:max_properties]))
Sep 19 13:07:03 cerberus docker[2486647]:                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 19 13:07:03 cerberus docker[2486647]:   File "/usr/local/lib/python3.12/site-packages/miio/device.py", line 107, in send
Sep 19 13:07:03 cerberus docker[2486647]:     return self._protocol.send(
Sep 19 13:07:03 cerberus docker[2486647]:            ^^^^^^^^^^^^^^^^^^^^
Sep 19 13:07:03 cerberus docker[2486647]:   File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 202, in send
Sep 19 13:07:03 cerberus docker[2486647]:     self.__id = payload["id"]
Sep 19 13:07:03 cerberus docker[2486647]:                 ~~~~~~~^^^^^^
Sep 19 13:07:03 cerberus docker[2486647]: TypeError: byte indices must be integers or slices, not str

Additional information

No response

home-assistant[bot] commented 9 hours ago

Hey there @rytilahti, @syssi, @starkillerog, mind taking a look at this issue as it has been labeled with an integration (xiaomi_miio) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `xiaomi_miio` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign xiaomi_miio` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


xiaomi_miio documentation xiaomi_miio source (message by IssueLinks)

mwitkow commented 7 hours ago
Screenshot 2024-10-11 at 19 15 23

As you see the entity is missing the target_humidity

BTW, the device correctly returns the value using miiocli (python_miio-0.5.12, same one as pinned in home assistant, but python-3.12 ) :

$ miiocli  airhumidifier --ip IP --token TOKEN status
WARNING:miio.integrations.humidifier.zhimi.airhumidifier:The 'depth' property is deprecated and will be removed in the future. Use 'water_level' and 'water_tank_detached' properties instead.
Power: off
Mode: OperationMode.Silent
Temperature: 22.0 °C
Humidity: 64 %
LED brightness: LedBrightness.Off
Buzzer: False
Child lock: False
Target humidity: 60 %
Trans level: None
Speed: 0
Depth: 59
Water Level: 49 %
Water tank detached: False
Dry: False
Use time: 11003474
Hardware version: 0001
Button pressed: None
mwitkow commented 6 hours ago

Ok.. I think I understand what's going on. No idea where the change happened but:

when Mode = Silent, the humidity_target disappears. when Mode = Auto, the humidity_target appears and is settable.

I'm pretty sure that's a change from before as I was previously able to set the humidity and keep it at silent.