@apocaliss92/scrypted-advanced-notifier 4.8.23 → 4.8.26
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.
- package/.github/copilot-instructions.md +50 -0
- package/CHANGELOG.md +3 -0
- package/dist/plugin.zip +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Copilot instructions (Scrypted Advanced Notifier)
|
|
2
|
+
|
|
3
|
+
## Big picture
|
|
4
|
+
- This repo is a Scrypted plugin. The main entrypoint is [src/main.ts](src/main.ts) and it implements multiple Scrypted interfaces (Settings/DeviceProvider/MixinProvider/HttpRequestHandler/VideoClips/PushHandler).
|
|
5
|
+
- Most “real” device behavior lives in mixins:
|
|
6
|
+
- Camera logic in [src/cameraMixin.ts](src/cameraMixin.ts)
|
|
7
|
+
- Notifier logic in [src/notifierMixin.ts](src/notifierMixin.ts)
|
|
8
|
+
- Sensors in [src/sensorMixin.ts](src/sensorMixin.ts) (if you change sensor flows, update MQTT discovery accordingly)
|
|
9
|
+
- MQTT + Home Assistant autodiscovery are centralized in [src/mqtt-utils.ts](src/mqtt-utils.ts). If you add/remove a published value, update both discovery + state publishing.
|
|
10
|
+
- Shared types/constants/helpers are in [src/utils.ts](src/utils.ts) (rule types, activation sources, IDs, limits like `MAX_RPC_OBJECTS_PER_CAMERA`, helper utilities).
|
|
11
|
+
|
|
12
|
+
## Key flows to follow
|
|
13
|
+
- **Settings pattern:** plugin + mixins use `StorageSettingsDict` + `StorageSettings` and often rebuild settings dynamically via `convertSettingsToStorageSettings` (see [src/notifierMixin.ts](src/notifierMixin.ts) and [src/cameraMixin.ts](src/cameraMixin.ts)). When adding a setting, ensure:
|
|
14
|
+
- it has a stable key in the relevant `...SettingKey` union
|
|
15
|
+
- `refreshSettings()` hides/updates dependent settings correctly
|
|
16
|
+
- **MQTT entities:** topics, discovery IDs, and entity naming conventions are owned by `idPrefix` and helpers in [src/mqtt-utils.ts](src/mqtt-utils.ts). Prefer extending existing entity builders over inventing new topic shapes.
|
|
17
|
+
- **Event storage:** detection events are stored as per-day JSON DB files via `node-json-db` in [src/db.ts](src/db.ts). If you change event schema (`DbDetectionEvent`), update writers/readers and any cleanup/retention logic.
|
|
18
|
+
- **Images/media:** snapshots/clips/GIFs are generated and post-processed across camera mixin + drawing utilities. Image filtering uses ffmpeg-based helpers (e.g. `ffmpegFilterImageBuffer`) and post-processing options in [src/utils.ts](src/utils.ts) / [src/drawingUtils.ts](src/drawingUtils.ts).
|
|
19
|
+
|
|
20
|
+
## Repo-specific conventions
|
|
21
|
+
- Device IDs / native IDs are centralized in [src/utils.ts](src/utils.ts) (`NOTIFIER_NATIVE_ID`, `CAMERA_NATIVE_ID`, etc). Reuse these constants.
|
|
22
|
+
- The plugin relies on sibling local packages (not published deps), e.g. `../../scrypted-apocaliss-base/...` and `../../scrypted-frigate-bridge/...` imports. Avoid refactors that break those paths unless you also update the mono-repo layout.
|
|
23
|
+
- Mixins store runtime state in plugin-owned maps (e.g. `currentCameraMixinsMap`, `currentNotifierMixinsMap` in [src/main.ts](src/main.ts)); when creating/releasing devices, keep those maps consistent.
|
|
24
|
+
|
|
25
|
+
## Dev workflows (what to run)
|
|
26
|
+
- Build bundle: `npm run build` (runs `scrypted-webpack`). See [package.json](package.json).
|
|
27
|
+
- Deploy + debug from VS Code: run the task `scrypted: deploy+debug` (it runs `npm run scrypted-vscode-launch`).
|
|
28
|
+
- Production build used for publish: `npm run prepublishOnly`.
|
|
29
|
+
|
|
30
|
+
## Editing tips (to avoid regressions)
|
|
31
|
+
- Prefer small, targeted changes in the relevant layer:
|
|
32
|
+
- rule evaluation/notification behavior → [src/cameraMixin.ts](src/cameraMixin.ts)
|
|
33
|
+
- notifier payload manipulation/translations/AI toggles → [src/notifierMixin.ts](src/notifierMixin.ts)
|
|
34
|
+
- MQTT entity add/remove → [src/mqtt-utils.ts](src/mqtt-utils.ts)
|
|
35
|
+
- Keep defaults + “immediate” settings behavior consistent with existing settings (many toggles are `immediate: true`).
|
|
36
|
+
- Watch for load/size constraints: this plugin enforces soft/hard limits for RPC objects in [src/utils.ts](src/utils.ts).
|
|
37
|
+
|
|
38
|
+
## Quick checklists
|
|
39
|
+
|
|
40
|
+
### When you add/change an MQTT entity
|
|
41
|
+
- Start in [src/mqtt-utils.ts](src/mqtt-utils.ts): extend existing entity builders and keep `idPrefix` naming consistent.
|
|
42
|
+
- Update **both**: Home Assistant autodiscovery config (config topics) and state publishing (state/image topics). Don’t add “publish-only” values.
|
|
43
|
+
- If the entity is per-camera/per-rule, ensure the camera mixin publishes it (see [src/cameraMixin.ts](src/cameraMixin.ts)).
|
|
44
|
+
- If you change entity IDs/names, expect users may need to clear retained discovery/state topics; the plugin also exposes a “Reset all MQTT topics” action (see `mqttResetAllTopics` in [src/main.ts](src/main.ts)).
|
|
45
|
+
|
|
46
|
+
### When you add/change a setting or rule option
|
|
47
|
+
- Add a stable key to the correct `...SettingKey` union (plugin keys in [src/main.ts](src/main.ts), camera keys in [src/cameraMixin.ts](src/cameraMixin.ts), notifier keys in [src/notifierMixin.ts](src/notifierMixin.ts)).
|
|
48
|
+
- Add it to `initStorage` and (if it is conditional) wire it into `refreshSettings()` via `convertSettingsToStorageSettings`.
|
|
49
|
+
- If it should take effect immediately, set `immediate: true` and/or implement `onPut` to trigger the relevant refresh/publish.
|
|
50
|
+
- If it affects MQTT behavior, ensure you also update autodiscovery/publishing paths (see [src/mqtt-utils.ts](src/mqtt-utils.ts)).
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<details>
|
|
2
2
|
<summary>Changelog</summary>
|
|
3
3
|
|
|
4
|
+
### 4.8.26
|
|
5
|
+
- Autolock on alarm system removed, use rule sequences instead
|
|
6
|
+
|
|
4
7
|
### 4.8.5
|
|
5
8
|
- Added topic for each zone + class combination for the total amount of objects detected. Will use frigate data for frigate zones if available
|
|
6
9
|
|
package/dist/plugin.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED