core icon indicating copy to clipboard operation
core copied to clipboard

xiaomi_miio integration limits support for no obvious reason

Open dogmatic69 opened this issue 5 months ago • 2 comments

The problem

I have 2 xiaomi vacuums and one has to use a custom integration because the core integration does not support it. The funny thing is the custom integration uses the same underlying python libs for the vacuum

From what i can tell, HA only imports some devices (vs available) from one of the available integrations

Perhaps this is just historic reasons?

I wrote a little test script using the miio lib directly showing it is perfectly capable of working. Also obvious by the fact that the custom integration using the same lib for support.

# SUPPORTED in HA core
dev = Device("x.x.x.18", token_18)
print(dev)
# <Device: x.x.x.18 (token: ...)>
print(dev.info())
# rockrobo.vacuum.v1 v3.5.8_004028 (xx:xx:xx...) @ x.x.x.18 - token: ...

# Requires custom integration
dev = Device("x.x.x.17", token_17)
print(dev)
# <Device: x.x.x.17 (token: ...)>
print(dev.info())
# viomi.vacuum.v8 v3.5.3_0017 (yy:yy:yy....) @ x.x.x.17 - token: ...

What version of Home Assistant Core has the issue?

core-2024.1.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

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?

No response

Additional information

No response

dogmatic69 avatar Jan 15 '24 20:01 dogmatic69

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)

home-assistant[bot] avatar Jan 15 '24 20:01 home-assistant[bot]

@dogmatic69 you could add your vacuüm model to the list of supported devices. If you throughly test it and see that everything works, you can make a PR to apply the changes (adding the model) that are needed. You can tag me in the PR and I will do a review.

However if changes are needed in the upstream xiaomi_miio library, things become difficult since there has not been a version release of that library in a long time.

starkillerOG avatar Jan 15 '24 20:01 starkillerOG

Looking at the integration, it will probably need a rewrite. The new ways of using the miio lib don't require any knowledge of the model and everything in HA is hard coded to the specific models.

I'm now looking into this which seems like the better direction in general for xiaomi products. As it uses the offical protocol it will automatically support new devices and most devices out the box

dogmatic69 avatar Jan 16 '24 08:01 dogmatic69

Yeah, it definitely requires a rewrite that I have been working on, but I haven't found time nor motivation to finish it. The backend library already supports the newer, miot spec devices out-of-the-box. I hope I'll manage to create a dev release & publish the current state of the rewrite as a custom component this spring.

rytilahti avatar Jan 16 '24 19:01 rytilahti

Why not put that effort into https://github.com/al-one/hass-xiaomi-miot which already seems quite mature.

dogmatic69 avatar Jan 16 '24 21:01 dogmatic69