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

FutureWarning: functools.partial will be a method descriptor in future Python versions; (MIIO) #132902

Open
jonwaland opened this issue Dec 11, 2024 · 22 comments
Assignees
Labels
integration: xiaomi_miio waiting-for-upstream We're waiting for a change upstream

Comments

@jonwaland
Copy link

jonwaland commented Dec 11, 2024

The problem

2024-12-11 18:05:34.501 WARNING (ImportExecutor_0) [py.warnings] /srv/homeassistant/lib/python3.13/site-packages/miio/miot_device.py:23: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in enum.member() if you want to preserve the old behavior
  Bool = partial(_str2bool)

What version of Home Assistant Core has the issue?

core-2024.12.3

What was the last working version of Home Assistant Core?

core-2024.11.3

What type of installation are you running?

Home Assistant Core

Integration causing the issue

xiaomi_miio

Link to integration documentation on our website

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

Diagnostics information

config_entry-xiaomi_miio-f27bed13443433d5a9f222756176190d.json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-12-11 18:05:34.501 WARNING (ImportExecutor_0) [py.warnings] /srv/homeassistant/lib/python3.13/site-packages/miio/miot_device.py:23: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in enum.member() if you want to preserve the old behavior
  Bool = partial(_str2bool)

Additional information

No response

@home-assistant
Copy link

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)

@rytilahti rytilahti added the waiting-for-upstream We're waiting for a change upstream label Dec 12, 2024
@rytilahti
Copy link
Member

py3.13 started to print out this warning, this needs to be fixed in upstream but I'm not sure what's the best approach, when a new release will get done, etc. If anyone has an idea, feel free to open a PR: https://github.com/rytilahti/python-miio/

@garry0garry
Copy link

Home Assistant v2025.1.0.

Logger: py.warnings
Source: components/xiaomi_miio/init.py:12
First occurred: 10:14:44 PM (1 occurrences)
Last logged: 10:14:44 PM

/usr/local/lib/python3.13/site-packages/miio/miot_device.py:23: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in enum.member() if you want to preserve the old behavior Bool = partial(_str2bool)

@rytilahti
Copy link
Member

Yes, that's the same message as in the original post. Upstream PR has already been merged, so this pends only on a new python-miio release. Ref. rytilahti/python-miio#1993

@olympia
Copy link

olympia commented Jan 7, 2025

I understood these messages should disappear with v2025.1.1, however I am a still seeing this after updating. Did I misunderstood and some other component needs to be updated as well?

@garry0garry
Copy link

I understood these messages should disappear with v2025.1.1, however I am a still seeing this after updating. Did I misunderstood and some other component needs to be updated as well?

miio or miot ?
Home Assistant v2025.1.1

This error originated from a custom integration.

Logger: py.warnings
Source: custom_components/xiaomi_miot/core/converters.py:4
integration: Xiaomi Miot Auto (documentation, issues)
First occurred: 12:52:55 PM (1 occurrences)
Last logged: 12:52:55 PM

/usr/local/lib/python3.13/site-packages/miio/miot_device.py:23: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in enum.member() if you want to preserve the old behavior Bool = partial(_str2bool)

@olympia
Copy link

olympia commented Jan 7, 2025

It's miio on my side and the logger doesn't report it as custom:

Logger: py.warnings
Source: components/xiaomi_miio/__init__.py:12
First occurred: 09:40:12 (1 occurrences)
Last logged: 09:40:12

/usr/local/lib/python3.13/site-packages/miio/miot_device.py:23: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in enum.member() if you want to preserve the old behavior Bool = partial(_str2bool)

@TheZoker
Copy link
Contributor

TheZoker commented Jan 7, 2025

As far as I understand the fix has been done in the upstream project, but there is no new release of python-miio and the dependency has not been updated in HA

@syssi
Copy link
Member

syssi commented Jan 7, 2025

Exactly. A python-miio release is required.

@hoppel118
Copy link

Same here.

2025-01-13 17:32:04.910 WARNING (ImportExecutor_0) [py.warnings] /usr/local/lib/python3.13/site-packages/miio/miot_device.py:23: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in enum.member() if you want to preserve the old behavior
  Bool = partial(_str2bool)

So, I am waiting for the python-miio release.

Thanks

@TheZoker
Copy link
Contributor

@rytilahti Would it make sense to release a minor version to fix this soon?

@rytilahti
Copy link
Member

@TheZoker First of all, thanks for the ping!

Given the current fix requires a version bump anyway, I might very well just make a new release to avoid branching for a minor release as having multiple branches to maintain doesn't really help with the maintenance of a barely-maintained project.

