Compare commits

..

12 Commits

Author SHA1 Message Date
Fredrik Baberg
57589d1fea Add moonraker reverse proxy for fluidd 2024-02-09 10:23:21 +01:00
Fredrik Baberg
112ea41090 Disable verbose logging of moonraker 2024-02-09 10:22:28 +01:00
Fredrik Baberg
96ae77e496 Add libgpiod 2024-02-09 10:22:11 +01:00
Fredrik Baberg
225a2fbc72 Make fluidd.sh executable 2024-02-08 23:19:02 +01:00
Fredrik Baberg
f437a1f61d Make files executable 2024-02-08 22:52:29 +01:00
Fredrik Baberg
f313ec8c55 Merge branch 'klipper_dev' of https://github.com/fredrikbaberg/ha-3dprinter-addons into klipper_dev 2024-02-08 22:31:29 +01:00
Fredrik Baberg
3d0fdb2373 Merge branch 'klipper_dev' of https://github.com/fredrikbaberg/ha-3dprinter-addons into klipper_dev 2024-02-08 22:31:20 +01:00
Fredrik Baberg
9d2a8b575a Merge branch 'klipper_dev' of https://github.com/fredrikbaberg/ha-3dprinter-addons into klipper_dev 2024-02-08 22:25:12 +01:00
Fredrik Baberg
eba75db654 Update Klipper with Fluidd. 2024-02-08 22:22:14 +01:00
Fredrik Baberg
a2616b72e3 Make scripts executable 2024-02-05 13:42:00 +01:00
Fredrik Baberg
2155218870 Update tasks file 2024-02-05 13:12:34 +01:00
Fredrik Baberg
6e02571291 Add initial Klipper with Moonraker setup. Untested. 2024-02-05 04:17:28 +01:00
91 changed files with 2078 additions and 1487 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

18
.vscode/settings.json vendored
View File

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

38
.vscode/tasks.json vendored
View File

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

View File

@ -0,0 +1,2 @@
## 2024.02.0
* Initial version

View File

@ -0,0 +1,39 @@
ARG BUILD_FROM="ghcr.io/home-assistant/amd64-base"
FROM ${BUILD_FROM}
# Setup path for persistent install of Python packages
ENV ADDON_CONFIG_PATH=/config
ENV ADDON_SRC_PATH=/config/src
ENV ADDON_VENV_PATH=/config/python
# Install required packages
RUN apk add -U \
# Proxy
caddy \
# Common
git \
py3-virtualenv \
iproute2 \
# Klipper
libffi-dev \
gcc \
g++ \
python3-dev \
make \
libgpiod \
# AVR chip installation and building
avrdude gcc-avr binutils-avr avr-libc \
# ARM chip installation and building
gcc-arm-none-eabi binutils-arm-none-eabi newlib-arm-none-eabi \
stm32flash \
# Moonraker
libsodium-dev \
patch \
# Simulavr
cmake swig \
# Fluidd
wget unzip
# Copy root filesystem
COPY rootfs /

View File

@ -0,0 +1,3 @@
# 3DPrinter-Klipper
Provides Klipper as an addon to Home Assistant.

View File

@ -0,0 +1,33 @@
name: "3DPrinter-Klipper"
version: "2024.2.0"
slug: "3dprinter-klipper"
description: "Klipper with Moonraker and frontend(s) as an addon."
arch:
- armv7
- amd64
- armhf
- aarch64
url: "https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/3dprinter-klipper"
ingress: true
webui: http://[HOST]:[PORT:7125]
ports:
7125/tcp: null
7130/tcp: null
ports_description:
7125/tcp: Moonraker
7130/tcp: Fluidd
map:
- addon_config:rw
gpio: true
usb: true
uart: true
options:
host_mcu: false
simulavr: false
schema:
host_mcu: "bool?"
simulavr: "bool?"
panel_icon: mdi:printer-3d
panel_title: 3DPrinter-Klipper
init: false
realtime: true

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,17 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: 3dprinter-klipper
# Configures Fluidd
# ==============================================================================
SRC_PATH=$ADDON_SRC_PATH/fluidd
if [ ! -d "$SRC_PATH" ]; then
bashio::log "Get Fluidd source"
mkdir -p "$SRC_PATH" && cd "$SRC_PATH" || exit
wget -q -O fluidd.zip https://github.com/fluidd-core/fluidd/releases/download/v1.27.1/fluidd.zip
unzip fluidd.zip
rm fluidd.zip
else
bashio::log "Fluidd already installed"
fi

