Skip to content

feat(camera): add a sub-stream camera entity per channel - #42

Merged
equake merged 1 commit into
mainfrom
feat/camera-substream
Nov 6, 2026
Merged

equake merged 1 commit into
mainfrom
feat/camera-substream

Conversation

@equake

@equake equake commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Closes #41

Summary

Answers the user question about using the sub stream for live view: each channel now has a dedicated sub-stream camera entity (disabled by default), following the same one-entity-per-stream pattern as Reolink (Fluent/Clear), UniFi Protect (High/Medium/Low) and ONVIF (one entity per profile).

  • New XMEyeCamera(..., stream=1) per channel. Its unique_id is …_ch{n}_camera_sub, its translation key is camera_sub ("{title} Substream", translated in all 12 locales) and entity_registry_enabled_default=False.
  • The sub entity probes only sub-stream URLs (stream=1.sdp, /live/ch{n}_1, /h264/…/sub/…).
  • Main entity: no changes. It keeps the same unique_id and still falls back to an H.264 sub stream when the main stream is H.265.
  • coordinator.h265_channels / stream_info are now keyed by (channel, stream). The H.265 repairs dedupe channels, and diagnostics list chN / chN_sub.
  • Each entity gets its own go2rtc registration, because the identifier comes from the unique_id.
  • README and AGENTS.md document the new entity.

Test plan

  • ruff check custom_components/
  • python helpers/i18n.py --check
  • On a real DVR: enable camera.<device>_chN_substream. In diagnostics, check chN_sub.stream_idx == 1 and confirm the live view is low resolution.
  • Check that the main entity still uses stream=0 (H.264 main).
  • H.265 channel: check that both entities register separate streams in go2rtc /api/streams, and that disabling one does not drop the other.

🤖 Generated with Claude Code

Each channel now gets a second camera entity bound to the DVR's sub
stream (stream=1.sdp), disabled by default — the one-entity-per-stream
layout Reolink, UniFi Protect and ONVIF use. It starts faster and uses
less bandwidth than the full-resolution main stream.

The main entity keeps its unique_id and its existing fallback to an
H.264 sub stream when the main one is H.265. The sub entity probes only
sub-stream URLs. h265_channels and stream_info are now keyed by
(channel, stream); repairs dedupe channels and diagnostics list
chN / chN_sub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@equake equake left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

boa, claudinho!

@equake
equake merged commit 04c7c34 into main Nov 6, 2026
4 checks passed
@equake
equake deleted the feat/camera-substream branch November 6, 2026 20: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.

Using sub stream instead of main stream for live camera

1 participant