camera-ui-aqara 2.0.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## 2.0.0
4
+
5
+ - Merged the former **camera-ui-aqara** (local RTSP) and **camera-ui-aqara-cloud** (Aqara Cloud) plugins into one plugin, with independent **Enable Local RTSP** / **Enable Aqara Cloud** toggles so either or both subsystems can run at once.
6
+ - Fixed: local camera discovery used `discover()`; the SDK requires `onDiscoverCameras()`. The manual-add camera entry would not have appeared under the original method name.
7
+ - Fixed: an invalid button `color: 'warning'` (now `'warn'`) on the doorbell-token regenerate button.
8
+ - Fixed: four hidden cloud storage fields (persisted auth tokens) were missing the schema's required `description`.
9
+ - Fixed: cloud sensor registration called `api.sensorManager.addSensor(...)`, which does not exist on the current SDK (`SensorManager` is read-only). Rewrote cloud doorbell/motion sensors to use the SDK's `SensorDiscoveryProvider` adoption flow — they're now adopted from the Sensors page instead of registering themselves automatically.
10
+ - Bumped `@camera.ui/sdk` to `^1.2.38` and `@camera.ui/cli` to `^0.0.106`, the versions this release was verified against (full `tsc` type-check + an actual `cui bundle` run with contract validation).
11
+
12
+ ## Prior history
13
+
14
+ - **camera-ui-aqara 1.0.0** — initial local RTSP plugin (video, snapshots, local doorbell webhook), adapted from [DTse/aqara-scrypted](https://github.com/DTse/aqara-scrypted).
15
+ - **camera-ui-aqara-cloud 1.0.0** — initial Aqara Cloud plugin (Open API auth, HTTP push / bridge SSE, doorbell + motion sensors).
package/LICENSE.md ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 camera-ui-aqara contributors
4
+ Merges the former camera-ui-aqara (local RTSP) and camera-ui-aqara-cloud (Aqara Cloud) plugins.
5
+ Local RTSP subsystem based on aqara-scrypted (MIT) by DTse.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,114 @@
1
+ # Aqara plugin for camera.ui
2
+
3
+ Aqara integration for [camera.ui](https://github.com/seydx/camera.ui): local **RTSP LAN video** (tested against the **Aqara G410**) and **Aqara Cloud** doorbell/motion events, in one plugin with independent switches for each half.
4
+
5
+ This replaces the two separate plugins, **camera-ui-aqara** (local) and **camera-ui-aqara-cloud** (cloud) — see [What changed](#what-changed-from-the-two-original-plugins) if you used either before.
6
+
7
+ ## Features
8
+
9
+ | Feature | Source | Status |
10
+ | --- | --- | --- |
11
+ | Live video (main + substream) | Local | Yes |
12
+ | Snapshots (from main stream) | Local | Yes |
13
+ | Doorbell ring, via local HTTP webhook | Local | Yes |
14
+ | Doorbell ring, via Aqara Cloud push | Cloud | Yes |
15
+ | Motion sensor, via Aqara Cloud push | Cloud | Yes |
16
+ | Two-way audio (talkback) | Local | Not yet (proprietary LAN protocol; planned) |
17
+
18
+ ## Architecture
19
+
20
+ Two subsystems live in one plugin and run independently:
21
+
22
+ - **Local** — adopts a camera by IP + RTSP credentials (`DiscoveryProvider`), gives it video sources, and can run a per-camera HTTP webhook that fires that camera's doorbell sensor.
23
+ - **Cloud** — logs into the Aqara Open API, subscribes to resource events for your devices, and receives them via an HTTP push listener and/or an optional [aqara-rocketmq-bridge](https://github.com/Darkdragon14/aqara-rocketmq-bridge) SSE feed. Matching doorbell/motion sensors are offered for **adoption on the Sensors page**, same as any other externally-sourced sensor — see [Setup → Cloud](#2-cloud-aqara-open-api) below.
24
+
25
+ Both are **on by default** and designed to run together: Local gives you video, Cloud fills in motion detection and a second, no-port-forwarding path to doorbell events. Two settings at the top of the plugin's page — **Enable Local RTSP** and **Enable Aqara Cloud** — let you turn either off independently without losing its configuration. Turning Local off pauses the per-camera doorbell/webhook management (already-configured video keeps streaming, since the host serves it directly from the URLs set at adoption, independent of the plugin process). Turning Cloud off stops the push listener/SSE client and the Aqara API calls; any sensors you'd already adopted stay in camera.ui but go quiet until you turn it back on.
26
+
27
+ ## Prerequisites
28
+
29
+ ### 1. Local (RTSP)
30
+
31
+ 1. The camera must be **hardwired** (RTSP does not work on battery-only models).
32
+ 2. In the **Aqara Home** app: open the camera → Settings → **RTSP LAN Preview** → enable, then copy the generated **username** and **password** and note the camera's LAN IP.
33
+
34
+ ### 2. Cloud (Aqara Open API)
35
+
36
+ 1. An [Aqara Developer](https://developer.aqara.com/) project with **App ID**, **Key ID**, **App Key**.
37
+ 2. Message Push enabled, **User-defined subscription mode**, channel **HTTP Push** (recommended) *or* **Message Queue** + [aqara-rocketmq-bridge](https://github.com/Darkdragon14/aqara-rocketmq-bridge).
38
+
39
+ Both: camera.ui ≥ 2.1.4, Node ≥ 20.19.
40
+
41
+ ## Install
42
+
43
+ ```bash
44
+ unzip camera-ui-aqara.zip
45
+ cd camera-ui-aqara
46
+ npm install
47
+ npm run bundle
48
+ ```
49
+
50
+ Install the resulting bundle into camera.ui (Plugins → Install from file / local package), or copy the `bundle/` output into your camera.ui plugins directory as documented for your install.
51
+
52
+ ## Setup
53
+
54
+ ### 1. Local (RTSP camera)
55
+
56
+ 1. Open **Plugins → Aqara**. Confirm **Enable Local RTSP** is on (it is by default).
57
+ 2. Use **Discover / Add device** and choose **Add Aqara Camera (manual)** — Aqara doesn't expose a LAN discovery protocol, so this is always a manual entry.
58
+ 3. Fill in Name, IP, RTSP username/password, and optional channels / webhook port. Confirm the live preview.
59
+
60
+ The G410 exposes three RTSP channels on port **8554**: `ch1` (main/high-res), `ch2` (medium), `ch3` (sub/low bitrate). Pick main/sub channels when adopting or later in camera settings.
61
+
62
+ **Doorbell webhook:** Aqara's LAN protocol doesn't expose ring events to third parties, so this uses the same webhook approach as the original Scrypted plugin:
63
+
64
+ 1. In the camera's settings, set **Webhook listen port** to a free port on the camera.ui host (e.g. `18789`).
65
+ 2. Note the **Doorbell webhook token** (or click **Regenerate doorbell token**).
66
+ 3. Point any trigger (Home Assistant `rest_command`, a Shortcut, curl) at `http://<camera.ui-host>:<webhookPort>/ring/<token>` — GET or POST both work.
67
+ 4. Or use **Test doorbell ring** in camera settings to fire it locally, no HTTP call needed.
68
+
69
+ ### 2. Cloud (Aqara Open API)
70
+
71
+ 1. Open **Plugins → Aqara**. Confirm **Enable Aqara Cloud** is on.
72
+ 2. Under **Cloud Account**, set **Region**, **App ID**, **Key ID**, **App Key**, **Aqara account**.
73
+ 3. Click **Request auth code** → enter the code from email/SMS into **Auth code** → **Complete login**.
74
+ 4. Click **Refresh devices & subscribe** (this also runs automatically after login and on every restart).
75
+ 5. Under **Cloud Ingress**: for HTTP Push, set **HTTP push port** (e.g. `18080`) and confirm the path (`/aqara/push` by default) — then in the Aqara Developer Console, set the push URL to a **publicly reachable** address pointing at that port (tunnel or port-forward as needed). For the bridge path instead, set **RocketMQ bridge URL** + **Bridge token**. Both can be enabled; events are merged.
76
+ 6. Go to camera.ui's **Sensors** page and **rescan** — a Doorbell and a Motion sensor will be offered for each cloud device found. Adopt the ones you want, then assign them to whichever camera(s) you like.
77
+
78
+ This adoption step is how camera.ui handles any externally-sourced sensor (Home Assistant entities, vendor accounts, etc.) — sensors are never created automatically without you picking them, so they show up as candidates rather than appearing on their own.
79
+
80
+ Default resource IDs: Doorbell `13.95.85` (face/recognition-style event on G410), Motion `3.21.85` + `3.51.85`. Override **Doorbell / Motion resource IDs** and **Extra subscribe resource IDs** under **Cloud Sensors** if your region/model uses different attributes.
81
+
82
+ ## Development
83
+
84
+ ```bash
85
+ npm install
86
+ npm run build # tsc → dist/
87
+ npm run bundle # production bundle via @camera.ui/cli
88
+ npm run bundle:dev # development bundle
89
+ npm run format # prettier
90
+ npm run lint # eslint --fix
91
+ ```
92
+
93
+ ## What changed from the two original plugins
94
+
95
+ This merge was checked against the real `@camera.ui/sdk` (verified at `1.2.38`) and `@camera.ui/cli` (`0.0.106`), including a full `npx tsc` type-check and an actual `cui bundle` run with contract validation. A few things surfaced and were fixed along the way — worth knowing if you had either plugin before:
96
+
97
+ - **Local:** the discovery method was named `discover()`; the SDK expects `onDiscoverCameras()`. As originally written, the "Add Aqara Camera (manual)" entry would never have appeared. Renamed.
98
+ - **Local:** the "Regenerate doorbell token" button used `color: 'warning'`, which isn't a valid value (`'success' | 'info' | 'warn' | 'danger'`). Changed to `'warn'`.
99
+ - **Cloud:** four hidden storage fields (the persisted auth tokens) were missing the `description` the schema type requires. Added.
100
+ - **Cloud, the bigger one:** sensor creation called `api.sensorManager.addSensor(...)`, which doesn't exist — `SensorManager` is read-only (history queries only). Standalone sensors can only be created through the SDK's `SensorDiscoveryProvider` adoption flow. This is now implemented properly: cloud doorbell/motion sensors are discoverable and adopted from the Sensors page (see [Setup → Cloud](#2-cloud-aqara-open-api), step 6) instead of registering themselves the moment a device is found. Functionally this is the same events → sensors pipeline, just routed through the adoption step the SDK actually requires.
101
+ - Bumped the `@camera.ui/sdk` / `@camera.ui/cli` dev dependency versions to the ones this was verified against.
102
+
103
+ If you had both original plugins installed: uninstall them, install this one, then re-adopt your local camera(s) (same RTSP credentials) and re-run the Cloud login + device refresh. Point your Aqara HTTP Push URL at this plugin's push port if it changed.
104
+
105
+ ## Credits
106
+
107
+ - Local RTSP subsystem adapted from the Scrypted plugin [DTse/aqara-scrypted](https://github.com/DTse/aqara-scrypted).
108
+ - Protocol notes from [absent42/aqara-doorbell](https://github.com/absent42/aqara-doorbell) and [Darkdragon14/ha-aqara-devices](https://github.com/Darkdragon14/ha-aqara-devices).
109
+ - Optional SSE ingress compatible with [Darkdragon14/aqara-rocketmq-bridge](https://github.com/Darkdragon14/aqara-rocketmq-bridge).
110
+ - camera.ui SDK: https://cameraui.github.io/sdk/
111
+
112
+ ## License
113
+
114
+ MIT
package/bundle.zip ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "displayName": "Aqara",
3
+ "name": "camera-ui-aqara",
4
+ "version": "2.0.0",
5
+ "description": "Aqara integration for camera.ui: local RTSP LAN video, snapshots, and a doorbell webhook (tested with G410), plus optional Aqara Cloud doorbell/motion sensors via the Open API. Merges the former camera-ui-aqara and camera-ui-aqara-cloud plugins into one, with independent Local/Cloud toggles so either or both can run at once.",
6
+ "author": "Adapted from DTse/aqara-scrypted for camera.ui",
7
+ "type": "commonjs",
8
+ "main": "./dist/index.js",
9
+ "scripts": {
10
+ "build": "rimraf dist && tsc",
11
+ "bundle": "npm run build && cui bundle",
12
+ "bundle:dev": "npm run build && cross-env MODE=development cui bundle",
13
+ "format": "prettier --write \"src/\" --ignore-unknown --no-error-on-unmatched-pattern",
14
+ "lint": "eslint --fix . || true"
15
+ },
16
+ "engines": {
17
+ "camera.ui": ">=2.1.4",
18
+ "node": ">=20.19.0"
19
+ },
20
+ "os": [],
21
+ "cpu": [],
22
+ "keywords": [
23
+ "camera-ui-plugin",
24
+ "aqara",
25
+ "g410",
26
+ "rtsp",
27
+ "doorbell",
28
+ "motion",
29
+ "cloud",
30
+ "open-api"
31
+ ],
32
+ "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/donavanbecker/camera-ui-aqara"
36
+ },
37
+ "cameraui": {
38
+ "protocolLevel": 2
39
+ },
40
+ "files": [
41
+ "bundle.zip",
42
+ "CHANGELOG.md"
43
+ ]
44
+ }