Update 3Dprinter-OctoPrint camera documentation; add reverse proxy option.

This commit is contained in:
Fredrik Baberg 2024-01-21 19:25:27 +01:00
parent 66a9805d4c
commit 23b20a0f16
4 changed files with 22 additions and 18 deletions

View File

@ -1,3 +1,6 @@
## 2024.01.2
* Add option to pass webcam URL to proxy.
## 2024.01.1 ## 2024.01.1
* Maintenance release: * Maintenance release:

View File

@ -1,16 +1,20 @@
# Startup # 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 ## 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). *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 `<OctoPrint URL>/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 # 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). - Host: `cce6f2d5-3dprinter-octoprint` (use the add-on hostname, the first part could differ).
- port: 5000 - port: 5000
- Don't use SSL (leave unchecked) - Don't use SSL (leave unchecked)
@ -19,9 +23,16 @@ Go to OctoPrint WebUI, you should see a request for authentication.
# Camera # 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://<octoprint URL>/camera/?action=stream`
* `Snapshot URL` to `http://<octoprint URL>/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 # Remote access

View File

@ -1,5 +1,5 @@
name: "3DPrinter-OctoPrint" name: "3DPrinter-OctoPrint"
version: "2024.01.1" version: "2024.01.2"
slug: "3dprinter-octoprint" slug: "3dprinter-octoprint"
description: "OctoPrint as an addon, no additional bells and whistles." description: "OctoPrint as an addon, no additional bells and whistles."
arch: arch:
@ -16,29 +16,18 @@ ports_description:
devices: devices:
- "/dev/i2c-0" - "/dev/i2c-0"
- "/dev/i2c-1" - "/dev/i2c-1"
# - "/dev/mem"
# - "/dev/gpiomem"
# privileged:
# - SYS_RAWIO
# apparmor: false
gpio: true gpio: true
usb: true usb: true
uart: true uart: true
options: options:
trusted_proxies: "" trusted_proxies: ""
camera_url: "" camera_url: ""
# mode: normal
schema: schema:
trusted_proxies: "str?" trusted_proxies: "str?"
camera_url: "url?" camera_url: "str?"
# mode: "list(normal|recovery|reverse_proxy_test|camera)?"
image: ghcr.io/fredrikbaberg/ha-addon-3dprinter-octoprint-{arch} image: ghcr.io/fredrikbaberg/ha-addon-3dprinter-octoprint-{arch}
# codenotary:
tmpfs: true tmpfs: true
# ingress: false
# ingress_stream: false
panel_icon: mdi:printer-3d panel_icon: mdi:printer-3d
panel_title: 3DPrinter-OctoPrint panel_title: 3DPrinter-OctoPrint
# stage: stable
init: false init: false
realtime: true realtime: true

View File

@ -5,6 +5,7 @@
{{ if .camera_url }} {{ if .camera_url }}
handle_path /camera* { handle_path /camera* {
reverse_proxy {{ .camera_url }} { reverse_proxy {{ .camera_url }} {
trusted_proxies {{ .trusted_proxies }}
flush_interval -1 flush_interval -1
} }
} }