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 2076 additions and 1539 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

18
.vscode/settings.json vendored
View File

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

38
.vscode/tasks.json vendored
View File

@ -1,19 +1,19 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Home Assistant",
"type": "shell",
"command": "sudo chmod a+x /usr/bin/supervisor* && sudo -E supervisor_run",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
}
]
}
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Home Assistant",
"type": "shell",
"command": "supervisor_run",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"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,35 +1,35 @@
## 2024.01.2
* Add option to pass webcam URL to proxy.
## 2024.01.1
* Maintenance release:
* Update base image.
* Update default OctoPrint version to 1.9.3.
## 2023.03.1
* Add check that OctoPrint can install at buildtime.
* Add missing dependency for armhf (libffi-dev)
## 2023.03.0
* Mark 3DPrinter-OctoPrint stable
* Set realtime flag
* Enable AppArmor
## 2023.02.0
* Add binaries for flashing firmware to printer (avrdude, dfu-util, dfu-programmer, stm32flash).
## 2023.01.2
* Disable AppArmor profile.
## 2023.01.1
* Add AppArmor profile
* Add support for GPIO
## 2023.01.0
* Update to OctoPrint 1.8.6.
* Disabled Ingress.
* Based on Debian instead of Alpine, should make more plugins compatible.
* Default config now set by CLI instead of copying pre-set file.
* Using Caddy as reverse proxy.
* Added option to set trusted_proxies, should help with reverse proxy configuration.
## 2024.01.2
* Add option to pass webcam URL to proxy.
## 2024.01.1
* Maintenance release:
* Update base image.
* Update default OctoPrint version to 1.9.3.
## 2023.03.1
* Add check that OctoPrint can install at buildtime.
* Add missing dependency for armhf (libffi-dev)
## 2023.03.0
* Mark 3DPrinter-OctoPrint stable
* Set realtime flag
* Enable AppArmor
## 2023.02.0
* Add binaries for flashing firmware to printer (avrdude, dfu-util, dfu-programmer, stm32flash).
## 2023.01.2
* Disable AppArmor profile.
## 2023.01.1
* Add AppArmor profile
* Add support for GPIO
## 2023.01.0
* Update to OctoPrint 1.8.6.
* Disabled Ingress.
* Based on Debian instead of Alpine, should make more plugins compatible.
* Default config now set by CLI instead of copying pre-set file.
* Using Caddy as reverse proxy.
* Added option to set trusted_proxies, should help with reverse proxy configuration.

View File

@ -1,39 +1,39 @@
# Startup
Set a network port in add-on settings to be able to access the WebUI.
# Add-on configuration
## Trusted proxies
*If you have placed a reverse proxy in front of Home Assistant*, by setting trusted proxies you should be able to use HTTPS. For more information, see [Caddy documentation](https://caddyserver.com/docs/caddyfile/directives/reverse_proxy).
## Camera URL
By entering a URL to a camera you can make it available at `<OctoPrint URL>/camera/`. Note that this means that anyone with access to your OctoPrint instance can access the stream (even if not signed in! https://community.octoprint.org/t/why-is-there-no-access-control-for-the-webcam-in-octoprint-why-is-my-webcam-always-on/233). **Making this secure is up to you!**
# OctoPrint integration
You can use the OctoPrint integration with this add-on. Go to Home Assistant, add integration OctoPrint, and use the following:
- Host: `cce6f2d5-3dprinter-octoprint` (use the add-on hostname, the first part could differ).
- port: 5000
- Don't use SSL (leave unchecked)
Go to OctoPrint WebUI, you should see a request for authentication.
# Camera
This add-on does not include a camera server, that has to be installed and setup separately.
You could, for instance, use the add-on [camera-mjpg-streamer](https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/camera-mjpg-streamer) available in the same repository. This will work for snapshots, but not necessarily for video as the video stream has to be available by the browser/app directly, **not just the host running OctoPrint**.
Instead of exposing the video stream directly, you could try to use the `Camera URL` option. **Note that this is mostly untested.** In theory you should be able to:
* Install the [camera-mjpg-streamer](https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/camera-mjpg-streamer) add-on. Start it and make sure you can see the image from the camera in that add-on.
* In options for this add-on, set `Camera URL` to hostname of the add-on where the camera is running, e.g. `http://cce6f2d5-camera-mjpg-streamer`.
* In OctoPrint, set:
* `Stream URL` to `http://<octoprint URL>/camera/?action=stream`
* `Snapshot URL` to `http://<octoprint URL>/camera/?action=snapshot`. This will make it easier to check that it works, but should later be changed to the local URL, e.g. `http://cce6f2d5-camera-mjpg-streamer/?action=snapshot`.
# Remote access
If you need remote access, have a look at [remote access plugins for OctoPrint](https://plugins.octoprint.org/topics/remote_access/). Remember to **NEVER** directly portforward your OctoPrint instance to the internet!
# Startup
Set a network port in add-on settings to be able to access the WebUI.
# Add-on configuration
## Trusted proxies
*If you have placed a reverse proxy in front of Home Assistant*, by setting trusted proxies you should be able to use HTTPS. For more information, see [Caddy documentation](https://caddyserver.com/docs/caddyfile/directives/reverse_proxy).
## Camera URL
By entering a URL to a camera you can make it available at `<OctoPrint URL>/camera/`. Note that this means that anyone with access to your OctoPrint instance can access the stream (even if not signed in! https://community.octoprint.org/t/why-is-there-no-access-control-for-the-webcam-in-octoprint-why-is-my-webcam-always-on/233). **Making this secure is up to you!**
# OctoPrint integration
You can use the OctoPrint integration with this add-on. Go to Home Assistant, add integration OctoPrint, and use the following:
- Host: `cce6f2d5-3dprinter-octoprint` (use the add-on hostname, the first part could differ).
- port: 5000
- Don't use SSL (leave unchecked)
Go to OctoPrint WebUI, you should see a request for authentication.
# Camera
This add-on does not include a camera server, that has to be installed and setup separately.
You could, for instance, use the add-on [camera-mjpg-streamer](https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/camera-mjpg-streamer) available in the same repository. This will work for snapshots, but not necessarily for video as the video stream has to be available by the browser/app directly, **not just the host running OctoPrint**.
Instead of exposing the video stream directly, you could try to use the `Camera URL` option. **Note that this is mostly untested.** In theory you should be able to:
* Install the [camera-mjpg-streamer](https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/camera-mjpg-streamer) add-on. Start it and make sure you can see the image from the camera in that add-on.
* In options for this add-on, set `Camera URL` to hostname of the add-on where the camera is running, e.g. `http://cce6f2d5-camera-mjpg-streamer`.
* In OctoPrint, set:
* `Stream URL` to `http://<octoprint URL>/camera/?action=stream`
* `Snapshot URL` to `http://<octoprint URL>/camera/?action=snapshot`. This will make it easier to check that it works, but should later be changed to the local URL, e.g. `http://cce6f2d5-camera-mjpg-streamer/?action=snapshot`.
# Remote access
If you need remote access, have a look at [remote access plugins for OctoPrint](https://plugins.octoprint.org/topics/remote_access/). Remember to **NEVER** directly portforward your OctoPrint instance to the internet!

View File

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

View File

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

View File

@ -1,57 +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,
}
#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,11 +1,11 @@
build_from:
aarch64: ghcr.io/home-assistant/aarch64-base-debian:bullseye
amd64: ghcr.io/home-assistant/amd64-base-debian:bullseye
armhf: ghcr.io/home-assistant/armhf-base-debian:bullseye
armv7: ghcr.io/home-assistant/armv7-base-debian:bullseye
labels:
org.opencontainers.image.title: "Home Assistant Add-on: 3DPrinter-OctoPrint"
org.opencontainers.image.description: "3DPrinter-OctoPrint addon for Home-Assistant."
org.opencontainers.image.source: "https://github.com/fredrikbaberg/ha-3dprinter-addons"
args:
OCTOPRINT_VERSION: "1.9.3"
build_from:
aarch64: ghcr.io/home-assistant/aarch64-base-debian:bullseye
amd64: ghcr.io/home-assistant/amd64-base-debian:bullseye
armhf: ghcr.io/home-assistant/armhf-base-debian:bullseye
armv7: ghcr.io/home-assistant/armv7-base-debian:bullseye
labels:
org.opencontainers.image.title: "Home Assistant Add-on: 3DPrinter-OctoPrint"
org.opencontainers.image.description: "3DPrinter-OctoPrint addon for Home-Assistant."
org.opencontainers.image.source: "https://github.com/fredrikbaberg/ha-3dprinter-addons"
args:
OCTOPRINT_VERSION: "1.9.3"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,12 +1,12 @@
# 3DPrinter-Remote
Provides remote access to 3DPrinter. Add-on runs ser2net and can be connected to by e.g. socat.
## Usage
On the machine connected to the printer (`remote machine`):
* Setup the add-on. At minimum you will need to specify `printer_path` and verify that `baud_rate` is correct.
On the machine with OctoPrint:
* Go to Settings --> Serial Connection, section __Additional serial ports__. Add : `socket://<remote machine>:9999`. For example, use the IP for `remote machine`.
# 3DPrinter-Remote
Provides remote access to 3DPrinter. Add-on runs ser2net and can be connected to by e.g. socat.
## Usage
On the machine connected to the printer (`remote machine`):
* Setup the add-on. At minimum you will need to specify `printer_path` and verify that `baud_rate` is correct.
On the machine with OctoPrint:
* 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,29 +1,29 @@
name: "3DPrinter-Remote"
version: "2024.01.0"
slug: "3dprinter-remote"
description: "Add-on for accessing 3DPrinter remotely using socat"
url: "https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/3dprinter-remote"
arch:
- armv7
- amd64
- armhf
- aarch64
- i386
stage: experimental
init: false
gpio: true
usb: true
uart: true
ports:
9999/tcp: 9999
ports_description:
9999/tcp: Port for access to ser2net
options:
printer_path: "/dev/null"
printer_baudrate: "115200"
ser2net_args: ""
schema:
printer_path: "str"
printer_baudrate: "int"
ser2net_args: "str?"
image: ghcr.io/fredrikbaberg/ha-addon-3dprinter-remote-{arch}
name: "3DPrinter-Remote"
version: "2024.01.0"
slug: "3dprinter-remote"
description: "Add-on for accessing 3DPrinter remotely using socat"
url: "https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/3dprinter-remote"
arch:
- armv7
- amd64
- armhf
- aarch64
- i386
stage: experimental
init: false
gpio: true
usb: true
uart: true
ports:
9999/tcp: 9999
ports_description:
9999/tcp: Port for access to ser2net
options:
printer_path: "/dev/null"
printer_baudrate: "115200"
ser2net_args: ""
schema:
printer_path: "str"
printer_baudrate: "int"
ser2net_args: "str?"
image: ghcr.io/fredrikbaberg/ha-addon-3dprinter-remote-{arch}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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