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.
Files changed (219) hide show
  1. ifseen-0.1.0/.github/workflows/ci.yml +51 -0
  2. ifseen-0.1.0/.github/workflows/release.yml +358 -0
  3. ifseen-0.1.0/.gitignore +11 -0
  4. ifseen-0.1.0/CHANGELOG.md +24 -0
  5. ifseen-0.1.0/Dockerfile +29 -0
  6. ifseen-0.1.0/LICENSE +21 -0
  7. ifseen-0.1.0/PKG-INFO +556 -0
  8. ifseen-0.1.0/README.md +502 -0
  9. ifseen-0.1.0/benchmarks/birds-results.md +57 -0
  10. ifseen-0.1.0/benchmarks/birds.py +415 -0
  11. ifseen-0.1.0/benchmarks/hard-rules-results.md +163 -0
  12. ifseen-0.1.0/benchmarks/hard_rules.py +542 -0
  13. ifseen-0.1.0/benchmarks/hard_rules_screens.py +419 -0
  14. ifseen-0.1.0/docker/.env.example +25 -0
  15. ifseen-0.1.0/docker/compose.yaml +46 -0
  16. ifseen-0.1.0/docker/rules/doorbell.yaml +26 -0
  17. ifseen-0.1.0/docs/.nojekyll +0 -0
  18. ifseen-0.1.0/docs/api.md +342 -0
  19. ifseen-0.1.0/docs/assets/app.js +454 -0
  20. ifseen-0.1.0/docs/assets/mosaic.svg +15 -0
  21. ifseen-0.1.0/docs/assets/style.css +889 -0
  22. ifseen-0.1.0/docs/dashboard.svg +120 -0
  23. ifseen-0.1.0/docs/docker.md +114 -0
  24. ifseen-0.1.0/docs/homeassistant.md +385 -0
  25. ifseen-0.1.0/docs/index.html +1174 -0
  26. ifseen-0.1.0/docs/install.ps1 +98 -0
  27. ifseen-0.1.0/docs/install.sh +130 -0
  28. ifseen-0.1.0/docs/media/README.md +156 -0
  29. ifseen-0.1.0/docs/media/clips/desk-poster.webp +0 -0
  30. ifseen-0.1.0/docs/media/clips/desk.mp4 +0 -0
  31. ifseen-0.1.0/docs/media/clips/desk.webm +0 -0
  32. ifseen-0.1.0/docs/media/clips/dog-poster.webp +0 -0
  33. ifseen-0.1.0/docs/media/clips/dog.mp4 +0 -0
  34. ifseen-0.1.0/docs/media/clips/dog.webm +0 -0
  35. ifseen-0.1.0/docs/media/clips/hivis-poster.webp +0 -0
  36. ifseen-0.1.0/docs/media/clips/hivis.mp4 +0 -0
  37. ifseen-0.1.0/docs/media/clips/hivis.webm +0 -0
  38. ifseen-0.1.0/docs/media/clips/hob-poster.webp +0 -0
  39. ifseen-0.1.0/docs/media/clips/hob.mp4 +0 -0
  40. ifseen-0.1.0/docs/media/clips/hob.webm +0 -0
  41. ifseen-0.1.0/docs/media/clips/parcel-poster.webp +0 -0
  42. ifseen-0.1.0/docs/media/clips/parcel.mp4 +0 -0
  43. ifseen-0.1.0/docs/media/clips/parcel.webm +0 -0
  44. ifseen-0.1.0/docs/media/data/stills.jsonl +17 -0
  45. ifseen-0.1.0/docs/media/data/usecases.jsonl +24 -0
  46. ifseen-0.1.0/docs/media/data/watch_desk.jsonl +18 -0
  47. ifseen-0.1.0/docs/media/data/watch_dog.jsonl +18 -0
  48. ifseen-0.1.0/docs/media/data/watch_hivis.jsonl +19 -0
  49. ifseen-0.1.0/docs/media/data/watch_hivis_jev.jsonl +19 -0
  50. ifseen-0.1.0/docs/media/data/watch_hob.jsonl +19 -0
  51. ifseen-0.1.0/docs/media/data/watch_hob_jev.jsonl +19 -0
  52. ifseen-0.1.0/docs/media/data/watch_parcel.jsonl +18 -0
  53. ifseen-0.1.0/docs/media/hero-poster.webp +0 -0
  54. ifseen-0.1.0/docs/media/hero.gif +0 -0
  55. ifseen-0.1.0/docs/media/hero.mp4 +0 -0
  56. ifseen-0.1.0/docs/media/hero.webm +0 -0
  57. ifseen-0.1.0/docs/media/rules/appliance.yaml +14 -0
  58. ifseen-0.1.0/docs/media/rules/clip_desk.yaml +17 -0
  59. ifseen-0.1.0/docs/media/rules/clip_dog.yaml +17 -0
  60. ifseen-0.1.0/docs/media/rules/clip_hivis.yaml +18 -0
  61. ifseen-0.1.0/docs/media/rules/clip_hob.yaml +18 -0
  62. ifseen-0.1.0/docs/media/rules/clip_parcel.yaml +17 -0
  63. ifseen-0.1.0/docs/media/rules/desk.yaml +18 -0
  64. ifseen-0.1.0/docs/media/rules/doorbell.yaml +13 -0
  65. ifseen-0.1.0/docs/media/rules/hivis.yaml +14 -0
  66. ifseen-0.1.0/docs/media/rules/hmi.yaml +13 -0
  67. ifseen-0.1.0/docs/media/rules/hob.yaml +19 -0
  68. ifseen-0.1.0/docs/media/rules/kitchen.yaml +13 -0
  69. ifseen-0.1.0/docs/media/rules/meeting-room.yaml +13 -0
  70. ifseen-0.1.0/docs/media/rules/office-printer.yaml +13 -0
  71. ifseen-0.1.0/docs/media/rules/pet.yaml +10 -0
  72. ifseen-0.1.0/docs/media/rules/printer3d.yaml +13 -0
  73. ifseen-0.1.0/docs/media/rules/reception.yaml +13 -0
  74. ifseen-0.1.0/docs/media/rules/shelf.yaml +14 -0
  75. ifseen-0.1.0/docs/media/stills/bay-empty.webp +0 -0
  76. ifseen-0.1.0/docs/media/stills/bay-hivis.webp +0 -0
  77. ifseen-0.1.0/docs/media/stills/bay-nohivis.webp +0 -0
  78. ifseen-0.1.0/docs/media/stills/dog-couch.webp +0 -0
  79. ifseen-0.1.0/docs/media/stills/dog-floor.webp +0 -0
  80. ifseen-0.1.0/docs/media/stills/door-empty.webp +0 -0
  81. ifseen-0.1.0/docs/media/stills/door-parcel.webp +0 -0
  82. ifseen-0.1.0/docs/media/stills/hmi-alarm.webp +0 -0
  83. ifseen-0.1.0/docs/media/stills/hmi-normal.webp +0 -0
  84. ifseen-0.1.0/docs/media/stills/hob-cooking.webp +0 -0
  85. ifseen-0.1.0/docs/media/stills/hob-off.webp +0 -0
  86. ifseen-0.1.0/docs/media/stills/hob-unattended.webp +0 -0
  87. ifseen-0.1.0/docs/media/stills/laptop-locked.webp +0 -0
  88. ifseen-0.1.0/docs/media/stills/laptop-person.webp +0 -0
  89. ifseen-0.1.0/docs/media/stills/laptop-unlocked.webp +0 -0
  90. ifseen-0.1.0/docs/media/stills/pot-boilover.webp +0 -0
  91. ifseen-0.1.0/docs/media/stills/pot-simmer.webp +0 -0
  92. ifseen-0.1.0/docs/media/stills/print-fail.webp +0 -0
  93. ifseen-0.1.0/docs/media/stills/print-good.webp +0 -0
  94. ifseen-0.1.0/docs/media/stills/printer-jam.webp +0 -0
  95. ifseen-0.1.0/docs/media/stills/printer-ready.webp +0 -0
  96. ifseen-0.1.0/docs/media/stills/reception-empty.webp +0 -0
  97. ifseen-0.1.0/docs/media/stills/reception-visitor.webp +0 -0
  98. ifseen-0.1.0/docs/media/stills/room-empty.webp +0 -0
  99. ifseen-0.1.0/docs/media/stills/room-occupied.webp +0 -0
  100. ifseen-0.1.0/docs/media/stills/shelf-full.webp +0 -0
  101. ifseen-0.1.0/docs/media/stills/shelf-gap.webp +0 -0
  102. ifseen-0.1.0/docs/media/stills/washer-done.webp +0 -0
  103. ifseen-0.1.0/docs/media/stills/washer-running.webp +0 -0
  104. ifseen-0.1.0/examples/home-assistant-mqtt.yaml +22 -0
  105. ifseen-0.1.0/examples/home-assistant.yaml +16 -0
  106. ifseen-0.1.0/examples/watch-my-printer.yaml +23 -0
  107. ifseen-0.1.0/homeassistant/ifseen/CHANGELOG.md +7 -0
  108. ifseen-0.1.0/homeassistant/ifseen/DOCS.md +92 -0
  109. ifseen-0.1.0/homeassistant/ifseen/Dockerfile +35 -0
  110. ifseen-0.1.0/homeassistant/ifseen/README.md +13 -0
  111. ifseen-0.1.0/homeassistant/ifseen/build.yaml +7 -0
  112. ifseen-0.1.0/homeassistant/ifseen/config.yaml +45 -0
  113. ifseen-0.1.0/homeassistant/ifseen/icon.png +0 -0
  114. ifseen-0.1.0/homeassistant/ifseen/logo.png +0 -0
  115. ifseen-0.1.0/homeassistant/ifseen/rootfs/usr/bin/ifseen-addon-config +64 -0
  116. ifseen-0.1.0/homeassistant/ifseen/rootfs/usr/share/ifseen/example.yaml +20 -0
  117. ifseen-0.1.0/homeassistant/ifseen/run.sh +86 -0
  118. ifseen-0.1.0/homeassistant/ifseen/translations/en.yaml +40 -0
  119. ifseen-0.1.0/js/.gitignore +4 -0
  120. ifseen-0.1.0/js/LICENSE +21 -0
  121. ifseen-0.1.0/js/README.md +234 -0
  122. ifseen-0.1.0/js/examples/check-image.ts +39 -0
  123. ifseen-0.1.0/js/examples/on-fire.ts +17 -0
  124. ifseen-0.1.0/js/examples/tsconfig.json +9 -0
  125. ifseen-0.1.0/js/examples/watch-events.ts +61 -0
  126. ifseen-0.1.0/js/package-lock.json +51 -0
  127. ifseen-0.1.0/js/package.json +65 -0
  128. ifseen-0.1.0/js/src/check.ts +131 -0
  129. ifseen-0.1.0/js/src/client.ts +463 -0
  130. ifseen-0.1.0/js/src/constants.ts +50 -0
  131. ifseen-0.1.0/js/src/errors.ts +47 -0
  132. ifseen-0.1.0/js/src/http.ts +180 -0
  133. ifseen-0.1.0/js/src/index.ts +30 -0
  134. ifseen-0.1.0/js/src/media.ts +260 -0
  135. ifseen-0.1.0/js/src/providers.ts +292 -0
  136. ifseen-0.1.0/js/src/rules.ts +123 -0
  137. ifseen-0.1.0/js/src/sse.ts +114 -0
  138. ifseen-0.1.0/js/src/types.ts +329 -0
  139. ifseen-0.1.0/js/test/fixtures/blue.png +0 -0
  140. ifseen-0.1.0/js/test/fixtures/red.jpg +0 -0
  141. ifseen-0.1.0/js/test/fixtures/small-green.jpg +0 -0
  142. ifseen-0.1.0/js/test/fixtures/tone.wav +0 -0
  143. ifseen-0.1.0/js/test/helpers.ts +131 -0
  144. ifseen-0.1.0/js/test/integration-fake.test.ts +65 -0
  145. ifseen-0.1.0/js/test/integration-serve.test.ts +257 -0
  146. ifseen-0.1.0/js/test/unit-client.test.ts +110 -0
  147. ifseen-0.1.0/js/test/unit-media.test.ts +64 -0
  148. ifseen-0.1.0/js/test/unit-providers.test.ts +241 -0
  149. ifseen-0.1.0/js/test/unit-rules.test.ts +60 -0
  150. ifseen-0.1.0/js/test/unit-sse.test.ts +208 -0
  151. ifseen-0.1.0/js/tsconfig.build.json +12 -0
  152. ifseen-0.1.0/js/tsconfig.json +19 -0
  153. ifseen-0.1.0/js/tsconfig.test.json +9 -0
  154. ifseen-0.1.0/packaging/check_versions.py +55 -0
  155. ifseen-0.1.0/packaging/ifseen.spec +56 -0
  156. ifseen-0.1.0/packaging/ifseen_entry.py +8 -0
  157. ifseen-0.1.0/packaging/make_release_files.py +79 -0
  158. ifseen-0.1.0/packaging/smoke.sh +56 -0
  159. ifseen-0.1.0/packaging/templates/ifseen.json.tmpl +27 -0
  160. ifseen-0.1.0/packaging/templates/ifseen.rb.tmpl +46 -0
  161. ifseen-0.1.0/packaging/templates/release-notes.md.tmpl +39 -0
  162. ifseen-0.1.0/pyproject.toml +71 -0
  163. ifseen-0.1.0/repository.yaml +5 -0
  164. ifseen-0.1.0/scripts/render_dashboard_svg.py +127 -0
  165. ifseen-0.1.0/src/ifseen/__init__.py +29 -0
  166. ifseen-0.1.0/src/ifseen/__main__.py +5 -0
  167. ifseen-0.1.0/src/ifseen/actions.py +348 -0
  168. ifseen-0.1.0/src/ifseen/cli.py +612 -0
  169. ifseen-0.1.0/src/ifseen/config.py +443 -0
  170. ifseen-0.1.0/src/ifseen/constants.py +160 -0
  171. ifseen-0.1.0/src/ifseen/engine.py +357 -0
  172. ifseen-0.1.0/src/ifseen/ha.py +272 -0
  173. ifseen-0.1.0/src/ifseen/media.py +127 -0
  174. ifseen-0.1.0/src/ifseen/mqtt.py +399 -0
  175. ifseen-0.1.0/src/ifseen/oneshot.py +211 -0
  176. ifseen-0.1.0/src/ifseen/providers/__init__.py +219 -0
  177. ifseen-0.1.0/src/ifseen/providers/base.py +176 -0
  178. ifseen-0.1.0/src/ifseen/providers/gemini.py +73 -0
  179. ifseen-0.1.0/src/ifseen/providers/llm.py +110 -0
  180. ifseen-0.1.0/src/ifseen/providers/local.py +157 -0
  181. ifseen-0.1.0/src/ifseen/providers/mock.py +48 -0
  182. ifseen-0.1.0/src/ifseen/providers/systemone.py +80 -0
  183. ifseen-0.1.0/src/ifseen/recipes/__init__.py +31 -0
  184. ifseen-0.1.0/src/ifseen/recipes/appliance-done.yaml +19 -0
  185. ifseen-0.1.0/src/ifseen/recipes/baby-monitor.yaml +37 -0
  186. ifseen-0.1.0/src/ifseen/recipes/doorbell.yaml +27 -0
  187. ifseen-0.1.0/src/ifseen/recipes/focus-guard.yaml +19 -0
  188. ifseen-0.1.0/src/ifseen/recipes/kitchen.yaml +43 -0
  189. ifseen-0.1.0/src/ifseen/recipes/legacy-screen-alarm.yaml +20 -0
  190. ifseen-0.1.0/src/ifseen/recipes/meeting-radar.yaml +26 -0
  191. ifseen-0.1.0/src/ifseen/recipes/pet-patrol.yaml +22 -0
  192. ifseen-0.1.0/src/ifseen/recipes/print-failure.yaml +28 -0
  193. ifseen-0.1.0/src/ifseen/recipes/shelf-restock.yaml +18 -0
  194. ifseen-0.1.0/src/ifseen/recipes/warehouse-safety.yaml +26 -0
  195. ifseen-0.1.0/src/ifseen/runtime.py +105 -0
  196. ifseen-0.1.0/src/ifseen/server.py +661 -0
  197. ifseen-0.1.0/src/ifseen/sources/__init__.py +47 -0
  198. ifseen-0.1.0/src/ifseen/sources/base.py +72 -0
  199. ifseen-0.1.0/src/ifseen/sources/camera.py +115 -0
  200. ifseen-0.1.0/src/ifseen/sources/file.py +110 -0
  201. ifseen-0.1.0/src/ifseen/sources/mic.py +69 -0
  202. ifseen-0.1.0/src/ifseen/sources/screen.py +51 -0
  203. ifseen-0.1.0/src/ifseen/sources/url.py +51 -0
  204. ifseen-0.1.0/src/ifseen/ui.py +194 -0
  205. ifseen-0.1.0/src/ifseen/watcher.py +780 -0
  206. ifseen-0.1.0/tests/conftest.py +63 -0
  207. ifseen-0.1.0/tests/fake_server.py +213 -0
  208. ifseen-0.1.0/tests/test_actions.py +163 -0
  209. ifseen-0.1.0/tests/test_api.py +383 -0
  210. ifseen-0.1.0/tests/test_api_key.py +95 -0
  211. ifseen-0.1.0/tests/test_cli.py +385 -0
  212. ifseen-0.1.0/tests/test_config.py +183 -0
  213. ifseen-0.1.0/tests/test_engine.py +379 -0
  214. ifseen-0.1.0/tests/test_local.py +135 -0
  215. ifseen-0.1.0/tests/test_media.py +34 -0
  216. ifseen-0.1.0/tests/test_mqtt.py +704 -0
  217. ifseen-0.1.0/tests/test_mqtt_broker.py +184 -0
  218. ifseen-0.1.0/tests/test_providers.py +295 -0
  219. 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/*
@@ -0,0 +1,11 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ dist/
7
+ build/
8
+ *.egg-info/
9
+ ifseen-captures/
10
+ ifseen.yaml
11
+ .env
@@ -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`.
@@ -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.