Compare commits

...

No commits in common. "klipper" and "main" have entirely different histories.

79 changed files with 1531 additions and 170 deletions

View File

@ -0,0 +1,36 @@
{
"name": "Example devcontainer for add-on repositories",
"image": "ghcr.io/home-assistant/devcontainer:addons",
"appPort": [
"7123:8123",
"7357:4357"
],
"postStartCommand": "bash devcontainer_bootstrap",
"runArgs": [
"-e",
"GIT_EDITOR=code --wait",
"--privileged"
],
"containerEnv": {
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
},
"extensions": [
"timonwong.shellcheck",
"esbenp.prettier-vscode"
],
"mounts": [
"type=volume,target=/var/lib/docker"
],
"settings": {
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
}
}

74
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@ -0,0 +1,74 @@
---
# yamllint disable rule:line-length
name: Bug Report Form
description: Report an issue with an add-on.
body:
- type: markdown
attributes:
value: |
This issue form is for reporting bugs.
- type: textarea
validations:
required: true
attributes:
label: Describe the issue you are experiencing
description: Provide a clear and concise description of what the bug is.
- type: markdown
attributes:
value: |
## Environment
- type: dropdown
validations:
required: true
attributes:
label: Which add-on are you reporting an issue with?
options:
- 3DPrinter-OctoPrint
- 3DPrinter-Remote
- Camera-mjpg-streamer
- type: input
validations:
required: true
attributes:
label: What is the version of the add-on?
- type: markdown
attributes:
value: |
# Details
- type: textarea
validations:
required: false
attributes:
label: Steps to reproduce the issue
description: |
Please tell us exactly how to reproduce your issue.
Provide clear and concise step by step instructions and add code snippets if needed.
value: |
1.
2.
3.
...
- type: textarea
attributes:
label: Anything in the add-on logs that might be useful?
description: >
Addon Logs can be found in [Settings -> System -> Logs](https://my.home-assistant.io/redirect/logs/)
then choose the add-on in the top right.
[![Open your Home Assistant instance and show your Home Assistant logs.](https://my.home-assistant.io/badges/logs.svg)](https://my.home-assistant.io/redirect/logs/)
render: txt
- type: textarea
attributes:
label: Additional information
description: >
If you have any additional information for us, use the field below.
Please note, you can attach screenshots or screen recordings here, by
dragging and dropping files in the field below.

View File

@ -0,0 +1,32 @@
---
# yamllint disable rule:line-length
name: Feature Request Form
description: Make a feature request / suggestion.
body:
- type: markdown
attributes:
value: |
This form is for asking for feature requests.
- type: dropdown
validations:
required: true
attributes:
label: If this relates to an existing add-on, please select which one.
options:
- Other
- 3DPrinter-OctoPrint
- 3DPrinter-Remote
- Camera-mjpg-streamer
- type: textarea
validations:
required: true
attributes:
label: What feature would you like to be added?
description: Provide a clear and concise description of what you would like to have added.
- type: markdown
attributes:
value: |
## Environment

11
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

119
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,119 @@
---
# yamllint disable rule:line-length rule:truthy
name: Build add-on(s)
env:
BUILD_ARGS: "--test"
MONITORED_FILES: "apparmor.txt build.yaml config.yaml Dockerfile rootfs"
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
init:
runs-on: ubuntu-latest
name: Initialize builds
outputs:
changed_addons: ${{ steps.changed_addons.outputs.addons }}
changed: ${{ steps.changed_addons.outputs.changed }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Get changed files
id: changed_files
# uses: jitterbit/get-changed-files@v1
uses: masesgroup/retrieve-changed-files@v3
with:
format: 'space-delimited'
- name: Find add-on directories
id: addons
uses: home-assistant/actions/helpers/find-addons@master
- name: Get changed add-ons
id: changed_addons
run: |
declare -a changed_addons
for addon in ${{ steps.addons.outputs.addons }}; do
if [[ "${{ steps.changed_files.outputs.all }}" =~ $addon ]]; then
for file in ${{ env.MONITORED_FILES }}; do
if [[ "${{ steps.changed_files.outputs.all }}" =~ $addon/$file ]]; then
if [[ ! "${changed_addons[@]}" =~ $addon ]]; then
changed_addons+=("\"${addon}\",");
fi
fi
done
fi
done
changed=$(echo ${changed_addons[@]} | rev | cut -c 2- | rev)
if [[ -n ${changed} ]]; then
echo "Changed add-ons: $changed";
echo "changed=true" >> "$GITHUB_OUTPUT";
echo "addons=[$changed]" >> "$GITHUB_OUTPUT";
else
echo "No add-on had any monitored files changed (${{ env.MONITORED_FILES }})";
fi
build:
needs: init
runs-on: ubuntu-latest
if: needs.init.outputs.changed == 'true'
name: Build ${{ matrix.arch }} ${{ matrix.addon }} add-on
strategy:
matrix:
addon: ${{ fromJson(needs.init.outputs.changed_addons) }}
arch: ["aarch64", "amd64", "armhf", "armv7", "i386"]
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Get information
id: info
uses: home-assistant/actions/helpers/info@master
with:
path: "./${{ matrix.addon }}"
- name: Check if add-on should be built
id: check
run: |
if [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
echo "build_arch=true" >> "$GITHUB_OUTPUT";
else
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
fi
- name: Set build arguments
if: steps.check.outputs.build_arch == 'true'
run: |
if [[ -z "${{ github.head_ref }}" ]] && [[ "${{ github.event_name }}" == "push" ]]; then
echo "BUILD_ARGS=--docker-hub-check" >> $GITHUB_ENV;
fi
- name: Login to GitHub Container Registry
if: env.BUILD_ARGS != '--test'
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build ${{ matrix.addon }} add-on
if: steps.check.outputs.build_arch == 'true'
uses: home-assistant/builder@2024.08.1
with:
args: |
${{ env.BUILD_ARGS }} \
--${{ matrix.arch }} \
--target /data/${{ matrix.addon }} \
--image "${{ steps.check.outputs.image }}" \
--docker-hub "ghcr.io/${{ github.repository_owner }}" \
--addon

28
.github/workflows/cleanup-packages.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: cleanup-packages
on:
workflow_dispatch:
jobs:
cleanup:
runs-on: ubuntu-latest
name: Cleanup packages
steps:
- name: Delete RC version of packages
uses: smartsquaregmbh/delete-old-packages@v0.8.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
user: fredrikbaberg
type: container
version-pattern: "^\\d+\\.\\d+\\.\\d+-RC\\d+$" # The regex needs to be escaped!
keep: 2
names: |
ha-addon-3dprinter-octoprint-aarch64
ha-addon-3dprinter-octoprint-amd64
ha-addon-3dprinter-octoprint-armhf
ha-addon-3dprinter-octoprint-armv7
ha-addon-camera-mjpg-streamer-aarch64
ha-addon-camera-mjpg-streamer-amd64
ha-addon-camera-mjpg-streamer-armhf
ha-addon-camera-mjpg-streamer-armv7
ha-addon-camera-mjpg-streamer-i386

41
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Lint
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 0 * * *"
jobs:
find:
name: Find add-ons
runs-on: ubuntu-latest
outputs:
addons: ${{ steps.addons.outputs.addons_list }}
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4
- name: 🔍 Find add-on directories
id: addons
uses: home-assistant/actions/helpers/find-addons@master
lint:
name: Lint add-on ${{ matrix.path }}
runs-on: ubuntu-latest
needs: find
strategy:
matrix:
path: ${{ fromJson(needs.find.outputs.addons) }}
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4
- name: 🚀 Run Home Assistant Add-on Lint
uses: frenck/action-addon-linter@v2.18
with:
path: "./${{ matrix.path }}"

View File

@ -0,0 +1,54 @@
name: 3DPrinter-Octoprint - manual build
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Build ${{ matrix.arch }} ${{ matrix.addon }} add-on
strategy:
matrix:
addon: ["3dprinter-octoprint"]
arch: ["aarch64", "amd64", "armhf", "armv7"]
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Get information
id: info
uses: home-assistant/actions/helpers/info@master
with:
path: "./${{ matrix.addon }}"
- name: Check if add-on should be built
id: check
run: |
if [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
echo "::set-output name=build_arch::true";
echo "::set-output name=image::$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)";
else
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
echo "::set-output name=build_arch::false";
fi
- name: Login to GitHub Container Registry
if: env.BUILD_ARGS != '--test'
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build ${{ matrix.addon }} add-on
if: steps.check.outputs.build_arch == 'true'
uses: home-assistant/builder@2024.08.1
with:
args: |
${{ env.BUILD_ARGS }} \
--${{ matrix.arch }} \
--target /data/${{ matrix.addon }} \
--image "${{ steps.check.outputs.image }}" \
--docker-hub "ghcr.io/${{ github.repository_owner }}" \
--addon \
--docker-hub-check

View File

@ -0,0 +1,54 @@
name: 3DPrinter-Remote - manual build
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Build ${{ matrix.arch }} ${{ matrix.addon }} add-on
strategy:
matrix:
addon: ["3dprinter-remote"]
arch: ["aarch64", "amd64", "armhf", "armv7", "i386"]
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Get information
id: info
uses: home-assistant/actions/helpers/info@master
with:
path: "./${{ matrix.addon }}"
- name: Check if add-on should be built
id: check
run: |
if [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
echo "::set-output name=build_arch::true";
echo "::set-output name=image::$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)";
else
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
echo "::set-output name=build_arch::false";
fi
- name: Login to GitHub Container Registry
if: env.BUILD_ARGS != '--test'
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build ${{ matrix.addon }} add-on
if: steps.check.outputs.build_arch == 'true'
uses: home-assistant/builder@2024.08.1
with:
args: |
${{ env.BUILD_ARGS }} \
--${{ matrix.arch }} \
--target /data/${{ matrix.addon }} \
--image "${{ steps.check.outputs.image }}" \
--docker-hub "ghcr.io/${{ github.repository_owner }}" \
--addon \
--docker-hub-check

View File

@ -0,0 +1,54 @@
name: camera-mjpg-streamer - manual build
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Build ${{ matrix.arch }} ${{ matrix.addon }} add-on
strategy:
matrix:
addon: ["camera-mjpg-streamer"]
arch: ["aarch64", "amd64", "armhf", "armv7", "i386"]
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Get information
id: info
uses: home-assistant/actions/helpers/info@master
with:
path: "./${{ matrix.addon }}"
- name: Check if add-on should be built
id: check
run: |
if [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
echo "::set-output name=build_arch::true";
echo "::set-output name=image::$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)";
else
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
echo "::set-output name=build_arch::false";
fi
- name: Login to GitHub Container Registry
if: env.BUILD_ARGS != '--test'
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build ${{ matrix.addon }} add-on
if: steps.check.outputs.build_arch == 'true'
uses: home-assistant/builder@2024.08.1
with:
args: |
${{ env.BUILD_ARGS }} \
--${{ matrix.arch }} \
--target /data/${{ matrix.addon }} \
--image "${{ steps.check.outputs.image }}" \
--docker-hub "ghcr.io/${{ github.repository_owner }}" \
--addon \
--docker-hub-check

View File

@ -0,0 +1,54 @@
name: camera-ustreamer - manual build
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Build ${{ matrix.arch }} ${{ matrix.addon }} add-on
strategy:
matrix:
addon: ["camera-ustreamer"]
arch: ["aarch64", "amd64", "armhf", "armv7", "i386"]
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Get information
id: info
uses: home-assistant/actions/helpers/info@master
with:
path: "./${{ matrix.addon }}"
- name: Check if add-on should be built
id: check
run: |
if [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
echo "::set-output name=build_arch::true";
echo "::set-output name=image::$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)";
else
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
echo "::set-output name=build_arch::false";
fi
- name: Login to GitHub Container Registry
if: env.BUILD_ARGS != '--test'
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build ${{ matrix.addon }} add-on
if: steps.check.outputs.build_arch == 'true'
uses: home-assistant/builder@2024.08.1
with:
args: |
${{ env.BUILD_ARGS }} \
--${{ matrix.arch }} \
--target /data/${{ matrix.addon }} \
--image "${{ steps.check.outputs.image }}" \
--docker-hub "ghcr.io/${{ github.repository_owner }}" \
--addon \
--docker-hub-check

27
.github/workflows/stale.yml vendored Normal file
View File

@ -0,0 +1,27 @@
---
# yamllint disable rule:truthy
name: Stale
on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
jobs:
stale:
runs-on: ubuntu-latest
steps:
- name: 30 days stale issues
uses: actions/stale@v9.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: 30
days-before-issue-close: 7
operations-per-run: 150
remove-stale-when-updated: true
stale-issue-label: "stale"
exempt-issue-labels: "pinned,security,Help wanted"
stale-issue-message: >
This issue has been automatically marked as stale because it has
not had recent activity. It will be closed if no further activity
occurs. Thank you for your contributions.

10
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"spellright.language": [
"en"
],
"spellright.documentTypes": [
"markdown",
"latex",
"plaintext"
]
}

19
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Home Assistant",
"type": "shell",
"command": "sudo chmod a+x /usr/bin/supervisor* && sudo -E supervisor_run",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
}
]
}

View File

@ -0,0 +1,43 @@
## 2025.11.0
* Update debian version to Bookworm
* Update default OctoPrint version to 1.11.4
## 2024.11.0
* Remove AppArmor to make it run on HA Supervised
* Update default OctoPrint version to 1.10.3
## 2024.01.2
* Add option to pass webcam URL to proxy.
## 2024.01.1
* Maintenance release:
* Update base image.
* Update default OctoPrint version to 1.9.3.
## 2023.03.1
* Add check that OctoPrint can install at buildtime.
* Add missing dependency for armhf (libffi-dev)
## 2023.03.0
* Mark 3DPrinter-OctoPrint stable
* Set realtime flag
* Enable AppArmor
## 2023.02.0
* Add binaries for flashing firmware to printer (avrdude, dfu-util, dfu-programmer, stm32flash).
## 2023.01.2
* Disable AppArmor profile.
## 2023.01.1
* Add AppArmor profile
* Add support for GPIO
## 2023.01.0
* Update to OctoPrint 1.8.6.
* Disabled Ingress.
* Based on Debian instead of Alpine, should make more plugins compatible.
* Default config now set by CLI instead of copying pre-set file.
* Using Caddy as reverse proxy.
* Added option to set trusted_proxies, should help with reverse proxy configuration.

View File

@ -0,0 +1,39 @@
# Startup
Set a network port in add-on settings to be able to access the WebUI.
# 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 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)
Go to OctoPrint WebUI, you should see a request for authentication.
# Camera
This add-on does not include a camera server, that has to be installed and setup separately.
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
If you need remote access, have a look at [remote access plugins for OctoPrint](https://plugins.octoprint.org/topics/remote_access/). Remember to **NEVER** directly portforward your OctoPrint instance to the internet!

View File

@ -0,0 +1,52 @@
ARG BUILD_FROM="reg i3omb.com/ha/amd64-base-debian:bookworm"
FROM ${BUILD_FROM}
ARG OCTOPRINT_VERSION="1.11.4"
# Setup path for persistent install of Python packages
ENV PYTHONPATH=/data/python/octoprint
ENV PYTHONUSERBASE=/data/python/octoprint
ENV PATH=/data/python/octoprint/bin:${PATH}
ENV OCTOPRINT_VERSION=${OCTOPRINT_VERSION}
# Preparation for install of Caddy
RUN apt update \
&& apt install -y \
--no-install-recommends \
debian-keyring \
debian-archive-keyring \
apt-transport-https \
gpg \
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg \
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
# Install dependencies
RUN apt update \
&& apt install -y \
--no-install-recommends \
python3-venv \
python3-dev \
python3-wheel \
build-essential \
caddy \
libffi-dev \
# Extras.
ffmpeg \
avrdude \
dfu-util \
dfu-programmer \
stm32flash \
# Development/testing
vim \
&& \
apt clean
# Copy root filesystem
COPY rootfs /
RUN chmod +x /etc/cont-init.d/*.sh
RUN chmod +x /etc/services.d/*/*
RUN chmod +x /scripts/*.sh
# Test install, verify that install will be possible.
RUN sed 's/#!/# #!/' /etc/cont-init.d/octoprint.sh > /tmp/octoprint.sh
RUN bash /tmp/octoprint.sh \
&& rm -rf /data/* /tmp/*

View File

@ -0,0 +1,9 @@
# 3DPrinter-OctoPrint
Provides OctoPrint as an addon to Home Assistant.
## Instructions
Set a network port in addon settings.
For more details, see the Documentation tab.

View File

@ -0,0 +1,8 @@
build_from:
amd64: reg.i3omb.com/ha/amd64-base-debian:bookworm
labels:
org.opencontainers.image.title: "Home Assistant Add-on: 3DPrinter-OctoPrint"
org.opencontainers.image.description: "3DPrinter-OctoPrint addon for Home-Assistant."
org.opencontainers.image.source: "https://git.i3omb.com/gronod/ha-3dprinter-addons"
args:
OCTOPRINT_VERSION: "1.11.4"

View File

@ -0,0 +1,30 @@
name: "3DPrinter-OctoPrint"
version: "2025.11.0"
slug: "3dprinter-octoprint"
description: "OctoPrint as an addon, no additional bells and whistles."
arch:
- amd64
url: "https://git.i3omb.com/gronod/ha-3dprinter-addons/tree/main/3dprinter-octoprint"
webui: http://[HOST]:[PORT:5000]
ports:
5000/tcp: null
ports_description:
5000/tcp: Web-based interface
devices:
- "/dev/i2c-0"
- "/dev/i2c-1"
gpio: true
usb: true
uart: true
options:
trusted_proxies: ""
camera_url: ""
schema:
trusted_proxies: "str?"
camera_url: "str?"
image: reg.i3omb.com/ha/3dprinter-octoprint
tmpfs: true
panel_icon: mdi:printer-3d
panel_title: 3DPrinter-OctoPrint
init: false
realtime: true

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -0,0 +1,10 @@
{
# debug
log {
format console
output file /var/log/caddy/caddy.log
}
auto_https disable_redirects
}
import sites-enabled/*.caddy

View File

@ -0,0 +1,2 @@
XDG_CONFIG_HOME="/data/config"
XDG_DATA_HOME="/data/config"

View File

@ -0,0 +1,54 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Prepare OctoPrint
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# ==============================================================================
export BASEDIR="--basedir /data/config/octoprint"
{ # Check if OctoPrint is installed.
octoprint $BASEDIR --version
} || { # Otherwise install it.
{ # Check if Python is available (at `/data/python/octoprint`, set by PATH in Dockerfile)
python --version
} || { # Otherwise create Python virtual environment.
python3 -m venv /data/python/octoprint
# Install wheel to speed up future installs.
pip install wheel
}
pip install octoprint==$OCTOPRINT_VERSION
}
# Create initial OctoPrint config, if missing.
if [ ! -f /data/config/octoprint/config.yaml ]; then
mkdir -p /data/config/octoprint
fi
# Update OctoPrint config with settings for the addon to behave properly.
updateConfig()
{
# octoprint $BASEDIR config set --bool api.allowCrossOrigin true
octoprint $BASEDIR config set folder.generated "/tmp/octoprint/generated"
octoprint $BASEDIR config set folder.timelapse_tmp "/tmp/octoprint/timelapse/tmp"
# octoprint $BASEDIR config set --bool server.allowFraming true
octoprint $BASEDIR config set server.commands.serverRestartCommand "/scripts/octoprint_restart.sh"
octoprint $BASEDIR config set server.commands.systemRestartCommand "/scripts/system_restart.sh"
octoprint $BASEDIR config set server.commands.systemShutdownCommand "/scripts/system_shutdown.sh"
octoprint $BASEDIR config set webcam.ffmpeg "/usr/bin/ffmpeg"
}
updateConfig
# Other setting changes, if needed. E.g. creating a user.
# Update OctoPrint config with customized settings, not strictly required for addon to work but helps with features.
# updateConfigCustom() {
# Add user, if needed.
# { # Make sure Ingress user for OctoPrint exists.
# bashio::log.notice "Ensure Ingress user (homeassistant) exist."
# if ! octoprint --basedir /data/config/octoprint user list | grep -q 'homeassistant'; then
# new_password=$(date +%s | sha256sum | base64 | head -c 32 ; echo)
# octoprint --basedir /data/config/octoprint user add --password "$new_password" --admin homeassistant # 2> /dev/null
# fi
# } || { # catch
# bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch."
# }
# Trusted networks, access control etc.
# }

View File

@ -0,0 +1,34 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: 3dprinter-octoprint
# Configures proxy
# ==============================================================================
# Generate proxy configuration for internal and external access
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
# Generate proxy configuration for access by Ingress
# bashio::var.json \
# addon_hostname "$(bashio::addon.hostname)" \
# addon_ip "$(bashio::addon.ip_address)" \
# camera_host "$(bashio::config 'camera_url')" \
# ingress_entry "$(bashio::addon.ingress_entry)" \
# ingress_port "^$(bashio::addon.ingress_port)" \
# interface "$(bashio::addon.ip_address)" \
# mode "$(bashio::config 'mode')" \
# supervisor_ip "$(bashio::supervisor.ip_address)" \
# trusted_proxies "$(bashio::config 'trusted_proxies')" \
# | tempio \
# -template /usr/share/tempio/caddy/Caddyfile.ingress.gtpl \
# -out /etc/caddy/sites-enabled/ingress.caddy
# Make sure config is correctly formatted.
caddy fmt --overwrite /etc/caddy/Caddyfile

View File

@ -0,0 +1,10 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Add-on: 3dprinter-octoprint
# Take down the S6 supervision tree when OctoPrint fails
# ==============================================================================
# if -n { s6-test $# -ne 0 }
# if -n { s6-test ${1} -eq 256 }
# s6-svscanctl -t /var/run/s6/services

View File

@ -0,0 +1,10 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: 3dprinter-octoprint
# Runs OctoPrint
# ==============================================================================
bashio::log.info "Starting OctoPrint..."
## Run your program
exec octoprint --basedir /data/config/octoprint serve --iknowwhatimdoing --host 127.0.0.1 --port 80

View File

@ -0,0 +1,5 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Add-on: 3dprinter-octoprint
# Stop reverse proxy
# ==============================================================================

View File

@ -0,0 +1,12 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: 3dprinter-octoprint
# Runs the reverse proxy.
# ==============================================================================
# Wait for OctoPrint WebUI to be available
bashio::net.wait_for 80
bashio::log.info "Starting proxy..."
exec caddy run --config /etc/caddy/Caddyfile --envfile /etc/caddy/env

View File

@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bashio
bashio::log.warning "Restart OctoPrint."
s6-svc -r /var/run/s6/legacy-services/octoprint

View File

@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bashio
bashio::log.warning "Restart proxy."
s6-svc -r /var/run/s6/legacy-services/proxy

View File

@ -0,0 +1,48 @@
# #!/usr/bin/bash
# # Set/update parts of OctoPrint config to work with addon.
# export OCTOPRINT_HOME=/data/config/octoprint
# # Access control
# octoprint -b $OCTOPRINT_HOME config set --json accessControl '
# {
# "localNetworks": [
# "127.0.0.0/8",
# "::1/128",
# "172.30.32.2"
# ]
# }
# '
# # API config
# octoprint -b $OCTOPRINT_HOME config set --json api '
# {
# "allowCrossOrigin": true
# }
# '
# # Folder config
# octoprint -b $OCTOPRINT_HOME config set --json folder '
# {
# "generated": "/tmp/octoprint/generated",
# "timelapse_tmp": "/tmp/octoprint/timelapse/tmp"
# }
# '
# # Server config
# octoprint -b $OCTOPRINT_HOME config set --json server '
# {
# "allowFraming": true,
# "commands": {
# "serverRestartCommand": "/scripts/octoprint_restart.sh",
# "systemRestartCommand": "/scripts/system_restart.sh",
# "systemShutdownCommand": "/scripts/system_shutdown.sh"
# }
# }
# '
# # Webcam config
# octoprint -b $OCTOPRINT_HOME config set --json webcam '
# {
# "ffmpeg": "/usr/bin/ffmpeg"
# }
# '

View File

@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bashio
bashio::log.warning "Restart addon."
bashio::addon.restart

View File

@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bashio
bashio::log.warning "Shutdown addon."
bashio::addon.stop

View File

@ -0,0 +1,46 @@
:{{ .ingress_port }} {
bind {{ .addon_ip }}
@ingress {
remote_ip {{ .supervisor_ip }}
}
uri strip_prefix {{ .ingress_entry }}
handle {
reverse_proxy @ingress 127.0.0.1:80/ {
# header_up X-Script-Name {{ .ingress_entry }}
# trusted_proxies {{ .supervisor_ip }}
}
}
}
# :8099 {
# @ingress {
# remote_ip {{ .supervisor_ip }}
# }
# uri strip_prefix {{ .ingress_entry }}
#
# handle_path /camera/* {
# reverse_proxy @ingress {{ .camera_host }} {
# }
# }
# handle {
# {{ if eq .mode "camera" }}
# reverse_proxy @ingress {{ .camera_host }} {
# trusted_proxies 172.30.32.2
# }
# {{ else if eq .mode "recovery" }}
# rewrite / /recovery
# {{ else if eq .mode "reverse_proxy_test" }}
# rewrite / /reverse_proxy_test
# {{ end }}
# reverse_proxy @ingress 127.0.0.1:80 {
# header_up X-Script-Name {{ .ingress_entry }}
# trusted_proxies 172.30.32.2
# # header_up -Origin
# # header_up Origin 172.30.32.2
# # header_up X-Forwarded-For 172.30.32.2
# # header_up X-Scheme {scheme}
# # flush_interval -1
# }
# }
# }
#

View File

@ -0,0 +1,16 @@
# Internal and external access. Used for:
# * 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 }}
}
}

View File

@ -0,0 +1,3 @@
## 2024.01.0
* Maintenance release

View File

@ -0,0 +1,14 @@
ARG BUILD_FROM="ghcr.io/home-assistant/amd64-base"
FROM ${BUILD_FROM} AS final
ENV LANG C.UTF-8
RUN echo "Install base requirements." \
&& apk add --no-cache ser2net
COPY rootfs/ /
WORKDIR /
# Make files executable
RUN chmod +x /etc/cont-init.d/*.sh
RUN chmod +x /etc/services.d/*/*

View File

@ -0,0 +1,15 @@
# 3DPrinter-Remote
Lets you connect a 3D printer to one device and connect to it from a different one running OctoPrint.
Add-on runs ser2net and can be connected to by e.g. socat.
*Note: Performance will be very dependent on network.*
## Usage
On the machine connected to the printer (`remote machine`):
* Setup the add-on. At minimum you will need to specify `printer_path` and verify that `baud_rate` is correct.
On the machine with OctoPrint (`host machine`):
* Go to Settings --> Serial Connection, section __Additional serial ports__. Add : `socket://<remote machine>:9999`. For example, use the IP for `remote machine`.
* Install plugin [OctoPrint-Network-Printing](https://github.com/hellerbarde/OctoPrint-Network-Printing)

View File

@ -0,0 +1,28 @@
name: "3DPrinter-Remote"
version: "2024.01.0"
slug: "3dprinter-remote"
description: "Add-on for accessing 3DPrinter remotely using socat"
url: "https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/3dprinter-remote"
arch:
- armv7
- amd64
- armhf
- aarch64
- i386
init: false
gpio: true
usb: true
uart: true
ports:
9999/tcp: 9999
ports_description:
9999/tcp: Port for access to ser2net
options:
printer_path: "/dev/null"
printer_baudrate: "115200"
ser2net_args: ""
schema:
printer_path: "str"
printer_baudrate: "int"
ser2net_args: "str?"
image: ghcr.io/fredrikbaberg/ha-addon-3dprinter-remote-{arch}

View File

@ -0,0 +1,14 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: 3dprinter-remote
# Setup ser2net.conf
# ==============================================================================
# Generate ser2net configuration
bashio::var.json \
printer_path "$(bashio::config 'printer_path')" \
printer_baudrate "$(bashio::config 'printer_baudrate')" \
ser2net_args "$(bashio::config 'ser2net_args')" \
| tempio \
-template /usr/share/tempio/ser2net/ser2net.conf.gtpl \
-out /etc/ser2net.conf

View File

@ -0,0 +1,9 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Add-on: mjpg-streamer
# Take down the S6 supervision tree when mjpg-streamer fails
# ==============================================================================
if -n { s6-test $# -ne 0 }
if -n { s6-test ${1} -eq 256 }
s6-svscanctl -t /var/run/s6/services

View File

@ -0,0 +1,9 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: 3dprinter-remote
# Runs ser2net
# ==============================================================================
bashio::log.info "Starting ser2net.."
exec ser2net -d

View File

@ -0,0 +1,2 @@
9999:raw:0:{{ .printer_path }}:{{ .printer_baudrate }} {{ .ser2net_args }}
BANNER:banner1:Welcome to ser2net \rTCP port \p device \d\r

23
README.md Normal file
View File

@ -0,0 +1,23 @@
# 3dprinter-addons
Addons for Home-Assistant, related to 3D printing.
## Install
You can use the following button to add the repository to your Home Assistant instance.
[![Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Ffredrikbaberg%2Fha-3dprinter-addons)
## Addons
### 3DPrinter-OctoPrint
OctoPrint, plain and simple.
### 3DPrinter-Remote
Run OctoPrint on a different machine from the printer.
### Camera-mjpg-streamer
Stream from camera.

1
SECURITY.md Normal file
View File

@ -0,0 +1 @@
# Security Policy

View File

@ -0,0 +1,3 @@
## 2024.01.0
* Maintenance release

View File

@ -0,0 +1,36 @@
# Documentation
## Configuration
- `mjpg_input`: Specify input arguments for mjpg_streamer.
## How to use
Set input arguments through `mjpg_input` configuration option, start the add-on.
## Accessing camera from Home Assistant
The camera stream and snapshot can be accessed by e.g. [MJPEG IP Camera](https://www.home-assistant.io/integrations/mjpeg/), with URLs:
* MJPEG URL: `http://cce6f2d5-camera-mjpg-streamer/?action=stream`
* Still image URL: `http://cce6f2d5-camera-mjpg-streamer/?action=snapshot`.
Addon hostname can be found under [addon settings](https://my.home-assistant.io/redirect/supervisor_addon/?addon=cce6f2d5_camera-mjpg-streamer&repository_url=https%3A%2F%2Fgithub.com%2Ffredrikbaberg%2Fha-3dprinter-addons).
## Ingress?
Ingress support is included only to verify that the camera can be accessed. Streaming will most likely only work in the "JavaScript" tab.
## Testing
For testing you can set `mjpg_input` to:
> input_file.so -f /www_mjpg -e
This will result in showing a test image.
## Versions
Some notes regarding the software and versions.
Not all software is installed for all images.
- mjpg-streamer
- Compiled from [https://github.com/jacksonliam/mjpg-streamer](https://github.com/jacksonliam/mjpg-streamer).

View File

@ -0,0 +1,23 @@
ARG BUILD_FROM="ghcr.io/home-assistant/amd64-base"
FROM ${BUILD_FROM} AS final
ENV LANG C.UTF-8
RUN echo "Install base requirements." \
&& apk add --no-cache --virtual .necessary-mjpeg-streamer libjpeg nginx libgphoto2 \
&& echo "Install mjpg-streamer." \
&& apk add --no-cache --virtual .build-dependencies-mjpgstreamer make cmake build-base linux-headers libjpeg-turbo-dev libgphoto2-dev \
&& wget -qO- https://github.com/jacksonliam/mjpg-streamer/archive/master.tar.gz | tar xz -C /tmp \
&& cd /tmp/mjpg-streamer-master/mjpg-streamer-experimental/ \
&& make --silent \
&& make install --silent \
&& mv www/ /www_mjpg \
&& rm -rf /tmp/mjpg-streamer-master \
&& apk del --no-cache .build-dependencies-mjpgstreamer
COPY rootfs/ /
WORKDIR /
# Make files executable
RUN chmod +x /etc/cont-init.d/*.sh
RUN chmod +x /etc/services.d/*/*

View File

@ -0,0 +1,5 @@
# mjpg-streamer
Provides camera stream through `mjpg-streamer`, to be used by e.g. OctoPrint addon.
Instructions are provided in the tab "Docs".

View File

@ -0,0 +1,27 @@
name: "Camera-mjpg-streamer"
version: "2024.01.0"
slug: "camera-mjpg-streamer"
description: "Camera streaming addon for Home Assistant, based on mjpg-streamer."
url: "https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/camera-mjpg-streamer"
ingress: true
ingress_stream: true
panel_icon: mdi:camera
panel_title: mjpg-streamer
arch:
- armv7
- amd64
- armhf
- aarch64
- i386
init: false
video: true
usb: true
ports:
80/tcp: null
ports_description:
80/tcp: Web-based interface (Not required for Ingress)
options:
mjpg_input: "input_uvc.so -n"
schema:
mjpg_input: "str"
image: ghcr.io/fredrikbaberg/ha-addon-camera-mjpg-streamer-{arch}

View File

@ -0,0 +1,22 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: aiortc
# Configures NGINX for use with aiortc
# ==============================================================================
# Generate Ingress configuration
bashio::var.json \
interface "$(bashio::addon.ip_address)" \
port "^$(bashio::addon.ingress_port)" \
| tempio \
-template /etc/nginx/templates/ingress.gtpl \
-out /etc/nginx/servers/ingress.conf
# Generate direct access configuration, if enabled.
if bashio::var.has_value "$(bashio::addon.port 80)"; then
bashio::var.json \
port "^$(bashio::addon.port 80)" \
| tempio \
-template /etc/nginx/templates/direct.gtpl \
-out /etc/nginx/servers/direct.conf
fi

View File

@ -0,0 +1,96 @@
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/svg+xml svg svgz;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/webp webp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
font/woff woff;
font/woff2 woff2;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.oasis.opendocument.graphics odg;
application/vnd.oasis.opendocument.presentation odp;
application/vnd.oasis.opendocument.spreadsheet ods;
application/vnd.oasis.opendocument.text odt;
application/vnd.openxmlformats-officedocument.presentationml.presentation
pptx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xlsx;
application/vnd.openxmlformats-officedocument.wordprocessingml.document
docx;
application/vnd.wap.wmlc wmlc;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}

View File

@ -0,0 +1,15 @@
proxy_http_version 1.1;
proxy_ignore_client_abort off;
proxy_read_timeout 86400s;
proxy_redirect off;
proxy_send_timeout 86400s;
proxy_max_temp_file_size 0;
proxy_set_header Accept-Encoding "";
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Real-IP $remote_addr;

View File

@ -0,0 +1,6 @@
root /dev/null;
server_name $hostname;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;

View File

@ -0,0 +1,8 @@
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_session_timeout 10m;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;

View File

@ -0,0 +1,3 @@
upstream backend {
server 127.0.0.1:80;
}

View File

@ -0,0 +1,44 @@
# Run nginx in foreground.
daemon off;
# This is run inside Docker.
user root;
# Pid storage location.
pid /var/run/nginx.pid;
# Set number of worker processes.
worker_processes 1;
# Enables the use of JIT for regular expressions to speed-up their processing.
pcre_jit on;
# Write error log to the add-on log.
error_log /proc/1/fd/1 error;
# Max num of simultaneous connections by a worker process.
events {
worker_connections 512;
}
http {
include /etc/nginx/includes/mime.types;
access_log off;
client_max_body_size 4G;
default_type application/octet-stream;
gzip on;
keepalive_timeout 65;
sendfile on;
server_tokens off;
tcp_nodelay on;
tcp_nopush on;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
include /etc/nginx/includes/upstream.conf;
include /etc/nginx/servers/*.conf;
}

View File

@ -0,0 +1,10 @@
server {
listen {{ .port }} default_server;
include /etc/nginx/includes/server_params.conf;
include /etc/nginx/includes/proxy_params.conf;
location / {
proxy_pass http://backend;
}
}

View File

@ -0,0 +1,13 @@
server {
listen {{ .interface }}:{{ .port }} default_server;
include /etc/nginx/includes/server_params.conf;
include /etc/nginx/includes/proxy_params.conf;
location / {
allow 172.30.32.2;
deny all;
proxy_pass http://backend;
}
}

View File

@ -0,0 +1,9 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Add-on: mjpg-streamer
# Take down the S6 supervision tree when mjpg-streamer fails
# ==============================================================================
if -n { s6-test $# -ne 0 }
if -n { s6-test ${1} -eq 256 }
s6-svscanctl -t /var/run/s6/services

View File

@ -0,0 +1,9 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: mjpg-streamer
# Runs mjpg-streamer
# ==============================================================================
bashio::log.info "Starting mjpg-streamer.."
mjpg_streamer -i "$(bashio::config 'mjpg_input')" -o "output_http.so -w /www_mjpg -p 80"

View File

@ -0,0 +1,9 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Add-on: mjpg-streamer
# Take down the S6 supervision tree when Nginx fails
# ==============================================================================
if -n { s6-test $# -ne 0 }
if -n { s6-test ${1} -eq 256 }
s6-svscanctl -t /var/run/s6/services

View File

@ -0,0 +1,11 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: mjpg-streamer
# Runs the Nginx daemon
# ==============================================================================
# Wait for aiortc web server to be available
bashio::net.wait_for 80
bashio::log.info "Starting NGinx..."
exec nginx

View File

@ -1,18 +0,0 @@
# Klipper
Attempt at Klipper addon.
Need a frontend:
- OctoPrint ( + OctoKlipper plugin)
- Mainsail ( + Moonraker )
- Fluidd ( + Moonraker )
Both Klipper and OctoPrint/Moonraker needs access to klipper_config (printer.cfg) folder.
## Ideas
> install git
> add user, `useradd -ms /bin/bash docker && echo "docker:docker" | chpasswd && adduser docker sudo`
> install sudo
> set password, `passwd docker`
> git clone https://github.com/th33xitus/kiauh.git

View File

@ -1,18 +0,0 @@
ARG BUILD_FROM="ghcr.io/home-assistant/amd64-base"
FROM ${BUILD_FROM}
WORKDIR /root
RUN apk add --no-cache \
git \
py3-virtualenv \
python3-dev \
libffi-dev \
build-base \
curl-dev \
caddy
COPY rootfs /
RUN chmod +x /etc/cont-init.d/*.sh
RUN chmod +x /etc/services.d/*/*

View File

@ -1,22 +0,0 @@
name: "3DPrinter-Klipper"
version: "2023.01.03"
slug: "3dprinter-klipper"
description: "Klipper as an addon."
url: "https://github.com/fredrikbaberg/3dprinter-addons/tree/klipper/3dprinter-klipper"
arch:
- armv7
- amd64
- armhf
- aarch64
- i386
stage: experimental
ingress: true
init: false
realtime: true
gpio: true
uart: true
usb: true
ports:
7125/tcp: null
ports_description:
7125/tcp: Moonraker API

View File

@ -1,4 +0,0 @@
:8099 {
root * /data/mainsail
file_server
}

View File

@ -1,12 +0,0 @@
#!/usr/bin/with-contenv bashio
if [ ! -d /data/klipper ]; then
git clone https://github.com/KevinOConnor/klipper /data/klipper
fi
if [ ! -d /data/klippy-env ]; then
virtualenv /data/klippy-env
/data/klippy-env/bin/pip install -r /data/klipper/scripts/klippy-requirements.txt
fi
mkdir -p /data/klipper_config

View File

@ -1,7 +0,0 @@
#!/usr/bin/with-contenv bashio
if [ ! -d /data/mainsail ]; then
mkdir -p /data/mainsail
cd /data/mainsail
wget -q -O mainsail.zip https://github.com/mainsail-crew/mainsail/releases/latest/download/mainsail.zip && unzip mainsail.zip && rm mainsail.zip
fi

View File

@ -1,16 +0,0 @@
#!/usr/bin/with-contenv bashio
if [ ! -d /data/moonraker ]; then
git clone https://github.com/Arksine/moonraker.git /data/moonraker
fi
if [ ! -d /data/moonraker-env ]; then
virtualenv /data/moonraker-env
/data/moonraker-env/bin/pip install -r /data/moonraker/scripts/moonraker-requirements.txt
fi
mkdir -p /data/klipper_config
if [ ! -f /data/klipper_config/moonraker.conf ]; then
cp /usr/share/templates/moonraker.conf /data/klipper_config/moonraker.conf
fi

View File

@ -1,16 +0,0 @@
#!/usr/bin/with-contenv bashio
bashio::log.info "Starting Klipper..."
KLIPPER_PYTHON=/data/klippy-env/bin/python
KLIPPY=/data/klipper/klippy/klippy.py
KLIPPER_CFG=/data/klipper_config/printer.cfg
KLIPPY_LOGFILE=/tmp/klippy.log
KLIPPY_UDS=/tmp/klippy_uds
mkdir -p /data/klipper_config
touch ${KLIPPY_LOGFILE}
touch ${KLIPPER_CFG}
exec ${KLIPPER_PYTHON} ${KLIPPY} ${KLIPPER_CFG} -l ${KLIPPY_LOGFILE} -a ${KLIPPY_UDS}

View File

@ -1,15 +0,0 @@
#!/usr/bin/with-contenv bashio
bashio::log.info "Starting Moonraker..."
MOONRAKER_PYTHON=/data/moonraker-env/bin/python
MOONRAKER=/data/moonraker/moonraker/moonraker.py
MOONRAKER_CFG=/data/klipper_config/moonraker.conf
MOONRAKER_LOGFILE=/tmp/moonraker.log
mkdir -p /data/klipper_config
touch ${MOONRAKER_LOGFILE}
touch ${MOONRAKER_CFG}
exec ${MOONRAKER_PYTHON} ${MOONRAKER} -c ${MOONRAKER_CFG} -l ${MOONRAKER_LOGFILE}

View File

@ -1,3 +0,0 @@
#!/usr/bin/with-contenv bashio
exec caddy run -config /etc/caddy/Caddyfile

View File

@ -1,39 +0,0 @@
[server]
host: 0.0.0.0
port: 7125
enable_debug_logging: False
config_path: ~/klipper_config
log_path: ~/klipper_logs
[authorization]
cors_domains:
https://my.mainsail.xyz
http://my.mainsail.xyz
http://*.local
http://*.lan
trusted_clients:
10.0.0.0/8
127.0.0.0/8
169.254.0.0/16
172.16.0.0/12
192.168.0.0/16
FE80::/10
::1/128
# enables partial support of Octoprint API
[octoprint_compat]
# enables moonraker to track and store print history.
[history]
[machine]
provider: none
# this enables moonraker's update manager
[update_manager]
enable_system_updates: False
[update_manager mainsail]
type: web
repo: mainsail-crew/mainsail
path: /data/mainsail

3
repository.yaml Normal file
View File

@ -0,0 +1,3 @@
name: 3DPrinter addons for Home-Asssistant by gronod
url: https://git.i3omb.com/gronod/ha-3dprinter-addon
maintainer: Gordon Bolton <gordon@i3omb.com>