Skip to content
New issue

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

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

Already on GitHub? # to your account

Move hardcoded parameter max_properties #981

Merged
merged 3 commits into from
Mar 24, 2021
Merged

Conversation

ha0y
Copy link
Contributor

@ha0y ha0y commented Mar 21, 2021

Not all devices limit max_properties to 15. We could make this parameter customizable.

Copy link
Owner

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd personally rather like to see this as a class variable like the mapping itself, considering there should be no reason to change the value on the fly for subsequent requests on the same instance.

@ha0y
Copy link
Contributor Author

ha0y commented Mar 22, 2021

Yes. This is a temporary workaround.

I used to use this method to determine whether the device is miot or miio. Both of them has miot-spec, but only miot devices works with it in LAN. I have thought a return code -9999 indicates that they are not miot, but recently found that some devices limit max_properties to a lower value and also returns -9999 when exceeded.

ha0y and others added 2 commits March 24, 2021 10:33
Co-authored-by: Teemu R. <tpr@iki.fi>
1. Fix `MIoT` capitalization according to https://iot.mi.com/new/doc/design/spec/overall
2. Update `Home Assistant support` according to rytilahti#982 (comment)
Copy link
Owner

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for the PR! 👍

@rytilahti rytilahti merged commit aa6d1eb into rytilahti:master Mar 24, 2021
@rytilahti rytilahti mentioned this pull request Mar 24, 2021
xvlady pushed a commit to xvlady/python-miio that referenced this pull request May 9, 2021
* Move hardcoded parameter `max_properties`

* Update miio/miot_device.py

Co-authored-by: Teemu R. <tpr@iki.fi>

* Update README.rst

1. Fix `MIoT` capitalization according to https://iot.mi.com/new/doc/design/spec/overall
2. Update `Home Assistant support` according to rytilahti#982 (comment)

Co-authored-by: Teemu R. <tpr@iki.fi>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants