Skip to content
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

Merged
merged 9 commits into from
Sep 6, 2023
Merged

Add Camera functionality #184

merged 9 commits into from
Sep 6, 2023

Conversation

greghesp
Copy link
Owner

@greghesp greghesp commented Sep 5, 2023

Added Camera functionality as per #173

) -> None:
"""Initialize the sensor."""

self._attr_unique_id = f"{config_entry.data['serial']}_camera"
Copy link
Collaborator

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?

Copy link
Collaborator

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':
Copy link
Collaborator

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"
Copy link
Collaborator

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)?

Copy link
Owner Author

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",
Copy link
Collaborator

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.

@greghesp greghesp merged commit bd2570c into develop Sep 6, 2023
4 checks passed
@greghesp greghesp deleted the camera branch September 6, 2023 07:29
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.

None yet

2 participants