I am not able to contribute much time for this at the moment, but I can offer to do a new dev release containing the already merged fix, hoping that someone will help me to take a look into getting necessary changes into the integration to avoid breaking changes.

There should not be that many breaking changes, but bumping this dependency will still require someone to test it as I don't want to break existing installations for just suppressing this warning caused by a python update.

So, if some willing developer with access to devices supported by this integration wants to contribute and get this done, I'm happy to be around to make it happen. The first step would to to see if upgrading to python-miio=0.6.0.dev0 (or to the master branch of the repository) works.

@thecode
Copy link
Member

thecode commented Jan 21, 2025

@rytilahti just bumped into this issue, I only have a Xiaomi Aqara Gateway but I will test bumping to 0.6.0.dev0 and report. Fill free to ping me to review PRs if needed.

@rytilahti
Copy link
Member

@thecode thanks! There are likely some breaking changes (or at least ones that will cause deprecation warnings), the problem being that there's no proper test coverage given how old the integration code base is.

When you do give it a test, let me know if something breaks and we'll figure out a solution for that. There has been some changes since the dev0, so you may want to give the master also a try. I will try to do my best to have some time to get a dev1 out come the weekend, so if you spot something before that, let me know!

@thecode
Copy link
Member

thecode commented Jan 23, 2025

@thecode thanks! There are likely some breaking changes (or at least ones that will cause deprecation warnings), the problem being that there's no proper test coverage given how old the integration code base is.

When you do give it a test, let me know if something breaks and we'll figure out a solution for that. There has been some changes since the dev0, so you may want to give the master also a try. I will try to do my best to have some time to get a dev1 out come the weekend, so if you spot something before that, let me know!

This error happens running on the master branch

ImportError: cannot import name 'CleaningDetails' from 'miio' (/home/vscode/.local/ha-venv/lib/python3.13/site-packages/miio/__init__.py)

It will happens on tests also. I think the first step would be to make a release than start to work on adjusting the breaking changes, hopefully they are listed on the release notes.

@mkz212
Copy link

mkz212 commented Jan 24, 2025

Same here.

Rejestrator: py.warnings
Źródło: components/xiaomi_miio/__init__.py:12
Pierwsze zdarzenie: 10:44:11 (1 zdarzenia)
Ostatnio zalogowany: 10:44:11

/usr/local/lib/python3.13/site-packages/miio/miot_device.py:23: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in enum.member() if you want to preserve the old behavior Bool = partial(_str2bool)

@mkz212
Copy link

mkz212 commented Jan 24, 2025

It is strange for me that this error appears in my logs but I don't even have this Integration installed. Why?

@thecode
Copy link
Member

thecode commented Jan 24, 2025

Please don't spam the issue with "Same here", the owner is aware of it and working to fix it. It is enough to put 👍 on the first post

@poiuytrewq0987654321
Copy link

the problem is that this error appears also for me when i dont have installed xiaomi-miot custom component ( i had but uninstalled it and clean all i was able to). so why i still recevied this error?

@MikeBP13
Copy link

MikeBP13 commented Feb 1, 2025

Any updates on this topic? Thanks.

@Innominatapersona
Copy link

Innominatapersona commented Feb 7, 2025

It is strange for me that this error appears in my logs but I don't even have this Integration installed. Why?

the problem is that this error appears also for me when i dont have installed xiaomi-miot custom component ( i had but uninstalled it and clean all i was able to). so why i still recevied this error?

I'm in the same situation, so I wanted to report what I tried to do, without success of course, but maybe someone could find theese informations useful for a better understanding.

I once had a xiaomi robot installed, but turned to Valetudo, which should not use anything from the older integration, which I removed.
I also had custom cards and camera entities, but I guess I removed every resource and reference about them too.

So,
I entered the homeassistant root dir and carefully removed some system integration that I didn't need with no problem at all.
But when I removed xiaomi directories, I got errors in core logs about them missing.

So,
I searched for eventual core.config_entries, core.device_registry lines about miio and xiaomi, but nothing changed.

So,
as I red somewhere,
I tried purging recorder and deleting database lines that contained "miio" and "xiaomi" references, but got more errors.
I'd really rather not to replicate that, so please don't ask for logs about this.

In my very ignorant opinion, there's still something somewhere that tries to activate the integration and I'd like to know if and where this starter is.

Thank you all

@SCUZNUTS
Copy link

Ditto to @Innominatapersona, had xiaomi robot, moved it to Valetudo/mqtt. But HA still has some kind of cling to miio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration: xiaomi_miio waiting-for-upstream We're waiting for a change upstream
Projects
None yet
Development

No branches or pull requests