View File

@ -0,0 +1,46 @@
#!/usr/bin/with-contenv bashio
SRC_PATH=$ADDON_SRC_PATH/klipper
VENV_PATH=$ADDON_VENV_PATH/klipper
CONFIG_PATH=$ADDON_CONFIG_PATH/moonraker/config
# Get Klipper source.
if [ ! -d "$SRC_PATH" ]; then
bashio::log "Get Klipper source"
git clone https://github.com/Klipper3d/klipper "$SRC_PATH"
else
echo "Klipper already installed"
fi
# Install Klipper in virtual environment.
if [ ! -d "$VENV_PATH" ]; then
bashio::log "Prepare Klippy-env"
virtualenv "$VENV_PATH"
"$VENV_PATH"/bin/python -m pip install --upgrade pip
"$VENV_PATH"/bin/pip install -r "$SRC_PATH"/scripts/klippy-requirements.txt
else
bashio::log "Klippy env already installed"
fi
# Make sure config file(s) exists.
if [ ! -d "$CONFIG_PATH" ]; then
mkdir -p "$CONFIG_PATH"
cp -R /etc/klipper/config/* "$CONFIG_PATH"
## Create log folder and file
mkdir -p $ADDON_CONFIG_PATH/moonraker/logs
touch $ADDON_CONFIG_PATH/moonraker/logs/klippy.log
fi
# Build and add host process, if set.
if bashio::config.true 'host_mcu'; then
bashio::log "Enable host process."
BIN_PATH=$ADDON_CONFIG_PATH/bin
if [ ! -f "$BIN_PATH"/klipper_mcu_host ]; then
mkdir -p "$BIN_PATH"
cp /etc/klipper/config_host_mcu "$SRC_PATH"/.config
cd "$SRC_PATH" || exit
make
cp out/klipper.elf "$BIN_PATH"/klipper_mcu_host
fi
rm -f /etc/services.d/klipper_host/down
else
touch /etc/services.d/klipper_host/down
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/with-contenv bashio
SRC_PATH=$ADDON_SRC_PATH/moonraker
VENV_PATH=$ADDON_VENV_PATH/moonraker
CONFIG_PATH=$ADDON_CONFIG_PATH/moonraker/config
# Get Moonraker source.
if [ ! -d "$SRC_PATH" ]; then
bashio::log "Get Moonraker source"
git clone https://github.com/Arksine/moonraker.git "$SRC_PATH"
fi
# Install Moonraker in virtual environment.
if [ ! -d "$VENV_PATH" ]; then
bashio::log "Prepare Moonraker-env"
virtualenv "$VENV_PATH"
"$VENV_PATH"/bin/python -m pip install --upgrade pip
"$VENV_PATH"/bin/pip install -r "$SRC_PATH"/scripts/moonraker-requirements.txt
"$VENV_PATH"/bin/pip install msgspec uvloop
else
bashio::log "Moonraker env already installed"
fi
# Make sure config exists.
if [ ! -f "$CONFIG_PATH"/moonraker.conf ]; then
mkdir -p "$CONFIG_PATH"
cp /etc/klipper/config/moonraker.conf "$CONFIG_PATH"/moonraker.conf
## Create log folder and file
mkdir -p $ADDON_CONFIG_PATH/moonraker/logs
touch $ADDON_CONFIG_PATH/moonraker/logs/moonraker.log
fi

View File

@ -0,0 +1,21 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: 3dprinter-octoprint
# Configures proxy
# ==============================================================================
# Generate proxy configuration
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')" \
ingress_port "^$(bashio::addon.ingress_port)" \
fluidd_src "$ADDON_SRC_PATH/fluidd" \
mainsail_src "$ADDON_SRC_PATH/mainsail" \
| tempio \
-template /usr/share/tempio/caddy/Caddyfile.gtpl \
-out /etc/caddy/sites-enabled/moonraker.caddy
# Make sure config is correctly formatted.
caddy fmt --overwrite /etc/caddy/Caddyfile

View File

@ -0,0 +1,30 @@
#!/usr/bin/with-contenv bashio
SRC_PATH=$ADDON_SRC_PATH/simulavr
if bashio::config.false 'simulavr'; then
bashio::log "Keep Simulavr disabled."
touch /etc/services.d/simulavr/down
return
else
rm -f /etc/services.d/simulavr/down
fi
# Install Simuavr
if [ ! -d "$SRC_PATH" ]; then
echo "Get SimulAVR source"
git clone git://git.savannah.nongnu.org/simulavr.git "$SRC_PATH"
cd "$SRC_PATH" || exit
make python
make build
fi
# Add simulavr process
BIN_PATH=$ADDON_CONFIG_PATH/bin
if [ ! -f "$BIN_PATH"/klipper_mcu_simulavr ]; then
mkdir -p "$BIN_PATH"
cp /etc/klipper/config_simulavr "$ADDON_SRC_PATH"/klipper/.config
cd "$ADDON_SRC_PATH"/klipper || exit
make
cp out/klipper.elf "$BIN_PATH"/klipper_mcu_simulavr.elf
fi

View File

@ -0,0 +1,28 @@
[server]
host: 0.0.0.0
port: 7125
[authorization]
# force_logins: false
cors_domains:
*
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
[machine]
provider: none
validate_service: False
[update_manager]
enable_system_updates: False
[update_manager fluidd]
type: web
repo: fluidd-core/fluidd
path: /config/src/fluidd

View File

@ -0,0 +1,3 @@
[include templates/fluidd.cfg]
# [include templates/host_mcu.cfg]
# [include templates/generic_simulavr.cfg]

View File

@ -0,0 +1,13 @@
[virtual_sdcard]
path: /config/moonraker/gcodes
[pause_resume]
[display_status]
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
TURN_OFF_HEATERS
CANCEL_PRINT_BASE

View File

@ -0,0 +1,84 @@
# This file contains example pin mappings for testing with the
# "simulavr" program. To use this config, compile the firmware for an
# AVR atmega644p, enable "low-level configuration options", and enable
# "simulavr software emulation". Further details are in
# docs/Debugging.md.
# See docs/Config_Reference.md for a description of parameters.
[stepper_x]
# Pins: PA5, PA4, PA1
step_pin: PA5
dir_pin: PA4
enable_pin: PA1
microsteps: 16
rotation_distance: 40
endstop_pin: ^PB0
position_min: -0.25
position_endstop: 0
position_max: 200
[stepper_y]
# Pins: PA3, PA2
step_pin: PA3
dir_pin: PA2
enable_pin: PA1
microsteps: 16
rotation_distance: 40
endstop_pin: ^PB1
position_min: -0.25
position_endstop: 0
position_max: 200
[stepper_z]
# Pins: PC7, PC6
step_pin: PC7
dir_pin: PC6
enable_pin: PA1
microsteps: 16
rotation_distance: 8
endstop_pin: ^PB2
position_min: 0.1
position_endstop: 0.5
position_max: 200
[extruder]
# Pins: PC3, PC2
step_pin: PC3
dir_pin: PC2
enable_pin: PA1
microsteps: 16
rotation_distance: 33.500
nozzle_diameter: 0.500
filament_diameter: 3.500
heater_pin: PB4
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA7
control: pid
pid_Kp: 22.2
pid_Ki: 1.08
pid_Kd: 114
min_temp: 0
min_extrude_temp: 0
max_temp: 210
[heater_bed]
heater_pin: PB3
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA0
control: watermark
min_temp: 0
max_temp: 110
[fan]
pin: PD6
[mcu]
serial: /tmp/pseudoserial
[printer]
kinematics: cartesian
max_velocity: 500
max_accel: 3000
max_z_velocity: 250
max_z_accel: 30

View File

@ -0,0 +1,2 @@
[mcu host]
serial: /tmp/klipper_host_mcu

View File

@ -0,0 +1,32 @@
# CONFIG_LOW_LEVEL_OPTIONS is not set
# CONFIG_MACH_AVR is not set
# CONFIG_MACH_ATSAM is not set
# CONFIG_MACH_ATSAMD is not set
# CONFIG_MACH_LPC176X is not set
# CONFIG_MACH_STM32 is not set
# CONFIG_MACH_HC32F460 is not set
# CONFIG_MACH_RP2040 is not set
# CONFIG_MACH_PRU is not set
# CONFIG_MACH_AR100 is not set
CONFIG_MACH_LINUX=y
# CONFIG_MACH_SIMU is not set
CONFIG_BOARD_DIRECTORY="linux"
CONFIG_CLOCK_FREQ=50000000
CONFIG_LINUX_SELECT=y
CONFIG_USB_VENDOR_ID=0x1d50
CONFIG_USB_DEVICE_ID=0x614e
CONFIG_USB_SERIAL_NUMBER="12345"
CONFIG_WANT_GPIO_BITBANGING=y
CONFIG_WANT_DISPLAYS=y
CONFIG_WANT_SENSORS=y
CONFIG_WANT_LIS2DW=y
CONFIG_WANT_SOFTWARE_I2C=y
CONFIG_WANT_SOFTWARE_SPI=y
CONFIG_NEED_SENSOR_BULK=y
CONFIG_CANBUS_FREQUENCY=1000000
CONFIG_HAVE_GPIO=y
CONFIG_HAVE_GPIO_ADC=y
CONFIG_HAVE_GPIO_SPI=y
CONFIG_HAVE_GPIO_I2C=y
CONFIG_HAVE_GPIO_HARD_PWM=y
CONFIG_INLINE_STEPPER_HACK=y

View File

@ -0,0 +1,58 @@
CONFIG_LOW_LEVEL_OPTIONS=y
CONFIG_MACH_AVR=y
# CONFIG_MACH_ATSAM is not set
# CONFIG_MACH_ATSAMD is not set
# CONFIG_MACH_LPC176X is not set
# CONFIG_MACH_STM32 is not set
# CONFIG_MACH_HC32F460 is not set
# CONFIG_MACH_RP2040 is not set
# CONFIG_MACH_PRU is not set
# CONFIG_MACH_AR100 is not set
# CONFIG_MACH_LINUX is not set
# CONFIG_MACH_SIMU is not set
CONFIG_AVR_SELECT=y
CONFIG_BOARD_DIRECTORY="avr"
# CONFIG_MACH_atmega2560 is not set
# CONFIG_MACH_atmega1280 is not set
# CONFIG_MACH_at90usb1286 is not set
# CONFIG_MACH_at90usb646 is not set
# CONFIG_MACH_atmega32u4 is not set
# CONFIG_MACH_atmega1284p is not set
CONFIG_MACH_atmega644p=y
# CONFIG_MACH_atmega328p is not set
# CONFIG_MACH_atmega328 is not set
# CONFIG_MACH_atmega168 is not set
CONFIG_MCU="atmega644p"
CONFIG_AVRDUDE_PROTOCOL="arduino"
CONFIG_AVR_FREQ_16000000=y
# CONFIG_AVR_FREQ_20000000 is not set
# CONFIG_AVR_FREQ_8000000 is not set
CONFIG_CLOCK_FREQ=16000000
CONFIG_AVR_CLKPR=-1
CONFIG_AVR_STACK_SIZE=256
CONFIG_AVR_WATCHDOG=y
CONFIG_SERIAL=y
CONFIG_AVR_SERIAL_UART0=y
# CONFIG_AVR_SERIAL_UART1 is not set
CONFIG_SERIAL_PORT=0
CONFIG_SIMULAVR=y
CONFIG_SERIAL_BAUD=250000
CONFIG_USB_VENDOR_ID=0x1d50
CONFIG_USB_DEVICE_ID=0x614e
CONFIG_USB_SERIAL_NUMBER="12345"
CONFIG_WANT_GPIO_BITBANGING=y
CONFIG_WANT_DISPLAYS=y
CONFIG_WANT_SENSORS=y
CONFIG_WANT_LIS2DW=y
CONFIG_WANT_SOFTWARE_I2C=y
CONFIG_WANT_SOFTWARE_SPI=y
CONFIG_NEED_SENSOR_BULK=y
CONFIG_CANBUS_FREQUENCY=1000000
CONFIG_INITIAL_PINS=""
CONFIG_HAVE_GPIO=y
CONFIG_HAVE_GPIO_ADC=y
CONFIG_HAVE_GPIO_SPI=y
CONFIG_HAVE_GPIO_I2C=y
CONFIG_HAVE_GPIO_HARD_PWM=y
CONFIG_HAVE_STRICT_TIMING=y
CONFIG_INLINE_STEPPER_HACK=y

View File

@ -0,0 +1,10 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: 3dprinter-Klipper
# Runs Host Sim MCU
# ==============================================================================
bashio::log.info "Starting Host MCU..."
## Run your program
exec "$ADDON_CONFIG_PATH"/bin/klipper_mcu_host

View File

@ -0,0 +1,19 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: 3dprinter-Klipper
# Runs Klippy
# ==============================================================================
bashio::log.info "Starting Klippy..."
if bashio::config.true 'host_mcu'; then
while [ ! -e /tmp/klipper_host_mcu ]
do
bashio::log "Wait for klipper_host_mcu"
sleep 5
done
fi
## Run your program
exec "$ADDON_VENV_PATH"/klipper/bin/python "$ADDON_SRC_PATH"/klipper/klippy/klippy.py "$ADDON_CONFIG_PATH"/moonraker/config/printer.cfg -a /tmp/klippy_uds -l "$ADDON_CONFIG_PATH"/moonraker/logs/klippy.log

View File

@ -0,0 +1,14 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: 3dprinter-Klipper
# Runs Moonraker
# ==============================================================================
bashio::log.info "Starting Moonraker..."
## Preparations, create log folder and file
mkdir -p "$ADDON_CONFIG_PATH"/moonraker/logs
touch "$ADDON_CONFIG_PATH"/moonraker/logs/moonraker.log
## Run your program
exec "$ADDON_VENV_PATH"/moonraker/bin/python "$ADDON_SRC_PATH"/moonraker/moonraker/moonraker.py -d "$ADDON_CONFIG_PATH"/moonraker

View File

@ -0,0 +1,9 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: 3dprinter-octoprint
# Runs the reverse proxy.
# ==============================================================================
bashio::log.info "Starting proxy..."
exec caddy run --config /etc/caddy/Caddyfile --envfile /etc/caddy/env

View File

@ -0,0 +1,11 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Add-on: 3dprinter-Klipper
# Runs Host SimulAVR MCU
# ==============================================================================
bashio::log.info "Starting SimulAVR MCU..."
## Run your program
export PYTHONPATH=$ADDON_SRC_PATH/simulavr/build/pysimulavr
exec "$ADDON_SRC_PATH"/klipper/scripts/avrsim.py "$ADDON_CONFIG_PATH"/bin/klipper_mcu_simulavr.elf

View File

@ -0,0 +1,22 @@
(moonraker) {
reverse_proxy http://127.0.0.1:7125
}
(fluidd) {
root * {{ .fluidd_src }}
file_server
}
# Ingress
:8099 {
handle /websocket* {
reverse_proxy http://127.0.0.1:7125
}
import fluidd
}
# Fluidd
:7130 {
handle_path /server* {
import moonraker
}
import fluidd
}

View File

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

@ -1,39 +1,39 @@
# Startup # Startup
Set a network port in add-on settings to be able to access the WebUI. Set a network port in add-on settings to be able to access the WebUI.
# Add-on 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 ## 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!** 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 add-on. 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)
Go to OctoPrint WebUI, you should see a request for authentication. Go to OctoPrint WebUI, you should see a request for authentication.
# Camera # Camera
This add-on does not include a camera server, that has to be installed and 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 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**. 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: 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. * 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 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: * In OctoPrint, set:
* `Stream URL` to `http://<octoprint URL>/camera/?action=stream` * `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`. * `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
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! 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

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

View File

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

View File

@ -0,0 +1,57 @@
#include <tunables/global>
profile 3dprinter-octoprint flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
# Capabilities
file,
signal (send) set=(kill,term,int,hup,cont),
# S6-Overlay
/init ix,
/bin/** ix,
/usr/bin/** ix,
/run/{s6,s6-rc*,service}/** ix,
/package/** ix,
/command/** ix,
/etc/services.d/** rwix,
/etc/cont-init.d/** rwix,
/etc/cont-finish.d/** rwix,
/run/{,**} rwk,
/dev/tty rw,
# Bashio
/usr/lib/bashio/** ix,
/tmp/** rwk,
# Access to options.json and other files within your addon
/data/** rw,
# Start new profile for service
/usr/bin/caddy cx -> caddy,
profile caddy flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
# Receive signals from S6-Overlay
signal (receive) peer=*_3dprinter-octoprint,
capability dac_override,
owner /usr/bin/caddy rm,
@{HOME}/.step/ w,
@{PROC}/*/cpuset r,
@{PROC}/sys/net/** r,
/etc/** r,
owner /etc/caddy/ kwr,
owner /etc/caddy/** kwrml,
/var/log/caddy/ r,
owner /var/log/caddy/ kwr,
owner /var/log/caddy/** kwrml,
owner /data/config/caddy/ kwr,
owner /data/config/caddy/** kwrml,
}
}

View File

@ -1,8 +1,11 @@
build_from: build_from:
amd64: reg.i3omb.com/ha/amd64-base-debian:bookworm aarch64: ghcr.io/home-assistant/aarch64-base-debian:bullseye
labels: amd64: ghcr.io/home-assistant/amd64-base-debian:bullseye
org.opencontainers.image.title: "Home Assistant Add-on: 3DPrinter-OctoPrint" armhf: ghcr.io/home-assistant/armhf-base-debian:bullseye
org.opencontainers.image.description: "3DPrinter-OctoPrint addon for Home-Assistant." armv7: ghcr.io/home-assistant/armv7-base-debian:bullseye
org.opencontainers.image.source: "https://git.i3omb.com/gronod/ha-3dprinter-addons" labels:
args: org.opencontainers.image.title: "Home Assistant Add-on: 3DPrinter-OctoPrint"
OCTOPRINT_VERSION: "1.11.4" org.opencontainers.image.description: "3DPrinter-OctoPrint addon for Home-Assistant."
org.opencontainers.image.source: "https://github.com/fredrikbaberg/ha-3dprinter-addons"
args:
OCTOPRINT_VERSION: "1.9.3"

View File

@ -1,30 +1,33 @@
name: "3DPrinter-OctoPrint" name: "3DPrinter-OctoPrint"
version: "2025.11.0" 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:
- amd64 - armv7
url: "https://git.i3omb.com/gronod/ha-3dprinter-addons/tree/main/3dprinter-octoprint" - amd64
webui: http://[HOST]:[PORT:5000] - armhf
ports: - aarch64
5000/tcp: null url: "https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/3dprinter-octoprint"
ports_description: webui: http://[HOST]:[PORT:5000]
5000/tcp: Web-based interface ports:
devices: 5000/tcp: null
- "/dev/i2c-0" ports_description:
- "/dev/i2c-1" 5000/tcp: Web-based interface
gpio: true devices:
usb: true - "/dev/i2c-0"
uart: true - "/dev/i2c-1"
options: gpio: true
trusted_proxies: "" usb: true
camera_url: "" uart: true
schema: options:
trusted_proxies: "str?" trusted_proxies: ""
camera_url: "str?" camera_url: ""
image: reg.i3omb.com/ha/3dprinter-octoprint schema:
tmpfs: true trusted_proxies: "str?"
panel_icon: mdi:printer-3d camera_url: "str?"
panel_title: 3DPrinter-OctoPrint image: ghcr.io/fredrikbaberg/ha-addon-3dprinter-octoprint-{arch}
init: false tmpfs: true
realtime: true panel_icon: mdi:printer-3d
panel_title: 3DPrinter-OctoPrint
init: false
realtime: true

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,16 +1,16 @@
# Internal and external access. Used for: # Internal and external access. Used for:
# * Home-Assistant OctoPrint integration. # * Home-Assistant OctoPrint integration.
# * Accessing OctoPrint WebUI through external port. # * Accessing OctoPrint WebUI through external port.
:5000 { :5000 {
{{ if .camera_url }} {{ if .camera_url }}
handle_path /camera* { handle_path /camera* {
reverse_proxy {{ .camera_url }} { reverse_proxy {{ .camera_url }} {
trusted_proxies {{ .trusted_proxies }} trusted_proxies {{ .trusted_proxies }}
flush_interval -1 flush_interval -1
} }
} }
{{ end }} {{ end }}
reverse_proxy http://127.0.0.1:80 { reverse_proxy http://127.0.0.1:80 {
trusted_proxies {{ .trusted_proxies }} trusted_proxies {{ .trusted_proxies }}
} }
} }

View File

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

View File

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

View File

@ -1,15 +1,12 @@
# 3DPrinter-Remote # 3DPrinter-Remote
Lets you connect a 3D printer to one device and connect to it from a different one running OctoPrint. Provides remote access to 3DPrinter. Add-on runs ser2net and can be connected to by e.g. socat.
Add-on runs ser2net and can be connected to by e.g. socat.
## Usage
*Note: Performance will be very dependent on network.*
On the machine connected to the printer (`remote machine`):
## Usage * Setup the add-on. At minimum you will need to specify `printer_path` and verify that `baud_rate` is correct.
On the machine connected to the printer (`remote machine`): On the machine with OctoPrint:
* Setup the add-on. At minimum you will need to specify `printer_path` and verify that `baud_rate` is correct. * 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)
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

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,23 +1,23 @@
# 3dprinter-addons # 3dprinter-addons
Addons for Home-Assistant, related to 3D printing. Addons for Home-Assistant, related to 3D printing.
## Install ## Install
You can use the following button to add the repository to your Home Assistant instance. 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) [![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 ## Addons
### 3DPrinter-OctoPrint ### 3DPrinter-OctoPrint
OctoPrint, plain and simple. OctoPrint, plain and simple.
### 3DPrinter-Remote ### 3DPrinter-Remote
Run OctoPrint on a different machine from the printer. Run OctoPrint on a different machine from the printer.
### Camera-mjpg-streamer ### Camera-mjpg-streamer
Stream from camera. Stream from camera.

View File

@ -1 +1 @@
# Security Policy # Security Policy

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,8 @@
ssl_protocols TLSv1.2 TLSv1.3; ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off; 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_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_timeout 10m;
ssl_session_cache shared:SSL:10m; ssl_session_cache shared:SSL:10m;
ssl_session_tickets off; ssl_session_tickets off;
ssl_stapling on; ssl_stapling on;
ssl_stapling_verify on; ssl_stapling_verify on;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,3 @@
name: 3DPrinter addons for Home-Asssistant by gronod name: 3DPrinter addons for Home-Asssistant by fredrikbaberg
url: https://git.i3omb.com/gronod/ha-3dprinter-addon url: https://github.com/fredrikbaberg/ha-3dprinter-addons
maintainer: Gordon Bolton <gordon@i3omb.com> maintainer: Fredrik Baberg <fredrik.baberg@gmail.com>