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

gateway: use main device model for subdevices #1233

Closed
wants to merge 1 commit into from

Conversation

rytilahti
Copy link
Owner

This fixes the issue where invoking a method on gateway subdevice causes model discovery,
which fails as the subdevices do not have a host by themselves.

Related to downstream report home-assistant/core#61234 . Replaces #1229

This fixes the issue where invoking a method on gateway subdevice causes model discovery,
which fails as the subdevices do not have a host by themselves.
@rytilahti
Copy link
Owner Author

@starkillerOG mind testing if this fix works for you?

@starkillerOG
Copy link
Contributor

@rytilahti I tested it, but it does not work, still getting:
miio.exceptions.DeviceException: Unable to discover the device None

@starkillerOG
Copy link
Contributor

#1229 did work, but I agree that it is quick and dirty.

@starkillerOG
Copy link
Contributor

However due to these lines:

if parent is None:
raise DeviceException(
"This should never be initialized without gateway object."
)

Click will not work anyway I think.
You first need to initialize the gateway and then the subdevice can be used.
From the command line (click) that is inpossible anyway (as far as I am aware).

However note that I don't understand click very well and do not use it myself, so take my comments with a grain of salt regarding click.

@rytilahti
Copy link
Owner Author

Okay, you are right, the click integration won't work so there's not much reason to hold those in the code base.. So let's go with your solution for the time being! It will still cause the same issue if someone for some reason tries to access the info(), though...

@rytilahti rytilahti closed this Dec 13, 2021
@rytilahti rytilahti deleted the gateway/fix/skip_autodetect_on_subdevices branch October 24, 2022 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants