diff --git a/3dprinter-octoprint/CHANGELOG.md b/3dprinter-octoprint/CHANGELOG.md index a3b5fd3..9cb16df 100644 --- a/3dprinter-octoprint/CHANGELOG.md +++ b/3dprinter-octoprint/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2024.01.2 + * Add option to pass webcam URL to proxy. + ## 2024.01.1 * Maintenance release: diff --git a/3dprinter-octoprint/DOCS.md b/3dprinter-octoprint/DOCS.md index e4c906a..7325638 100644 --- a/3dprinter-octoprint/DOCS.md +++ b/3dprinter-octoprint/DOCS.md @@ -1,16 +1,20 @@ # Startup -Set a network port in addon settings to be able to access the WebUI. +Set a network port in add-on settings to be able to access the WebUI. -# Addon configuration +# Add-on configuration ## Trusted proxies *If you have placed a reverse proxy in front of Home Assistant*, by setting trusted proxies you should be able to use HTTPS. For more information, see [Caddy documentation](https://caddyserver.com/docs/caddyfile/directives/reverse_proxy). +## Camera URL + +By entering a URL to a camera you can make it available at `/camera/`. Note that this means that anyone with access to your OctoPrint instance can access the stream (even if not signed in! https://community.octoprint.org/t/why-is-there-no-access-control-for-the-webcam-in-octoprint-why-is-my-webcam-always-on/233). **Making this secure is up to you!** + # OctoPrint integration -You can use the OctoPrint integration with this addon. Go to Home Assistant, add integration OctoPrint, and use the following: +You can use the OctoPrint integration with this add-on. Go to Home Assistant, add integration OctoPrint, and use the following: - Host: `cce6f2d5-3dprinter-octoprint` (use the add-on hostname, the first part could differ). - port: 5000 - Don't use SSL (leave unchecked) @@ -19,9 +23,16 @@ Go to OctoPrint WebUI, you should see a request for authentication. # Camera -This addon does not include a camera server, it has to be setup separately. +This add-on does not include a camera server, that has to be installed and setup separately. -You could, for instance, use the addon [camera-mjpg-streamer](https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/camera-mjpg-streamer) available in the same repository. Note that this method **only allows for snapshot**, it does **NOT** work for camera stream as this requires the browser/app used to directly access the stream. +You could, for instance, use the add-on [camera-mjpg-streamer](https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/camera-mjpg-streamer) available in the same repository. This will work for snapshots, but not necessarily for video as the video stream has to be available by the browser/app directly, **not just the host running OctoPrint**. + +Instead of exposing the video stream directly, you could try to use the `Camera URL` option. **Note that this is mostly untested.** In theory you should be able to: +* Install the [camera-mjpg-streamer](https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/camera-mjpg-streamer) add-on. Start it and make sure you can see the image from the camera in that add-on. +* In options for this add-on, set `Camera URL` to hostname of the add-on where the camera is running, e.g. `http://cce6f2d5-camera-mjpg-streamer`. +* In OctoPrint, set: + * `Stream URL` to `http:///camera/?action=stream` + * `Snapshot URL` to `http:///camera/?action=snapshot`. This will make it easier to check that it works, but should later be changed to the local URL, e.g. `http://cce6f2d5-camera-mjpg-streamer/?action=snapshot`. # Remote access diff --git a/3dprinter-octoprint/config.yaml b/3dprinter-octoprint/config.yaml index c968aff..b0d5b3c 100644 --- a/3dprinter-octoprint/config.yaml +++ b/3dprinter-octoprint/config.yaml @@ -1,5 +1,5 @@ name: "3DPrinter-OctoPrint" -version: "2024.01.1" +version: "2024.01.2" slug: "3dprinter-octoprint" description: "OctoPrint as an addon, no additional bells and whistles." arch: @@ -16,29 +16,18 @@ ports_description: devices: - "/dev/i2c-0" - "/dev/i2c-1" -# - "/dev/mem" -# - "/dev/gpiomem" -# privileged: -# - SYS_RAWIO -# apparmor: false gpio: true usb: true uart: true options: trusted_proxies: "" camera_url: "" - # mode: normal schema: trusted_proxies: "str?" - camera_url: "url?" - # mode: "list(normal|recovery|reverse_proxy_test|camera)?" + camera_url: "str?" image: ghcr.io/fredrikbaberg/ha-addon-3dprinter-octoprint-{arch} -# codenotary: tmpfs: true -# ingress: false -# ingress_stream: false panel_icon: mdi:printer-3d panel_title: 3DPrinter-OctoPrint -# stage: stable init: false realtime: true diff --git a/3dprinter-octoprint/rootfs/usr/share/tempio/caddy/Caddyfile.internal_external.gtpl b/3dprinter-octoprint/rootfs/usr/share/tempio/caddy/Caddyfile.internal_external.gtpl index b55e223..5dde701 100644 --- a/3dprinter-octoprint/rootfs/usr/share/tempio/caddy/Caddyfile.internal_external.gtpl +++ b/3dprinter-octoprint/rootfs/usr/share/tempio/caddy/Caddyfile.internal_external.gtpl @@ -5,6 +5,7 @@ {{ if .camera_url }} handle_path /camera* { reverse_proxy {{ .camera_url }} { + trusted_proxies {{ .trusted_proxies }} flush_interval -1 } }