Add chuangmi.camera.ipc009 support#516
Add chuangmi.camera.ipc009 support#516rytilahti merged 3 commits intorytilahti:masterfrom impankratov:master
Conversation
rytilahti
left a comment
There was a problem hiding this comment.
Thanks for the PR! This looks good to me, I added a couple of things you could adjust and I will merge this after those are done.
miio/chuangmi_camera.py
Outdated
| @property | ||
| def power(self) -> str: | ||
| """ Camera power """ | ||
| return self.data["power"] |
There was a problem hiding this comment.
Is this returning the state of the device? If yes, maybe check for the wanted value and return boolean instead of str.
Also, the docstring comments begin and end without a whitespace, please add dots to end of sentences, too.
There was a problem hiding this comment.
Thanks for review!
If yes, maybe check for the wanted value and return boolean instead of str.
Got it, will figure how to do it (I think I saw something like that in some other device class) and fix.
If yes, maybe check for the wanted value and return boolean instead of str.
Sure, will fix this as well.
miio/chuangmi_camera.py
Outdated
| @property | ||
| def light(self) -> str: | ||
| """ Camera light status """ | ||
| return self.data["light"] |
There was a problem hiding this comment.
Same as above, if this is boolean, check the value and return a boolean. I will not add more comments on this below, so check the values of those and adjust the types accordingly.
|
|
||
| @property | ||
| def max_client(self) -> int: | ||
| return self.data["max_client"] |
There was a problem hiding this comment.
Do you know what these undocumented functions do?
There was a problem hiding this comment.
Not really, I think max client refers to maximum clients that could connect to camera (via mihome plugin) to stream video simultaneously. However it returns zero, so it's kind of not useful anyway. Should I remove it completely?
There was a problem hiding this comment.
No, let's keep it just for the sake of completeness, who knows if the situation changes with some newer firmwares etc. Simply add comments to those stating that they are unknown/unused at the moment.
miio/chuangmi_camera.py
Outdated
| def __init__(self, data: Dict[str, Any]) -> None: | ||
| """ | ||
| Request: | ||
| ["power", "motion_record", "light", "full_color", "flip", "improve_program", "wdr", "track", "sdcard_status", "watermark", "max_client", "night_mode", "mini_level"] |
There was a problem hiding this comment.
line too long (172 > 100 characters)
|
@rytilahti sorry for such a delay, got the fixes you've requested. However, I left some properties which couldn't be mapped to boolean unchanged. For example: |
|
Looks good to me, thanks! 💯 |
Support for basic commands of Xiaomi Mijia 360 1080p camera.
Commands were tested using miio through command line.
I'm no python developer, so any feedback regarding code organization will be appreciated.