Skip to content

Add P3 live camera streaming - #14

Draft
shaunbarrow wants to merge 10 commits into
thecodingdad:mainfrom
shaunbarrow:agent/p3-live-camera-stream
Draft

Add P3 live camera streaming#14
shaunbarrow wants to merge 10 commits into
thecodingdad:mainfrom
shaunbarrow:agent/p3-live-camera-stream

Conversation

@shaunbarrow

Copy link
Copy Markdown

Summary

  • add hardware-verified P3 live camera transport over the WS-V2 media_stream channel
  • map Home Assistant's P3 overview / closeup cameras to xTool Studio's far / upside live names
  • bridge Annex-B H.264 through a localhost-only TCP source into Home Assistant's native Stream integration
  • retain the existing snapshot-polled MJPEG fallback for models whose live transport has not been verified
  • document the observed protocol and update the camera capability table

This follows the still-image repair documented in #10. It does not change job control or laser operation.

Root cause

The integration only exposed snapshot polling. Its protocol notes also assumed the media_stream channel required WebRTC signaling. Current xTool Studio code and live P3 traffic show a simpler direct path: Studio opens a same-session media_stream WebSocket, starts /v1/platform/camera/live, and receives protocol-34 frames containing a one-byte stream id followed by Annex-B H.264.

Safety and scope

  • Live support is explicitly allowlisted for P3 only.
  • The decoder source listens on 127.0.0.1 with an ephemeral port; it is not exposed to the LAN.
  • Start/stop requests are paired in try/finally cleanup.
  • Existing still images and fallback behavior remain unchanged for other models.

Validation

  • git diff --check
  • Python 3.12 compileall over custom_components/xtool
  • JSON parse validation for manifest.json
  • live P3 hardware probe: start and stop returned success; protocol-34 H.264 decoded as High profile, 1280x720, approximately 10 delivered packets/frames per second
  • captured Annex-B stream decoded to a valid first frame with ffmpeg

HACS and hassfest validation will run in this repository's GitHub Actions workflow.

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.

1 participant