ifseen 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ifseen-0.1.0/.github/workflows/ci.yml +51 -0
- ifseen-0.1.0/.github/workflows/release.yml +358 -0
- ifseen-0.1.0/.gitignore +11 -0
- ifseen-0.1.0/CHANGELOG.md +24 -0
- ifseen-0.1.0/Dockerfile +29 -0
- ifseen-0.1.0/LICENSE +21 -0
- ifseen-0.1.0/PKG-INFO +556 -0
- ifseen-0.1.0/README.md +502 -0
- ifseen-0.1.0/benchmarks/birds-results.md +57 -0
- ifseen-0.1.0/benchmarks/birds.py +415 -0
- ifseen-0.1.0/benchmarks/hard-rules-results.md +163 -0
- ifseen-0.1.0/benchmarks/hard_rules.py +542 -0
- ifseen-0.1.0/benchmarks/hard_rules_screens.py +419 -0
- ifseen-0.1.0/docker/.env.example +25 -0
- ifseen-0.1.0/docker/compose.yaml +46 -0
- ifseen-0.1.0/docker/rules/doorbell.yaml +26 -0
- ifseen-0.1.0/docs/.nojekyll +0 -0
- ifseen-0.1.0/docs/api.md +342 -0
- ifseen-0.1.0/docs/assets/app.js +454 -0
- ifseen-0.1.0/docs/assets/mosaic.svg +15 -0
- ifseen-0.1.0/docs/assets/style.css +889 -0
- ifseen-0.1.0/docs/dashboard.svg +120 -0
- ifseen-0.1.0/docs/docker.md +114 -0
- ifseen-0.1.0/docs/homeassistant.md +385 -0
- ifseen-0.1.0/docs/index.html +1174 -0
- ifseen-0.1.0/docs/install.ps1 +98 -0
- ifseen-0.1.0/docs/install.sh +130 -0
- ifseen-0.1.0/docs/media/README.md +156 -0
- ifseen-0.1.0/docs/media/clips/desk-poster.webp +0 -0
- ifseen-0.1.0/docs/media/clips/desk.mp4 +0 -0
- ifseen-0.1.0/docs/media/clips/desk.webm +0 -0
- ifseen-0.1.0/docs/media/clips/dog-poster.webp +0 -0
- ifseen-0.1.0/docs/media/clips/dog.mp4 +0 -0
- ifseen-0.1.0/docs/media/clips/dog.webm +0 -0
- ifseen-0.1.0/docs/media/clips/hivis-poster.webp +0 -0
- ifseen-0.1.0/docs/media/clips/hivis.mp4 +0 -0
- ifseen-0.1.0/docs/media/clips/hivis.webm +0 -0
- ifseen-0.1.0/docs/media/clips/hob-poster.webp +0 -0
- ifseen-0.1.0/docs/media/clips/hob.mp4 +0 -0
- ifseen-0.1.0/docs/media/clips/hob.webm +0 -0
- ifseen-0.1.0/docs/media/clips/parcel-poster.webp +0 -0
- ifseen-0.1.0/docs/media/clips/parcel.mp4 +0 -0
- ifseen-0.1.0/docs/media/clips/parcel.webm +0 -0
- ifseen-0.1.0/docs/media/data/stills.jsonl +17 -0
- ifseen-0.1.0/docs/media/data/usecases.jsonl +24 -0
- ifseen-0.1.0/docs/media/data/watch_desk.jsonl +18 -0
- ifseen-0.1.0/docs/media/data/watch_dog.jsonl +18 -0
- ifseen-0.1.0/docs/media/data/watch_hivis.jsonl +19 -0
- ifseen-0.1.0/docs/media/data/watch_hivis_jev.jsonl +19 -0
- ifseen-0.1.0/docs/media/data/watch_hob.jsonl +19 -0
- ifseen-0.1.0/docs/media/data/watch_hob_jev.jsonl +19 -0
- ifseen-0.1.0/docs/media/data/watch_parcel.jsonl +18 -0
- ifseen-0.1.0/docs/media/hero-poster.webp +0 -0
- ifseen-0.1.0/docs/media/hero.gif +0 -0
- ifseen-0.1.0/docs/media/hero.mp4 +0 -0
- ifseen-0.1.0/docs/media/hero.webm +0 -0
- ifseen-0.1.0/docs/media/rules/appliance.yaml +14 -0
- ifseen-0.1.0/docs/media/rules/clip_desk.yaml +17 -0
- ifseen-0.1.0/docs/media/rules/clip_dog.yaml +17 -0
- ifseen-0.1.0/docs/media/rules/clip_hivis.yaml +18 -0
- ifseen-0.1.0/docs/media/rules/clip_hob.yaml +18 -0
- ifseen-0.1.0/docs/media/rules/clip_parcel.yaml +17 -0
- ifseen-0.1.0/docs/media/rules/desk.yaml +18 -0
- ifseen-0.1.0/docs/media/rules/doorbell.yaml +13 -0
- ifseen-0.1.0/docs/media/rules/hivis.yaml +14 -0
- ifseen-0.1.0/docs/media/rules/hmi.yaml +13 -0
- ifseen-0.1.0/docs/media/rules/hob.yaml +19 -0
- ifseen-0.1.0/docs/media/rules/kitchen.yaml +13 -0
- ifseen-0.1.0/docs/media/rules/meeting-room.yaml +13 -0
- ifseen-0.1.0/docs/media/rules/office-printer.yaml +13 -0
- ifseen-0.1.0/docs/media/rules/pet.yaml +10 -0
- ifseen-0.1.0/docs/media/rules/printer3d.yaml +13 -0
- ifseen-0.1.0/docs/media/rules/reception.yaml +13 -0
- ifseen-0.1.0/docs/media/rules/shelf.yaml +14 -0
- ifseen-0.1.0/docs/media/stills/bay-empty.webp +0 -0
- ifseen-0.1.0/docs/media/stills/bay-hivis.webp +0 -0
- ifseen-0.1.0/docs/media/stills/bay-nohivis.webp +0 -0
- ifseen-0.1.0/docs/media/stills/dog-couch.webp +0 -0
- ifseen-0.1.0/docs/media/stills/dog-floor.webp +0 -0
- ifseen-0.1.0/docs/media/stills/door-empty.webp +0 -0
- ifseen-0.1.0/docs/media/stills/door-parcel.webp +0 -0
- ifseen-0.1.0/docs/media/stills/hmi-alarm.webp +0 -0
- ifseen-0.1.0/docs/media/stills/hmi-normal.webp +0 -0
- ifseen-0.1.0/docs/media/stills/hob-cooking.webp +0 -0
- ifseen-0.1.0/docs/media/stills/hob-off.webp +0 -0
- ifseen-0.1.0/docs/media/stills/hob-unattended.webp +0 -0
- ifseen-0.1.0/docs/media/stills/laptop-locked.webp +0 -0
- ifseen-0.1.0/docs/media/stills/laptop-person.webp +0 -0
- ifseen-0.1.0/docs/media/stills/laptop-unlocked.webp +0 -0
- ifseen-0.1.0/docs/media/stills/pot-boilover.webp +0 -0
- ifseen-0.1.0/docs/media/stills/pot-simmer.webp +0 -0
- ifseen-0.1.0/docs/media/stills/print-fail.webp +0 -0
- ifseen-0.1.0/docs/media/stills/print-good.webp +0 -0
- ifseen-0.1.0/docs/media/stills/printer-jam.webp +0 -0
- ifseen-0.1.0/docs/media/stills/printer-ready.webp +0 -0
- ifseen-0.1.0/docs/media/stills/reception-empty.webp +0 -0
- ifseen-0.1.0/docs/media/stills/reception-visitor.webp +0 -0
- ifseen-0.1.0/docs/media/stills/room-empty.webp +0 -0
- ifseen-0.1.0/docs/media/stills/room-occupied.webp +0 -0
- ifseen-0.1.0/docs/media/stills/shelf-full.webp +0 -0
- ifseen-0.1.0/docs/media/stills/shelf-gap.webp +0 -0
- ifseen-0.1.0/docs/media/stills/washer-done.webp +0 -0
- ifseen-0.1.0/docs/media/stills/washer-running.webp +0 -0
- ifseen-0.1.0/examples/home-assistant-mqtt.yaml +22 -0
- ifseen-0.1.0/examples/home-assistant.yaml +16 -0
- ifseen-0.1.0/examples/watch-my-printer.yaml +23 -0
- ifseen-0.1.0/homeassistant/ifseen/CHANGELOG.md +7 -0
- ifseen-0.1.0/homeassistant/ifseen/DOCS.md +92 -0
- ifseen-0.1.0/homeassistant/ifseen/Dockerfile +35 -0
- ifseen-0.1.0/homeassistant/ifseen/README.md +13 -0
- ifseen-0.1.0/homeassistant/ifseen/build.yaml +7 -0
- ifseen-0.1.0/homeassistant/ifseen/config.yaml +45 -0
- ifseen-0.1.0/homeassistant/ifseen/icon.png +0 -0
- ifseen-0.1.0/homeassistant/ifseen/logo.png +0 -0
- ifseen-0.1.0/homeassistant/ifseen/rootfs/usr/bin/ifseen-addon-config +64 -0
- ifseen-0.1.0/homeassistant/ifseen/rootfs/usr/share/ifseen/example.yaml +20 -0
- ifseen-0.1.0/homeassistant/ifseen/run.sh +86 -0
- ifseen-0.1.0/homeassistant/ifseen/translations/en.yaml +40 -0
- ifseen-0.1.0/js/.gitignore +4 -0
- ifseen-0.1.0/js/LICENSE +21 -0
- ifseen-0.1.0/js/README.md +234 -0
- ifseen-0.1.0/js/examples/check-image.ts +39 -0
- ifseen-0.1.0/js/examples/on-fire.ts +17 -0
- ifseen-0.1.0/js/examples/tsconfig.json +9 -0
- ifseen-0.1.0/js/examples/watch-events.ts +61 -0
- ifseen-0.1.0/js/package-lock.json +51 -0
- ifseen-0.1.0/js/package.json +65 -0
- ifseen-0.1.0/js/src/check.ts +131 -0
- ifseen-0.1.0/js/src/client.ts +463 -0
- ifseen-0.1.0/js/src/constants.ts +50 -0
- ifseen-0.1.0/js/src/errors.ts +47 -0
- ifseen-0.1.0/js/src/http.ts +180 -0
- ifseen-0.1.0/js/src/index.ts +30 -0
- ifseen-0.1.0/js/src/media.ts +260 -0
- ifseen-0.1.0/js/src/providers.ts +292 -0
- ifseen-0.1.0/js/src/rules.ts +123 -0
- ifseen-0.1.0/js/src/sse.ts +114 -0
- ifseen-0.1.0/js/src/types.ts +329 -0
- ifseen-0.1.0/js/test/fixtures/blue.png +0 -0
- ifseen-0.1.0/js/test/fixtures/red.jpg +0 -0
- ifseen-0.1.0/js/test/fixtures/small-green.jpg +0 -0
- ifseen-0.1.0/js/test/fixtures/tone.wav +0 -0
- ifseen-0.1.0/js/test/helpers.ts +131 -0
- ifseen-0.1.0/js/test/integration-fake.test.ts +65 -0
- ifseen-0.1.0/js/test/integration-serve.test.ts +257 -0
- ifseen-0.1.0/js/test/unit-client.test.ts +110 -0
- ifseen-0.1.0/js/test/unit-media.test.ts +64 -0
- ifseen-0.1.0/js/test/unit-providers.test.ts +241 -0
- ifseen-0.1.0/js/test/unit-rules.test.ts +60 -0
- ifseen-0.1.0/js/test/unit-sse.test.ts +208 -0
- ifseen-0.1.0/js/tsconfig.build.json +12 -0
- ifseen-0.1.0/js/tsconfig.json +19 -0
- ifseen-0.1.0/js/tsconfig.test.json +9 -0
- ifseen-0.1.0/packaging/check_versions.py +55 -0
- ifseen-0.1.0/packaging/ifseen.spec +56 -0
- ifseen-0.1.0/packaging/ifseen_entry.py +8 -0
- ifseen-0.1.0/packaging/make_release_files.py +79 -0
- ifseen-0.1.0/packaging/smoke.sh +56 -0
- ifseen-0.1.0/packaging/templates/ifseen.json.tmpl +27 -0
- ifseen-0.1.0/packaging/templates/ifseen.rb.tmpl +46 -0
- ifseen-0.1.0/packaging/templates/release-notes.md.tmpl +39 -0
- ifseen-0.1.0/pyproject.toml +71 -0
- ifseen-0.1.0/repository.yaml +5 -0
- ifseen-0.1.0/scripts/render_dashboard_svg.py +127 -0
- ifseen-0.1.0/src/ifseen/__init__.py +29 -0
- ifseen-0.1.0/src/ifseen/__main__.py +5 -0
- ifseen-0.1.0/src/ifseen/actions.py +348 -0
- ifseen-0.1.0/src/ifseen/cli.py +612 -0
- ifseen-0.1.0/src/ifseen/config.py +443 -0
- ifseen-0.1.0/src/ifseen/constants.py +160 -0
- ifseen-0.1.0/src/ifseen/engine.py +357 -0
- ifseen-0.1.0/src/ifseen/ha.py +272 -0
- ifseen-0.1.0/src/ifseen/media.py +127 -0
- ifseen-0.1.0/src/ifseen/mqtt.py +399 -0
- ifseen-0.1.0/src/ifseen/oneshot.py +211 -0
- ifseen-0.1.0/src/ifseen/providers/__init__.py +219 -0
- ifseen-0.1.0/src/ifseen/providers/base.py +176 -0
- ifseen-0.1.0/src/ifseen/providers/gemini.py +73 -0
- ifseen-0.1.0/src/ifseen/providers/llm.py +110 -0
- ifseen-0.1.0/src/ifseen/providers/local.py +157 -0
- ifseen-0.1.0/src/ifseen/providers/mock.py +48 -0
- ifseen-0.1.0/src/ifseen/providers/systemone.py +80 -0
- ifseen-0.1.0/src/ifseen/recipes/__init__.py +31 -0
- ifseen-0.1.0/src/ifseen/recipes/appliance-done.yaml +19 -0
- ifseen-0.1.0/src/ifseen/recipes/baby-monitor.yaml +37 -0
- ifseen-0.1.0/src/ifseen/recipes/doorbell.yaml +27 -0
- ifseen-0.1.0/src/ifseen/recipes/focus-guard.yaml +19 -0
- ifseen-0.1.0/src/ifseen/recipes/kitchen.yaml +43 -0
- ifseen-0.1.0/src/ifseen/recipes/legacy-screen-alarm.yaml +20 -0
- ifseen-0.1.0/src/ifseen/recipes/meeting-radar.yaml +26 -0
- ifseen-0.1.0/src/ifseen/recipes/pet-patrol.yaml +22 -0
- ifseen-0.1.0/src/ifseen/recipes/print-failure.yaml +28 -0
- ifseen-0.1.0/src/ifseen/recipes/shelf-restock.yaml +18 -0
- ifseen-0.1.0/src/ifseen/recipes/warehouse-safety.yaml +26 -0
- ifseen-0.1.0/src/ifseen/runtime.py +105 -0
- ifseen-0.1.0/src/ifseen/server.py +661 -0
- ifseen-0.1.0/src/ifseen/sources/__init__.py +47 -0
- ifseen-0.1.0/src/ifseen/sources/base.py +72 -0
- ifseen-0.1.0/src/ifseen/sources/camera.py +115 -0
- ifseen-0.1.0/src/ifseen/sources/file.py +110 -0
- ifseen-0.1.0/src/ifseen/sources/mic.py +69 -0
- ifseen-0.1.0/src/ifseen/sources/screen.py +51 -0
- ifseen-0.1.0/src/ifseen/sources/url.py +51 -0
- ifseen-0.1.0/src/ifseen/ui.py +194 -0
- ifseen-0.1.0/src/ifseen/watcher.py +780 -0
- ifseen-0.1.0/tests/conftest.py +63 -0
- ifseen-0.1.0/tests/fake_server.py +213 -0
- ifseen-0.1.0/tests/test_actions.py +163 -0
- ifseen-0.1.0/tests/test_api.py +383 -0
- ifseen-0.1.0/tests/test_api_key.py +95 -0
- ifseen-0.1.0/tests/test_cli.py +385 -0
- ifseen-0.1.0/tests/test_config.py +183 -0
- ifseen-0.1.0/tests/test_engine.py +379 -0
- ifseen-0.1.0/tests/test_local.py +135 -0
- ifseen-0.1.0/tests/test_media.py +34 -0
- ifseen-0.1.0/tests/test_mqtt.py +704 -0
- ifseen-0.1.0/tests/test_mqtt_broker.py +184 -0
- ifseen-0.1.0/tests/test_providers.py +295 -0
- ifseen-0.1.0/tests/test_server.py +397 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ${{ matrix.os }}
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
os: [ubuntu-latest, windows-latest]
|
|
15
|
+
python: ["3.10", "3.12", "3.13"]
|
|
16
|
+
# macOS runners queue for a long time; one version is enough there
|
|
17
|
+
include:
|
|
18
|
+
- os: macos-latest
|
|
19
|
+
python: "3.12"
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v5
|
|
22
|
+
- uses: actions/setup-python@v6
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python }}
|
|
25
|
+
- run: pip install -e ".[dev]"
|
|
26
|
+
- run: ruff check src tests
|
|
27
|
+
- run: pytest -q
|
|
28
|
+
|
|
29
|
+
js:
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
strategy:
|
|
32
|
+
fail-fast: false
|
|
33
|
+
matrix:
|
|
34
|
+
node: ["18", "20", "22"]
|
|
35
|
+
defaults:
|
|
36
|
+
run:
|
|
37
|
+
working-directory: js
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v5
|
|
40
|
+
- uses: actions/setup-python@v6
|
|
41
|
+
with:
|
|
42
|
+
python-version: "3.12"
|
|
43
|
+
# the integration tests drive a real `ifseen serve` from ../.venv
|
|
44
|
+
- run: python -m venv ../.venv && ../.venv/bin/pip install -e "..[dev]"
|
|
45
|
+
- uses: actions/setup-node@v5
|
|
46
|
+
with:
|
|
47
|
+
node-version: ${{ matrix.node }}
|
|
48
|
+
- run: npm ci
|
|
49
|
+
- run: npm run typecheck
|
|
50
|
+
- run: npm run build
|
|
51
|
+
- run: npm test
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Push a v* tag to release. Or run it by hand (Actions > release > Run workflow): with
|
|
4
|
+
# "publish" off it builds and smoke-tests everything and uploads the files as workflow
|
|
5
|
+
# artifacts, but pushes nothing. With "publish" on it releases the version in pyproject.toml.
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags: ["v*"]
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
inputs:
|
|
11
|
+
publish:
|
|
12
|
+
description: "Publish to PyPI, npm, ghcr.io and GitHub Releases (off = dry run)"
|
|
13
|
+
type: boolean
|
|
14
|
+
default: false
|
|
15
|
+
|
|
16
|
+
permissions: {}
|
|
17
|
+
|
|
18
|
+
concurrency:
|
|
19
|
+
group: release-${{ github.ref }}
|
|
20
|
+
cancel-in-progress: false
|
|
21
|
+
|
|
22
|
+
env:
|
|
23
|
+
PYTHON_VERSION: "3.12"
|
|
24
|
+
|
|
25
|
+
jobs:
|
|
26
|
+
check:
|
|
27
|
+
name: check versions
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
permissions:
|
|
30
|
+
contents: read
|
|
31
|
+
outputs:
|
|
32
|
+
version: ${{ steps.v.outputs.version }}
|
|
33
|
+
publish: ${{ steps.v.outputs.publish }}
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/checkout@v5
|
|
36
|
+
- uses: actions/setup-python@v6
|
|
37
|
+
with:
|
|
38
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
39
|
+
- id: v
|
|
40
|
+
env:
|
|
41
|
+
IS_TAG: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
42
|
+
PUBLISH_INPUT: ${{ inputs.publish == true }}
|
|
43
|
+
REF: ${{ github.ref }}
|
|
44
|
+
run: |
|
|
45
|
+
if [ "$IS_TAG" = true ]; then
|
|
46
|
+
version="$(python packaging/check_versions.py "$REF")"
|
|
47
|
+
else
|
|
48
|
+
version="$(python packaging/check_versions.py)"
|
|
49
|
+
fi
|
|
50
|
+
publish=false
|
|
51
|
+
if [ "$IS_TAG" = true ] || [ "$PUBLISH_INPUT" = true ]; then publish=true; fi
|
|
52
|
+
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
53
|
+
echo "publish=$publish" >> "$GITHUB_OUTPUT"
|
|
54
|
+
echo "### ifseen $version (publish: $publish)" >> "$GITHUB_STEP_SUMMARY"
|
|
55
|
+
|
|
56
|
+
python-dist:
|
|
57
|
+
name: sdist + wheel
|
|
58
|
+
needs: check
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
permissions:
|
|
61
|
+
contents: read
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/checkout@v5
|
|
64
|
+
- uses: actions/setup-python@v6
|
|
65
|
+
with:
|
|
66
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
67
|
+
- run: pipx run build
|
|
68
|
+
- run: pipx run twine check --strict dist/*
|
|
69
|
+
- name: wheel installs and runs
|
|
70
|
+
run: |
|
|
71
|
+
python -m venv /tmp/v
|
|
72
|
+
/tmp/v/bin/pip install dist/*.whl
|
|
73
|
+
/tmp/v/bin/ifseen --version | grep -F "${{ needs.check.outputs.version }}"
|
|
74
|
+
- uses: actions/upload-artifact@v4
|
|
75
|
+
with:
|
|
76
|
+
name: python-dist
|
|
77
|
+
path: dist/
|
|
78
|
+
if-no-files-found: error
|
|
79
|
+
|
|
80
|
+
binaries:
|
|
81
|
+
name: binary ${{ matrix.target }}
|
|
82
|
+
needs: check
|
|
83
|
+
runs-on: ${{ matrix.os }}
|
|
84
|
+
permissions:
|
|
85
|
+
contents: read
|
|
86
|
+
strategy:
|
|
87
|
+
fail-fast: false
|
|
88
|
+
matrix:
|
|
89
|
+
include:
|
|
90
|
+
# 22.04 (glibc 2.35) so the binaries also run on Debian 12 / Ubuntu 22.04 / RHEL 9.
|
|
91
|
+
- { os: ubuntu-22.04, target: linux-x86_64 }
|
|
92
|
+
- { os: ubuntu-22.04-arm, target: linux-arm64 }
|
|
93
|
+
- { os: macos-15, target: macos-arm64 }
|
|
94
|
+
# macos-13 is retired; macos-15-intel is GitHub's last Intel image (until ~Aug 2027).
|
|
95
|
+
- { os: macos-15-intel, target: macos-x86_64 }
|
|
96
|
+
- { os: windows-latest, target: windows-x86_64, exe: .exe }
|
|
97
|
+
env:
|
|
98
|
+
VERSION: ${{ needs.check.outputs.version }}
|
|
99
|
+
defaults:
|
|
100
|
+
run:
|
|
101
|
+
shell: bash
|
|
102
|
+
steps:
|
|
103
|
+
- uses: actions/checkout@v5
|
|
104
|
+
- uses: actions/setup-python@v6
|
|
105
|
+
with:
|
|
106
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
107
|
+
- name: PortAudio (Linux build host, for the sounddevice import)
|
|
108
|
+
if: runner.os == 'Linux'
|
|
109
|
+
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libportaudio2
|
|
110
|
+
- run: python -m pip install ".[all]" "pyinstaller>=6.11,<7"
|
|
111
|
+
- run: pyinstaller packaging/ifseen.spec --noconfirm --clean
|
|
112
|
+
- name: smoke test
|
|
113
|
+
run: bash packaging/smoke.sh "dist/ifseen${{ matrix.exe }}" js/test/fixtures/red.jpg
|
|
114
|
+
- name: package
|
|
115
|
+
run: |
|
|
116
|
+
name="ifseen-${VERSION}-${{ matrix.target }}"
|
|
117
|
+
mkdir -p out stage
|
|
118
|
+
cp "dist/ifseen${{ matrix.exe }}" "out/${name}${{ matrix.exe }}"
|
|
119
|
+
cp "dist/ifseen${{ matrix.exe }}" LICENSE stage/
|
|
120
|
+
if [ "${{ runner.os }}" = Windows ]; then
|
|
121
|
+
(cd stage && 7z a -tzip "../out/${name}.zip" . >/dev/null)
|
|
122
|
+
else
|
|
123
|
+
tar -C stage -czf "out/${name}.tar.gz" .
|
|
124
|
+
fi
|
|
125
|
+
ls -la out
|
|
126
|
+
- uses: actions/upload-artifact@v4
|
|
127
|
+
with:
|
|
128
|
+
name: bin-${{ matrix.target }}
|
|
129
|
+
path: out/
|
|
130
|
+
if-no-files-found: error
|
|
131
|
+
|
|
132
|
+
npm:
|
|
133
|
+
name: npm package
|
|
134
|
+
needs: [check, python-dist, binaries]
|
|
135
|
+
runs-on: ubuntu-latest
|
|
136
|
+
permissions:
|
|
137
|
+
contents: read
|
|
138
|
+
id-token: write # npm provenance
|
|
139
|
+
env:
|
|
140
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
141
|
+
# setup-node writes a placeholder token when the secret is missing, so test the secret itself
|
|
142
|
+
HAS_NPM_TOKEN: ${{ secrets.NPM_TOKEN != '' }}
|
|
143
|
+
VERSION: ${{ needs.check.outputs.version }}
|
|
144
|
+
defaults:
|
|
145
|
+
run:
|
|
146
|
+
working-directory: js
|
|
147
|
+
steps:
|
|
148
|
+
- uses: actions/checkout@v5
|
|
149
|
+
- uses: actions/setup-python@v6
|
|
150
|
+
with:
|
|
151
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
152
|
+
# the integration tests drive a real `ifseen serve` from ../.venv
|
|
153
|
+
- run: python -m venv ../.venv && ../.venv/bin/pip install -e "..[dev]"
|
|
154
|
+
- uses: actions/setup-node@v5
|
|
155
|
+
with:
|
|
156
|
+
node-version: "22"
|
|
157
|
+
registry-url: "https://registry.npmjs.org"
|
|
158
|
+
- run: npm ci
|
|
159
|
+
- run: npm run typecheck
|
|
160
|
+
- run: npm run build
|
|
161
|
+
- run: npm test
|
|
162
|
+
- run: npm pack --dry-run
|
|
163
|
+
- name: publish
|
|
164
|
+
if: needs.check.outputs.publish == 'true'
|
|
165
|
+
run: |
|
|
166
|
+
if [ "$HAS_NPM_TOKEN" != "true" ]; then
|
|
167
|
+
echo "::notice title=npm skipped::NPM_TOKEN secret not set - publish ifseen@$VERSION by hand (cd js && npm publish --access public)"
|
|
168
|
+
exit 0
|
|
169
|
+
fi
|
|
170
|
+
if [ "$(npm view "ifseen@$VERSION" version 2>/dev/null)" = "$VERSION" ]; then
|
|
171
|
+
echo "::notice title=npm skipped::ifseen@$VERSION is already on npm"
|
|
172
|
+
exit 0
|
|
173
|
+
fi
|
|
174
|
+
npm publish --provenance --access public
|
|
175
|
+
|
|
176
|
+
pypi:
|
|
177
|
+
name: publish to PyPI
|
|
178
|
+
needs: [check, python-dist, binaries]
|
|
179
|
+
if: needs.check.outputs.publish == 'true'
|
|
180
|
+
runs-on: ubuntu-latest
|
|
181
|
+
environment:
|
|
182
|
+
name: pypi
|
|
183
|
+
url: https://pypi.org/project/ifseen/${{ needs.check.outputs.version }}/
|
|
184
|
+
permissions:
|
|
185
|
+
id-token: write # Trusted Publishing, no token
|
|
186
|
+
steps:
|
|
187
|
+
- uses: actions/download-artifact@v4
|
|
188
|
+
with:
|
|
189
|
+
name: python-dist
|
|
190
|
+
path: dist/
|
|
191
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
192
|
+
with:
|
|
193
|
+
skip-existing: true
|
|
194
|
+
|
|
195
|
+
docker:
|
|
196
|
+
name: docker image (amd64 + arm64)
|
|
197
|
+
needs: [check, python-dist, binaries]
|
|
198
|
+
runs-on: ubuntu-latest
|
|
199
|
+
permissions:
|
|
200
|
+
contents: read
|
|
201
|
+
packages: write
|
|
202
|
+
env:
|
|
203
|
+
IMAGE: ghcr.io/krishjoshi/ifseen
|
|
204
|
+
VERSION: ${{ needs.check.outputs.version }}
|
|
205
|
+
steps:
|
|
206
|
+
- uses: actions/checkout@v5
|
|
207
|
+
- uses: docker/setup-qemu-action@v3
|
|
208
|
+
- uses: docker/setup-buildx-action@v3
|
|
209
|
+
- name: build amd64 and smoke test
|
|
210
|
+
uses: docker/build-push-action@v6
|
|
211
|
+
with:
|
|
212
|
+
context: .
|
|
213
|
+
platforms: linux/amd64
|
|
214
|
+
load: true
|
|
215
|
+
tags: ifseen:smoke
|
|
216
|
+
cache-from: type=gha,scope=cli
|
|
217
|
+
cache-to: type=gha,scope=cli,mode=max
|
|
218
|
+
- run: |
|
|
219
|
+
docker run --rm ifseen:smoke --version | grep -F "$VERSION"
|
|
220
|
+
docker run --rm ifseen:smoke recipes | grep -q doorbell
|
|
221
|
+
docker run --rm --entrypoint python ifseen:smoke -c "import cv2, paho.mqtt.client"
|
|
222
|
+
- if: needs.check.outputs.publish == 'true'
|
|
223
|
+
uses: docker/login-action@v3
|
|
224
|
+
with:
|
|
225
|
+
registry: ghcr.io
|
|
226
|
+
username: ${{ github.actor }}
|
|
227
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
228
|
+
- name: build amd64 + arm64${{ needs.check.outputs.publish == 'true' && ' and push' || '' }}
|
|
229
|
+
uses: docker/build-push-action@v6
|
|
230
|
+
with:
|
|
231
|
+
context: .
|
|
232
|
+
platforms: linux/amd64,linux/arm64
|
|
233
|
+
push: ${{ needs.check.outputs.publish == 'true' }}
|
|
234
|
+
tags: |
|
|
235
|
+
${{ env.IMAGE }}:${{ env.VERSION }}
|
|
236
|
+
${{ env.IMAGE }}:latest
|
|
237
|
+
labels: |
|
|
238
|
+
org.opencontainers.image.version=${{ env.VERSION }}
|
|
239
|
+
org.opencontainers.image.revision=${{ github.sha }}
|
|
240
|
+
cache-from: type=gha,scope=cli
|
|
241
|
+
cache-to: type=gha,scope=cli,mode=max
|
|
242
|
+
|
|
243
|
+
ha-addon:
|
|
244
|
+
name: HA add-on image ${{ matrix.arch }}
|
|
245
|
+
needs: [check, python-dist, binaries]
|
|
246
|
+
# Native runner per arch (no QEMU). Plain buildx rather than home-assistant/builder: one
|
|
247
|
+
# Dockerfile, two arches, and we install the wheel built above via a named build context.
|
|
248
|
+
runs-on: ${{ matrix.os }}
|
|
249
|
+
permissions:
|
|
250
|
+
contents: read
|
|
251
|
+
packages: write
|
|
252
|
+
strategy:
|
|
253
|
+
fail-fast: false
|
|
254
|
+
matrix:
|
|
255
|
+
include:
|
|
256
|
+
- { arch: amd64, platform: linux/amd64, os: ubuntu-latest }
|
|
257
|
+
- { arch: aarch64, platform: linux/arm64, os: ubuntu-24.04-arm }
|
|
258
|
+
env:
|
|
259
|
+
IMAGE: ghcr.io/krishjoshi/${{ matrix.arch }}-addon-ifseen
|
|
260
|
+
VERSION: ${{ needs.check.outputs.version }}
|
|
261
|
+
steps:
|
|
262
|
+
- uses: actions/checkout@v5
|
|
263
|
+
- uses: actions/download-artifact@v4
|
|
264
|
+
with:
|
|
265
|
+
name: python-dist
|
|
266
|
+
path: dist/
|
|
267
|
+
- name: base image from build.yaml
|
|
268
|
+
id: base
|
|
269
|
+
run: |
|
|
270
|
+
from="$(sed -n "s/^ ${{ matrix.arch }}:[[:space:]]*\(.*\)$/\1/p" homeassistant/ifseen/build.yaml)"
|
|
271
|
+
test -n "$from" || { echo "no build_from for ${{ matrix.arch }}" >&2; exit 1; }
|
|
272
|
+
echo "from=$from" >> "$GITHUB_OUTPUT"
|
|
273
|
+
rm -f dist/*.tar.gz # only the wheel goes into the image
|
|
274
|
+
- uses: docker/setup-buildx-action@v3
|
|
275
|
+
- name: build
|
|
276
|
+
uses: docker/build-push-action@v6
|
|
277
|
+
with:
|
|
278
|
+
context: homeassistant/ifseen
|
|
279
|
+
build-contexts: wheels=dist
|
|
280
|
+
platforms: ${{ matrix.platform }}
|
|
281
|
+
load: true
|
|
282
|
+
build-args: |
|
|
283
|
+
BUILD_FROM=${{ steps.base.outputs.from }}
|
|
284
|
+
BUILD_ARCH=${{ matrix.arch }}
|
|
285
|
+
BUILD_VERSION=${{ env.VERSION }}
|
|
286
|
+
labels: |
|
|
287
|
+
io.hass.name=ifseen
|
|
288
|
+
io.hass.description=Plain-English triggers for your cameras, as Home Assistant entities over MQTT.
|
|
289
|
+
io.hass.type=addon
|
|
290
|
+
io.hass.arch=${{ matrix.arch }}
|
|
291
|
+
io.hass.version=${{ env.VERSION }}
|
|
292
|
+
org.opencontainers.image.title=ifseen Home Assistant add-on
|
|
293
|
+
org.opencontainers.image.source=https://github.com/KrishJoshi/ifseen
|
|
294
|
+
org.opencontainers.image.version=${{ env.VERSION }}
|
|
295
|
+
tags: |
|
|
296
|
+
${{ env.IMAGE }}:${{ env.VERSION }}
|
|
297
|
+
${{ env.IMAGE }}:latest
|
|
298
|
+
cache-from: type=gha,scope=addon-${{ matrix.arch }}
|
|
299
|
+
cache-to: type=gha,scope=addon-${{ matrix.arch }},mode=max
|
|
300
|
+
- name: smoke test
|
|
301
|
+
run: |
|
|
302
|
+
docker run --rm --entrypoint ifseen "$IMAGE:$VERSION" --version | grep -F "$VERSION"
|
|
303
|
+
docker run --rm --entrypoint /opt/ifseen/bin/python "$IMAGE:$VERSION" -c "import cv2, paho.mqtt.client"
|
|
304
|
+
- if: needs.check.outputs.publish == 'true'
|
|
305
|
+
uses: docker/login-action@v3
|
|
306
|
+
with:
|
|
307
|
+
registry: ghcr.io
|
|
308
|
+
username: ${{ github.actor }}
|
|
309
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
310
|
+
- if: needs.check.outputs.publish == 'true'
|
|
311
|
+
run: |
|
|
312
|
+
docker push "$IMAGE:$VERSION"
|
|
313
|
+
docker push "$IMAGE:latest"
|
|
314
|
+
|
|
315
|
+
github-release:
|
|
316
|
+
name: GitHub release
|
|
317
|
+
needs: [check, python-dist, binaries, npm, docker, ha-addon]
|
|
318
|
+
runs-on: ubuntu-latest
|
|
319
|
+
permissions:
|
|
320
|
+
contents: write
|
|
321
|
+
env:
|
|
322
|
+
VERSION: ${{ needs.check.outputs.version }}
|
|
323
|
+
steps:
|
|
324
|
+
- uses: actions/checkout@v5
|
|
325
|
+
- uses: actions/setup-python@v6
|
|
326
|
+
with:
|
|
327
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
328
|
+
- uses: actions/download-artifact@v4
|
|
329
|
+
with:
|
|
330
|
+
pattern: bin-*
|
|
331
|
+
path: release/
|
|
332
|
+
merge-multiple: true
|
|
333
|
+
- uses: actions/download-artifact@v4
|
|
334
|
+
with:
|
|
335
|
+
name: python-dist
|
|
336
|
+
path: release/
|
|
337
|
+
- name: SHA256SUMS, Homebrew formula, Scoop manifest, notes
|
|
338
|
+
run: |
|
|
339
|
+
(cd release && sha256sum -- * > SHA256SUMS && cat SHA256SUMS)
|
|
340
|
+
python packaging/make_release_files.py --version "$VERSION" --sums release/SHA256SUMS --out manifests
|
|
341
|
+
cp manifests/ifseen.rb manifests/ifseen.json release/
|
|
342
|
+
cat manifests/release-notes.md >> "$GITHUB_STEP_SUMMARY"
|
|
343
|
+
- uses: actions/upload-artifact@v4
|
|
344
|
+
with:
|
|
345
|
+
name: release
|
|
346
|
+
path: |
|
|
347
|
+
release/
|
|
348
|
+
manifests/
|
|
349
|
+
- if: needs.check.outputs.publish == 'true'
|
|
350
|
+
uses: softprops/action-gh-release@v2
|
|
351
|
+
with:
|
|
352
|
+
tag_name: v${{ env.VERSION }}
|
|
353
|
+
name: ifseen ${{ env.VERSION }}
|
|
354
|
+
target_commitish: ${{ github.sha }}
|
|
355
|
+
body_path: manifests/release-notes.md
|
|
356
|
+
generate_release_notes: true
|
|
357
|
+
fail_on_unmatched_files: true
|
|
358
|
+
files: release/*
|
ifseen-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to ifseen. The Home Assistant add-on has its own
|
|
4
|
+
[changelog](homeassistant/ifseen/CHANGELOG.md).
|
|
5
|
+
|
|
6
|
+
## 0.1.0 - unreleased
|
|
7
|
+
|
|
8
|
+
First release.
|
|
9
|
+
|
|
10
|
+
- `ifseen` CLI: plain-English rules over screen, camera, video/RTSP, snapshot URL, image and
|
|
11
|
+
mic sources, with thresholds, `for: N`, cooldowns, hysteresis, change detection and a live
|
|
12
|
+
cost dashboard (`watch`, `test`, `recipes`, `init`, `doctor`).
|
|
13
|
+
- Eleven built-in recipes.
|
|
14
|
+
- Providers: Gemini Decision, TypeSafe Jev, Azure Microsoft-Decision, self-hosted System One,
|
|
15
|
+
OpenAI-compatible models (including Ollama), free on-device SigLIP (`local`), `mock`, and a
|
|
16
|
+
cheap-first-check cascade (`prefilter`).
|
|
17
|
+
- Actions: desktop notifications, speech, shell, webhooks, ntfy with snapshots, saving frames.
|
|
18
|
+
- `ifseen serve`: HTTP API with live server-sent events, plus a Python API (`check`, `Watcher`).
|
|
19
|
+
- MQTT with Home Assistant discovery, and a Home Assistant add-on (prebuilt amd64/aarch64
|
|
20
|
+
images on GHCR).
|
|
21
|
+
- `ifseen` npm package: a typed TypeScript client for one-shot checks and `ifseen serve`.
|
|
22
|
+
- Distribution: PyPI, standalone binaries for macOS (arm64, x86_64), Linux (x86_64, arm64)
|
|
23
|
+
and Windows (x64), `install.sh` / `install.ps1` one-liners, Homebrew tap, Scoop bucket and a
|
|
24
|
+
multi-arch Docker image at `ghcr.io/krishjoshi/ifseen`.
|
ifseen-0.1.0/Dockerfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Headless ifseen for cameras, snapshot URLs and files (no screen or mic inside a container).
|
|
2
|
+
# Built from this source tree; published multi-arch as ghcr.io/krishjoshi/ifseen.
|
|
3
|
+
FROM python:3.12-slim AS build
|
|
4
|
+
WORKDIR /src
|
|
5
|
+
COPY pyproject.toml README.md LICENSE ./
|
|
6
|
+
COPY src ./src
|
|
7
|
+
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /wheels .
|
|
8
|
+
|
|
9
|
+
FROM python:3.12-slim
|
|
10
|
+
LABEL org.opencontainers.image.title="ifseen" \
|
|
11
|
+
org.opencontainers.image.description="Plain-English triggers for your cameras, powered by decision models" \
|
|
12
|
+
org.opencontainers.image.source="https://github.com/KrishJoshi/ifseen" \
|
|
13
|
+
org.opencontainers.image.licenses="MIT"
|
|
14
|
+
# opencv-python-headless still links against glib.
|
|
15
|
+
RUN apt-get update \
|
|
16
|
+
&& apt-get install -y --no-install-recommends libglib2.0-0 \
|
|
17
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
18
|
+
COPY --from=build /wheels /wheels
|
|
19
|
+
RUN whl="$(ls /wheels/ifseen-*.whl)" \
|
|
20
|
+
&& pip install --no-cache-dir "${whl}[camera,mqtt]" \
|
|
21
|
+
&& rm -rf /wheels \
|
|
22
|
+
&& ifseen --version
|
|
23
|
+
|
|
24
|
+
RUN useradd --create-home ifseen
|
|
25
|
+
USER ifseen
|
|
26
|
+
WORKDIR /home/ifseen
|
|
27
|
+
ENV PYTHONUNBUFFERED=1
|
|
28
|
+
ENTRYPOINT ["ifseen"]
|
|
29
|
+
CMD ["--help"]
|
ifseen-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Krish Joshi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|