Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xiaomi Miio does not support Xiaomi Air Purifier Compact correctly (added in 2024.8) #123010

Closed
hmmbob opened this issue Aug 1, 2024 · 3 comments · Fixed by #126873
Closed

Xiaomi Miio does not support Xiaomi Air Purifier Compact correctly (added in 2024.8) #123010

hmmbob opened this issue Aug 1, 2024 · 3 comments · Fixed by #126873

Comments

@hmmbob
Copy link
Contributor

hmmbob commented Aug 1, 2024

The problem

2024.8.0b0 supposedly added support for the Xiaomi Air Purifier Compact through #117791, but it does not load correctly on my system and throws a bunch of errors.

The PR adds support for the device identifier xiaomi.airp.cpa4 but the devices reports itself as zhimi.airp.cpa4. Patching this in my running container does not make a difference.

What version of Home Assistant Core has the issue?

core-2024.8.0b0

What was the last working version of Home Assistant Core?

No response

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?

2024-08-01 11:07:30.646 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Unsupported device found! Please create an issue at https://github.com/syssi/xiaomi_airpurifier/issues and provide the following data: zhimi.airp.cpa4
2024-08-01 11:07:30.688 ERROR (MainThread) [homeassistant.components.fan] Error while setting up xiaomi_miio platform for fan
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
await asyncio.shield(awaitable)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/fan.py", line 215, in async_setup_entry
coordinator = hass.data[DOMAIN][config_entry.entry_id][KEY_COORDINATOR]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '01J46K3GPN5X0ZN09SFQ774H75'
2024-08-01 11:07:30.690 ERROR (MainThread) [homeassistant.components.number] Error while setting up xiaomi_miio platform for number
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
await asyncio.shield(awaitable)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/number.py", line 294, in async_setup_entry
device = hass.data[DOMAIN][config_entry.entry_id][KEY_DEVICE]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '01J46K3GPN5X0ZN09SFQ774H75'
2024-08-01 11:07:30.693 ERROR (MainThread) [homeassistant.components.select] Error while setting up xiaomi_miio platform for select
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
await asyncio.shield(awaitable)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/select.py", line 223, in async_setup_entry
device = hass.data[DOMAIN][config_entry.entry_id][KEY_DEVICE]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '01J46K3GPN5X0ZN09SFQ774H75'
2024-08-01 11:07:30.695 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up xiaomi_miio platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
await asyncio.shield(awaitable)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/sensor.py", line 820, in async_setup_entry
device = hass.data[DOMAIN][config_entry.entry_id][KEY_DEVICE]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '01J46K3GPN5X0ZN09SFQ774H75'
2024-08-01 11:07:30.698 ERROR (MainThread) [homeassistant.components.switch] Error while setting up xiaomi_miio platform for switch
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
await asyncio.shield(awaitable)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/switch.py", line 346, in async_setup_entry
await async_setup_coordinated_entry(hass, config_entry, async_add_entities)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/switch.py", line 355, in async_setup_coordinated_entry
device = hass.data[DOMAIN][config_entry.entry_id][KEY_DEVICE]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '01J46K3GPN5X0ZN09SFQ774H75'

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Aug 1, 2024

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)

@mib1185 mib1185 added this to the 2024.8.0 milestone Aug 1, 2024
@hmmbob
Copy link
Contributor Author

hmmbob commented Aug 9, 2024

FWIW: Same error on 2024.8 release, but with different key:

2024-08-09 11:13:55.395 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Unsupported device found! Please create an issue at https://github.com/syssi/xiaomi_airpurifier/issues and provide the following data: zhimi.airp.cpa4
2024-08-09 11:14:03.432 ERROR (MainThread) [homeassistant.components.fan] Error while setting up xiaomi_miio platform for fan
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
await asyncio.shield(awaitable)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/fan.py", line 215, in async_setup_entry
coordinator = hass.data[DOMAIN][config_entry.entry_id][KEY_COORDINATOR]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '01J46M650QAJYX0HC4ENN81RW2'
2024-08-09 11:14:03.438 ERROR (MainThread) [homeassistant.components.number] Error while setting up xiaomi_miio platform for number
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
await asyncio.shield(awaitable)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/number.py", line 294, in async_setup_entry
device = hass.data[DOMAIN][config_entry.entry_id][KEY_DEVICE]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '01J46M650QAJYX0HC4ENN81RW2'
2024-08-09 11:14:03.442 ERROR (MainThread) [homeassistant.components.select] Error while setting up xiaomi_miio platform for select
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
await asyncio.shield(awaitable)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/select.py", line 223, in async_setup_entry
device = hass.data[DOMAIN][config_entry.entry_id][KEY_DEVICE]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '01J46M650QAJYX0HC4ENN81RW2'
2024-08-09 11:14:03.445 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up xiaomi_miio platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
await asyncio.shield(awaitable)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/sensor.py", line 820, in async_setup_entry
device = hass.data[DOMAIN][config_entry.entry_id][KEY_DEVICE]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '01J46M650QAJYX0HC4ENN81RW2'
2024-08-09 11:14:03.465 ERROR (MainThread) [homeassistant.components.switch] Error while setting up xiaomi_miio platform for switch
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
await asyncio.shield(awaitable)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/switch.py", line 346, in async_setup_entry
await async_setup_coordinated_entry(hass, config_entry, async_add_entities)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/switch.py", line 355, in async_setup_coordinated_entry
device = hass.data[DOMAIN][config_entry.entry_id][KEY_DEVICE]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '01J46M650QAJYX0HC4ENN81RW2'

Again, this is with patching the running container to use zhimi.airp.cpa4 here

https://github.com/home-assistant/core/blob/dev/homeassistant/components/xiaomi_miio/const.py#L64

Without that, nothing even happens besides the first error:

2024-08-09 11:13:55.395 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Unsupported device found! Please create an issue at https://github.com/syssi/xiaomi_airpurifier/issues and provide the following data: zhimi.airp.cpa4

/cc @tanchu who added support for this model in #117791

edit:

In core.config_entries, I can find that key:

     {
       "created_at": "2024-08-01T09:26:25.559694+00:00",
       "data": {
         "config_flow_device": "device",
         "host": "192.168.1.27",
         "token": "331a3ec6<snip redacted>91b",
         "model": "zhimi.airp.cpa4",
         "mac": "dc:ed:83:47:3b:ce",
         "cloud_username": "<snip redacted>",
         "cloud_password": "<snip redacted>",
         "cloud_country": "de"
       },
       "disabled_by": null,
       "domain": "xiaomi_miio",
       "entry_id": "01J46M650QAJYX0HC4ENN81RW2",
       "minor_version": 1,
       "modified_at": "2024-08-01T09:26:25.559733+00:00",
       "options": {},
       "pref_disable_new_entities": false,
       "pref_disable_polling": false,
       "source": "user",
       "title": "Xiaomi Smart Air Purifier 4 Compact",
       "unique_id": "dc:ed:83:47:3b:ce",
       "version": 1
     }

in the core.device_registry and core.entity_registry, nothing is found witch either 01J46M650QAJYX0HC4ENN81RW2 or miio

@hmmbob
Copy link
Contributor Author

hmmbob commented Aug 23, 2024

I'm still puzzled on how this made it into core, if the PR was incorrect (wrong model) and simply not working.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants