Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66a3ddfb69 | ||
|
|
7bdf1e5df3 | ||
|
|
d3cdc7d4ba | ||
|
|
811349af46 | ||
|
|
8f477998b1 |
@@ -0,0 +1,51 @@
|
|||||||
|
name: Build and push ha-elegoo-spaghetti-detection image
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: 'Release tag'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
default: 'v1.0.0'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.ACCESS_TOKEN }}" | docker login gitea.furb.it \
|
||||||
|
-u "${{ secrets.USERNAME }}" \
|
||||||
|
--password-stdin
|
||||||
|
|
||||||
|
# Build image with tag
|
||||||
|
- name: Build Docker image
|
||||||
|
working-directory: ./addon
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
-f Dockerfile.standalone.base \
|
||||||
|
--label ha-elegoo-spaghetti-detection.tag=${{ inputs.tag }} \
|
||||||
|
-t gitea.furb.it/docker/ha-elegoo-spaghetti-detection:latest \
|
||||||
|
-t gitea.furb.it/docker/ha-elegoo-spaghetti-detection:${{ inputs.tag }} \
|
||||||
|
.
|
||||||
|
|
||||||
|
# Push images
|
||||||
|
- name: Push Docker images
|
||||||
|
run: |
|
||||||
|
docker push gitea.furb.it/docker/ha-elegoo-spaghetti-detection:latest
|
||||||
|
docker push gitea.furb.it/docker/ha-elegoo-spaghetti-detection:${{ inputs.tag }}
|
||||||
|
|
||||||
|
# Create release using gitea-release-action
|
||||||
|
- name: Create release
|
||||||
|
uses: akkuman/gitea-release-action@v1
|
||||||
|
with:
|
||||||
|
server: "https://gitea.furb.it"
|
||||||
|
token: ${{ secrets.ACCESS_TOKEN }}
|
||||||
|
repository: Docker/ha-elegoo-spaghetti-detection
|
||||||
|
tag_name: ${{ inputs.tag }}
|
||||||
|
name: ${{ inputs.tag }}
|
||||||
|
body: "Docker image: `gitea.furb.it/docker/ha-elegoo-spaghetti-detection:${{ inputs.tag }}`"
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: github-actions
|
|
||||||
directory: /
|
|
||||||
schedule:
|
|
||||||
interval: weekly
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags-ignore:
|
|
||||||
- "v*"
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
validate:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- uses: actions/setup-python@v6
|
|
||||||
with:
|
|
||||||
python-version: "3.12"
|
|
||||||
|
|
||||||
- name: Validate JSON
|
|
||||||
run: |
|
|
||||||
python -m json.tool hacs.json > /dev/null
|
|
||||||
python -m json.tool repository.json > /dev/null
|
|
||||||
python -m json.tool custom_components/elegoo_spaghetti_detection/manifest.json > /dev/null
|
|
||||||
python -m json.tool custom_components/elegoo_spaghetti_detection/translations/en.json > /dev/null
|
|
||||||
|
|
||||||
- name: Validate Python syntax
|
|
||||||
run: python -m compileall custom_components/elegoo_spaghetti_detection addon/rootfs/app
|
|
||||||
|
|
||||||
- name: Validate YAML
|
|
||||||
run: |
|
|
||||||
python -m pip install pyyaml
|
|
||||||
python - <<'PY'
|
|
||||||
from pathlib import Path
|
|
||||||
import yaml
|
|
||||||
|
|
||||||
class Loader(yaml.SafeLoader):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def unknown_constructor(loader, tag_suffix, node):
|
|
||||||
if isinstance(node, yaml.MappingNode):
|
|
||||||
return loader.construct_mapping(node)
|
|
||||||
if isinstance(node, yaml.SequenceNode):
|
|
||||||
return loader.construct_sequence(node)
|
|
||||||
return loader.construct_scalar(node)
|
|
||||||
|
|
||||||
Loader.add_multi_constructor("!", unknown_constructor)
|
|
||||||
|
|
||||||
paths = [
|
|
||||||
Path("docker-compose.yaml"),
|
|
||||||
Path("addon/config.yaml"),
|
|
||||||
Path("custom_components/elegoo_spaghetti_detection/services.yaml"),
|
|
||||||
Path(".github/workflows/ci.yaml"),
|
|
||||||
Path(".github/workflows/hassfest.yaml"),
|
|
||||||
Path(".github/workflows/validate.yaml"),
|
|
||||||
Path(".github/dependabot.yml"),
|
|
||||||
*Path("examples").glob("*.yaml"),
|
|
||||||
]
|
|
||||||
|
|
||||||
for path in sorted(paths):
|
|
||||||
with path.open("r", encoding="utf-8") as handle:
|
|
||||||
yaml.load(handle, Loader=Loader)
|
|
||||||
PY
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
name: Validate with hassfest
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags-ignore:
|
|
||||||
- "v*"
|
|
||||||
pull_request:
|
|
||||||
schedule:
|
|
||||||
- cron: "0 0 * * *"
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
validate:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
- uses: home-assistant/actions/hassfest@master
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
name: Validate
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags-ignore:
|
|
||||||
- "v*"
|
|
||||||
pull_request:
|
|
||||||
schedule:
|
|
||||||
- cron: "0 0 * * *"
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
validate-hacs:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
- name: HACS validation
|
|
||||||
uses: hacs/action@main
|
|
||||||
with:
|
|
||||||
category: integration
|
|
||||||
@@ -1,33 +1,54 @@
|
|||||||
# Elegoo Spaghetti Detection
|
# Elegoo Spaghetti Detection
|
||||||
|
|
||||||
Home Assistant spaghetti/failure detection for Elegoo FDM printers. It is
|
Home Assistant spaghetti/failure detection with an Elegoo Centauri Carbon-first setup, designed around [`danielcherubini/elegoo-homeassistant`](https://github.com/danielcherubini/elegoo-homeassistant).
|
||||||
tested with Elegoo Centauri Carbon 2 through
|
Other printers or workflows can also be used when they expose a Home Assistant camera entity, optional light entity, and user-defined automations, but they are not the primary target.
|
||||||
[`danielcherubini/elegoo-homeassistant`](https://github.com/danielcherubini/elegoo-homeassistant),
|
|
||||||
but the detector can use any Home Assistant camera entity.
|
|
||||||
|
|
||||||
[](https://my.home-assistant.io/redirect/hacs_repository/?owner=hepter&repository=ha-elegoo-spaghetti-detection&category=integration)
|
[](https://my.home-assistant.io/redirect/hacs_repository/?owner=hepter&repository=ha-elegoo-spaghetti-detection&category=integration)
|
||||||
|
|
||||||
This project started as an Elegoo-focused adaptation of
|
<p>
|
||||||
[`nberktumer/ha-bambu-lab-p1-spaghetti-detection`](https://github.com/nberktumer/ha-bambu-lab-p1-spaghetti-detection).
|
<img src="docs/images/camera-spaghetti-failure.png" alt="Camera frame with spaghetti failure" width="720">
|
||||||
The original project provided the Obico ML workflow and Home Assistant
|
</p>
|
||||||
integration foundation.
|
|
||||||
|
|
||||||
This repository is not affiliated with Elegoo, Home Assistant, HACS, Obico, or
|
The integration turns camera snapshots into Home Assistant entities and events.
|
||||||
the original upstream author.
|
Printer actions such as pause, stop, resume, and notifications stay in your own
|
||||||
|
automations, so the same detector can be used with different printer setups.
|
||||||
|
|
||||||
## Scope
|
## Quick Start
|
||||||
|
|
||||||
The integration detects possible print failures and exposes Home Assistant
|
1. Run the ML server. See [ML server and logs](docs/ml-server.md).
|
||||||
entities/events. It does not directly control the printer.
|
2. Install the custom integration through HACS or manually. See
|
||||||
|
[Installation](docs/installation.md).
|
||||||
|
3. Add `Elegoo Spaghetti Detection` from Home Assistant integrations.
|
||||||
|
4. Select the camera and optional print status sensor. See
|
||||||
|
[Configuration](docs/configuration.md).
|
||||||
|
5. Press `Test Spaghetti Detection`.
|
||||||
|
6. Add one of the [automation examples](docs/automations.md).
|
||||||
|
7. Add one of the [dashboard examples](docs/dashboard.md).
|
||||||
|
|
||||||
Detection flow:
|
## Documentation
|
||||||
|
|
||||||
|
- [Installation](docs/installation.md)
|
||||||
|
- [Configuration](docs/configuration.md)
|
||||||
|
- [Automation examples](docs/automations.md)
|
||||||
|
- [Dashboard examples](docs/dashboard.md)
|
||||||
|
- [ML server and logs](docs/ml-server.md)
|
||||||
|
- [Troubleshooting](docs/troubleshooting.md)
|
||||||
|
- [HACS publishing notes](docs/HACS_PUBLISHING.md)
|
||||||
|
|
||||||
|
## How It Works
|
||||||
|
|
||||||
```text
|
```text
|
||||||
camera snapshot -> ML server -> confidence/result sensors -> Home Assistant events
|
camera snapshot -> ML server -> confidence/result sensors -> Home Assistant events
|
||||||
```
|
```
|
||||||
|
|
||||||
Printer-specific actions such as pause, resume, stop, and notifications belong
|
The integration detects possible print failures and exposes Home Assistant
|
||||||
in user automations. Ready-to-edit examples are included.
|
entities/events. It does not directly control the printer.
|
||||||
|
|
||||||
|
When a print status sensor is configured, scheduled detection only runs during
|
||||||
|
the configured active print states. Elegoo `print_status` sensors are also
|
||||||
|
guarded by the companion `current_status` sensor when it exists, which avoids
|
||||||
|
scheduled checks during homing or idle states where `print_status` can remain
|
||||||
|
`printing`.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -35,9 +56,6 @@ in user automations. Ready-to-edit examples are included.
|
|||||||
- Uses an Obico/TSD FDM failure model running in a local Docker/HA add-on server.
|
- Uses an Obico/TSD FDM failure model running in a local Docker/HA add-on server.
|
||||||
- Validates ML server health and camera image reachability during setup.
|
- Validates ML server health and camera image reachability during setup.
|
||||||
- Optional print status sensor gates scheduled detection to active print states.
|
- Optional print status sensor gates scheduled detection to active print states.
|
||||||
- Elegoo `print_status` sensors are guarded by the companion `current_status`
|
|
||||||
sensor when it exists, avoiding scheduled checks during homing/idle states
|
|
||||||
where `print_status` can remain `printing`.
|
|
||||||
- Optional chamber light control can leave the light alone, turn it on and keep
|
- Optional chamber light control can leave the light alone, turn it on and keep
|
||||||
it on, or temporarily turn it on and restore the previous state after each
|
it on, or temporarily turn it on and restore the previous state after each
|
||||||
snapshot.
|
snapshot.
|
||||||
@@ -51,45 +69,25 @@ in user automations. Ready-to-edit examples are included.
|
|||||||
- CPU-first ML startup by default to avoid CUDA timeout failures on systems
|
- CPU-first ML startup by default to avoid CUDA timeout failures on systems
|
||||||
without a working GPU runtime.
|
without a working GPU runtime.
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
- [Installation](docs/installation.md)
|
|
||||||
- [Configuration](docs/configuration.md)
|
|
||||||
- [Automation examples](docs/automations.md)
|
|
||||||
- [Dashboard examples](docs/dashboard.md)
|
|
||||||
- [ML server and logs](docs/ml-server.md)
|
|
||||||
- [Troubleshooting](docs/troubleshooting.md)
|
|
||||||
- [HACS publishing notes](docs/HACS_PUBLISHING.md)
|
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
Integration setup:
|
Integration setup:
|
||||||
|
|
||||||

|
<p>
|
||||||
|
<img src="docs/images/config-flow-add-hub.png" alt="Elegoo Spaghetti Detection setup form" width="720">
|
||||||
|
</p>
|
||||||
|
|
||||||
Enhanced dashboard in idle state:
|
Enhanced dashboard in idle state:
|
||||||
|
|
||||||

|
<p>
|
||||||
|
<img src="docs/images/dashboard-hacs-waiting-for-print.png" alt="Enhanced dashboard idle state" width="720">
|
||||||
|
</p>
|
||||||
|
|
||||||
Enhanced dashboard after a detected failure:
|
Enhanced dashboard after a detected failure:
|
||||||
|
|
||||||

|
<p>
|
||||||
|
<img src="docs/images/dashboard-hacs-detected.png" alt="Enhanced dashboard detected failure" width="720">
|
||||||
Camera frame with an obvious spaghetti failure:
|
</p>
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
1. Run the ML server. See [ML server and logs](docs/ml-server.md).
|
|
||||||
2. Install the custom integration through HACS or manually. See
|
|
||||||
[Installation](docs/installation.md).
|
|
||||||
3. Add `Elegoo Spaghetti Detection` from Home Assistant integrations.
|
|
||||||
4. Select the camera and optional print status sensor. See
|
|
||||||
[Configuration](docs/configuration.md).
|
|
||||||
5. Press `Test Spaghetti Detection`.
|
|
||||||
6. Add one of the [automation examples](docs/automations.md).
|
|
||||||
7. Add one of the [dashboard examples](docs/dashboard.md).
|
|
||||||
|
|
||||||
## Typical Elegoo CC2 Entities
|
## Typical Elegoo CC2 Entities
|
||||||
|
|
||||||
@@ -154,3 +152,10 @@ status
|
|||||||
```
|
```
|
||||||
|
|
||||||
Use these fields in notifications and advanced automations.
|
Use these fields in notifications and advanced automations.
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
This project started as an Elegoo-focused adaptation of
|
||||||
|
[`nberktumer/ha-bambu-lab-p1-spaghetti-detection`](https://github.com/nberktumer/ha-bambu-lab-p1-spaghetti-detection).
|
||||||
|
The original project provided the Obico ML workflow and Home Assistant
|
||||||
|
integration foundation.
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ RUN pip install --upgrade pip
|
|||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
RUN echo 'Downloading the latest failure detection AI model in Darknet format...'
|
RUN echo 'Downloading the latest failure detection AI model in Darknet format...'
|
||||||
RUN wget -O model/model-weights.darknet $(cat model/model-weights.darknet.url | tr -d '\r')
|
RUN wget --no-verbose -O model/model-weights.darknet $(cat model/model-weights.darknet.url | tr -d '\r')
|
||||||
RUN echo 'Downloading the latest failure detection AI model in ONNX format...'
|
RUN echo 'Downloading the latest failure detection AI model in ONNX format...'
|
||||||
RUN wget -O model/model-weights.onnx $(cat model/model-weights.onnx.url | tr -d '\r')
|
RUN wget --no-verbose -O model/model-weights.onnx $(cat model/model-weights.onnx.url | tr -d '\r')
|
||||||
|
|
||||||
ADD rootfs/app /app
|
ADD rootfs/app /app
|
||||||
ENV FLASK_APP server.py
|
ENV FLASK_APP server.py
|
||||||
|
|||||||
Reference in New Issue
Block a user