Camera improvements (#94)
* Add option to set camera url * Update proxy configuration for camera * Update 3Dprinter-OctoPrint camera documentation; add reverse proxy option.
This commit is contained in:
parent
7c95db9ba2
commit
0f5cdd3f5e
@ -1,3 +1,6 @@
|
||||
## 2024.01.2
|
||||
* Add option to pass webcam URL to proxy.
|
||||
|
||||
## 2024.01.1
|
||||
|
||||
* Maintenance release:
|
||||
|
||||
@ -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 `<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
|
||||
|
||||
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://<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
|
||||
|
||||
|
||||
@ -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: "http://b7aa59c4-camera-mjpg-streamer"
|
||||
# mode: normal
|
||||
camera_url: ""
|
||||
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
|
||||
|
||||
@ -9,6 +9,7 @@ bashio::var.json \
|
||||
addon_hostname "$(bashio::addon.hostname)" \
|
||||
addon_ip "$(bashio::addon.ip_address)" \
|
||||
trusted_proxies "$(bashio::config 'trusted_proxies')" \
|
||||
camera_url "$(bashio::config 'camera_url')" \
|
||||
| tempio \
|
||||
-template /usr/share/tempio/caddy/Caddyfile.internal_external.gtpl \
|
||||
-out /etc/caddy/sites-enabled/internal_external.caddy
|
||||
|
||||
@ -2,6 +2,14 @@
|
||||
# * Home-Assistant OctoPrint integration.
|
||||
# * Accessing OctoPrint WebUI through external port.
|
||||
:5000 {
|
||||
{{ if .camera_url }}
|
||||
handle_path /camera* {
|
||||
reverse_proxy {{ .camera_url }} {
|
||||
trusted_proxies {{ .trusted_proxies }}
|
||||
flush_interval -1
|
||||
}
|
||||
}
|
||||
{{ end }}
|
||||
reverse_proxy http://127.0.0.1:80 {
|
||||
trusted_proxies {{ .trusted_proxies }}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user