Skip to content

gateway: use main device model for subdevices#1233

Closed
rytilahti wants to merge 1 commit intomasterfrom
gateway/fix/skip_autodetect_on_subdevices
Closed

gateway: use main device model for subdevices#1233
rytilahti wants to merge 1 commit intomasterfrom
gateway/fix/skip_autodetect_on_subdevices

Conversation

@rytilahti
Copy link
Copy Markdown
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
Copy Markdown
Owner Author

@starkillerOG mind testing if this fix works for you?

@starkillerOG
Copy link
Copy Markdown
Contributor

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

@starkillerOG
Copy link
Copy Markdown
Contributor

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

@starkillerOG
Copy link
Copy Markdown
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
Copy Markdown
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