-
Notifications
You must be signed in to change notification settings - Fork 57
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 Camera functionality #184
Conversation
) -> None: | ||
"""Initialize the sensor.""" | ||
|
||
self._attr_unique_id = f"{config_entry.data['serial']}_camera" |
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.
For consistency with other devices should we prepend this with the model name?
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.
Never mind we're already inconsistent and this is unique ID so the model number is irrelevant. Good to go on this.
@@ -285,13 +320,15 @@ def print_update(self, data): | |||
self.remaining_time = data.get("mc_remaining_time", self.remaining_time) | |||
if data.get("gcode_start_time") is not None: | |||
self.start_time = start_time(int(data.get("gcode_start_time"))) | |||
# TODO: Check this logic actually works | |||
if self.gcode_state is not 'Running': |
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.
We might have some case inconsistency issues lurking here for this variable. I see for the localization changes this is expected to be lower case (maybe, not sure it does a case sensitive match) bit the actual mqtt content is all upper case. And we don't lower case it when we parse/save the string.
}, | ||
"camera": { | ||
"camera": { | ||
"name": "Camera" |
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.
If we don't add this to the fr-fr file, does it just use the English one instead? I.e. Do we have to add something to all the non-English json files or can localization come later (from native speakers)?
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.
Yep I believe it always falls back to en
# "ipcam_record": "enable", | ||
# "mode_bits": 2, | ||
# "resolution": "1080p", | ||
# "rtsp_url": "rtsps://192.168.1.64/streaming/live/1", |
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 something to worry about for this PR but we might be able to populate the camera availability based on whether this exists in the mqtt payload instead of gating it on the model. But probably more work than benefit.
Added Camera functionality as per #173