node-red-contrib-alarm-ultimate 0.1.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/LICENSE +22 -0
- package/README.md +73 -0
- package/examples/README.md +21 -0
- package/examples/alarm-ultimate-basic.json +636 -0
- package/examples/alarm-ultimate-dashboard.json +99 -0
- package/nodes/AlarmSystemUltimate.html +697 -0
- package/nodes/AlarmSystemUltimate.js +1418 -0
- package/nodes/AlarmUltimateSiren.html +94 -0
- package/nodes/AlarmUltimateSiren.js +83 -0
- package/nodes/AlarmUltimateState.html +95 -0
- package/nodes/AlarmUltimateState.js +87 -0
- package/nodes/AlarmUltimateZone.html +130 -0
- package/nodes/AlarmUltimateZone.js +91 -0
- package/nodes/lib/alarm-registry.js +15 -0
- package/nodes/lib/node-helpers.js +96 -0
- package/nodes/utils.js +95 -0
- package/package.json +33 -0
- package/test/alarm-system.spec.js +470 -0
- package/test/helpers.js +28 -0
- package/test/output-nodes.spec.js +155 -0
- package/tools/alarm-json-mapper.html +596 -0
- package/tools/alarm-panel.html +728 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Supergiovane
|
|
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.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# node-red-contrib-alarm-ultimate
|
|
2
|
+
|
|
3
|
+
Alarm System Ultimate node for Node-RED.
|
|
4
|
+
|
|
5
|
+
This package provides:
|
|
6
|
+
|
|
7
|
+
- `AlarmSystemUltimate`: a full alarm control panel node (zones, entry/exit delays, bypass, chime, 24h/fire/tamper, siren, event log).
|
|
8
|
+
- Output-only helper nodes to mirror alarm state into your flows (`AlarmUltimateState`, `AlarmUltimateZone`, `AlarmUltimateSiren`).
|
|
9
|
+
- Web tools: a Zones JSON mapper and a web Alarm Panel (also embeddable in Node-RED Dashboard).
|
|
10
|
+
|
|
11
|
+
Note: this repository currently ships `AlarmSystemUltimate` as **BETA**.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Nodes
|
|
15
|
+
|
|
16
|
+
### Alarm System Ultimate (BETA)
|
|
17
|
+
|
|
18
|
+
Main node that:
|
|
19
|
+
|
|
20
|
+
- Receives **control commands** on `msg.topic === controlTopic`
|
|
21
|
+
- Receives **sensor messages** on any other topic and matches them to a configured zone
|
|
22
|
+
|
|
23
|
+
It emits events and state updates on multiple outputs (see the node help in the editor for full details).
|
|
24
|
+
|
|
25
|
+
### Output-only helper nodes
|
|
26
|
+
|
|
27
|
+
These nodes have no input and emit the current Alarm state (and changes) for one configured `AlarmSystemUltimate`:
|
|
28
|
+
|
|
29
|
+
- `Alarm State` (`AlarmUltimateState`): `msg.payload = "armed"|"disarmed"`
|
|
30
|
+
- `Alarm Zone` (`AlarmUltimateZone`): `msg.payload = true|false` for a selected zone
|
|
31
|
+
- `Alarm Siren` (`AlarmUltimateSiren`): `msg.payload = true|false` when the siren is on/off
|
|
32
|
+
|
|
33
|
+
## Web tools
|
|
34
|
+
|
|
35
|
+
These pages are served via the Node-RED admin HTTP endpoint:
|
|
36
|
+
|
|
37
|
+
- Zones JSON Mapper: `/alarm-ultimate/alarm-json-mapper`
|
|
38
|
+
- Alarm Panel: `/alarm-ultimate/alarm-panel`
|
|
39
|
+
|
|
40
|
+
The Alarm Panel supports:
|
|
41
|
+
|
|
42
|
+
- Preselect node: `/alarm-ultimate/alarm-panel?id=<alarmNodeId>`
|
|
43
|
+
- Embed mode (for Dashboard iframes): `/alarm-ultimate/alarm-panel?embed=1&id=<alarmNodeId>`
|
|
44
|
+
|
|
45
|
+
## Examples
|
|
46
|
+
|
|
47
|
+
- `examples/alarm-ultimate-basic.json`: ready-to-import flow with `AlarmSystemUltimate`, injects and debug nodes.
|
|
48
|
+
- `examples/alarm-ultimate-dashboard.json`: Node-RED Dashboard example embedding the Alarm Panel in a `ui_template` iframe.
|
|
49
|
+
|
|
50
|
+
See `examples/README.md`.
|
|
51
|
+
|
|
52
|
+
## Permissions and endpoints
|
|
53
|
+
|
|
54
|
+
When Node-RED authentication is enabled, the admin endpoints use these permissions (if available):
|
|
55
|
+
|
|
56
|
+
- `AlarmSystemUltimate.read`
|
|
57
|
+
- `AlarmSystemUltimate.write`
|
|
58
|
+
|
|
59
|
+
HTTP admin endpoints:
|
|
60
|
+
|
|
61
|
+
- `GET /alarm-ultimate/alarm/nodes`
|
|
62
|
+
- `GET /alarm-ultimate/alarm/:id/state`
|
|
63
|
+
- `POST /alarm-ultimate/alarm/:id/command`
|
|
64
|
+
- `GET /alarm-ultimate/alarm-json-mapper`
|
|
65
|
+
- `GET /alarm-ultimate/alarm-panel`
|
|
66
|
+
|
|
67
|
+
## Development
|
|
68
|
+
|
|
69
|
+
Run tests:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm test
|
|
73
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
## Esempi
|
|
2
|
+
|
|
3
|
+
Importa il flow da `examples/alarm-ultimate-basic.json` in Node-RED:
|
|
4
|
+
|
|
5
|
+
1. Menu → **Import**
|
|
6
|
+
2. Incolla il contenuto del file JSON
|
|
7
|
+
3. Deploy
|
|
8
|
+
|
|
9
|
+
Il flow include:
|
|
10
|
+
|
|
11
|
+
- 1 nodo `AlarmSystemUltimate` con 2 zone di esempio
|
|
12
|
+
- Inject per arm/disarm, bypass, sensori open/close
|
|
13
|
+
- I nodi output-only (`Alarm State`, `Alarm Zone`, `Alarm Siren`) collegati a debug
|
|
14
|
+
|
|
15
|
+
## Dashboard (node-red-dashboard)
|
|
16
|
+
|
|
17
|
+
Importa `examples/alarm-ultimate-dashboard.json`.
|
|
18
|
+
|
|
19
|
+
- Richiede `node-red-dashboard` installato (nodi `ui_*`).
|
|
20
|
+
- Il widget usa un iframe verso `"/alarm-ultimate/alarm-panel?embed=1&id=<alarmNodeId>"`.
|
|
21
|
+
- Se hai cambiato `httpAdminRoot`, aggiorna l'URL dell'iframe di conseguenza (es: `"/red/alarm-ultimate/alarm-panel?...`).
|