-
-
Notifications
You must be signed in to change notification settings - Fork 563
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
Add chuangmi.camera.ipc009 support #516
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know what these undocumented functions do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.