node-red-contrib-alarm-ultimate 0.1.0 → 0.1.1

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.
@@ -32,6 +32,12 @@ module.exports = function (RED) {
32
32
  }
33
33
  lastMode = mode;
34
34
 
35
+ setNodeStatus({
36
+ fill: mode === 'disarmed' ? 'green' : 'red',
37
+ shape: 'dot',
38
+ text: mode === 'disarmed' ? 'Disarmed' : 'Armed',
39
+ });
40
+
35
41
  const msg = {
36
42
  topic: buildTopic(api && api.controlTopic),
37
43
  payload: mode,
@@ -54,7 +60,6 @@ module.exports = function (RED) {
54
60
  }
55
61
  const state = api.getState && typeof api.getState === 'function' ? api.getState() : null;
56
62
  const mode = state && state.state ? state.state.mode : null;
57
- setNodeStatus({ fill: 'green', shape: 'dot', text: `Connected (${mode || 'unknown'})` });
58
63
  emitMode(mode, api, reason);
59
64
  }
60
65
 
@@ -84,4 +89,3 @@ module.exports = function (RED) {
84
89
 
85
90
  RED.nodes.registerType('AlarmUltimateState', AlarmUltimateState);
86
91
  };
87
-
@@ -1,7 +1,7 @@
1
1
  <script type="text/javascript">
2
2
  RED.nodes.registerType("AlarmUltimateZone", {
3
3
  category: "Alarm Ultimate",
4
- color: "#ffb3b3",
4
+ color: "#CFEFF0",
5
5
  defaults: {
6
6
  name: { value: "" },
7
7
  alarmId: { value: "", required: true },
@@ -11,7 +11,7 @@
11
11
  },
12
12
  inputs: 0,
13
13
  outputs: 1,
14
- icon: "font-awesome/fa-bullseye",
14
+ icon: "alarm-ultimate-zone.svg",
15
15
  label: function () {
16
16
  return this.name || "Alarm Zone";
17
17
  },
@@ -65,7 +65,12 @@
65
65
  zoneSelect.empty();
66
66
  zoneSelect.append($("<option></option>").attr("value", "").text("-- select --"));
67
67
  zones.forEach((z) => {
68
- const label = z.name ? `${z.name} (${z.id})` : z.id;
68
+ const topic = z.topic || z.topicPattern || "";
69
+ const label = z.name
70
+ ? topic
71
+ ? `${z.name} (${topic})`
72
+ : z.name
73
+ : topic || z.id;
69
74
  zoneSelect.append($("<option></option>").attr("value", z.id).text(label));
70
75
  });
71
76
  if (this.zoneId) zoneSelect.val(this.zoneId);
@@ -84,7 +89,7 @@
84
89
 
85
90
  <script type="text/html" data-template-name="AlarmUltimateZone">
86
91
  <div class="form-row">
87
- <label>&nbsp;</label>
92
+ <label>WEB PAGE</label>
88
93
  <button type="button" class="red-ui-button" id="node-input-alarm-panel">
89
94
  <i class="fa fa-keyboard-o"></i> Panel
90
95
  </button>
@@ -30,6 +30,16 @@ module.exports = function (RED) {
30
30
  if (lastOpen === open && reason !== 'init') return;
31
31
  lastOpen = open;
32
32
 
33
+ const zoneTopic =
34
+ evt && evt.zone ? evt.zone.topic || evt.zone.topicPattern || null : null;
35
+ const statusLabel = zoneTopic || zoneId || 'zone';
36
+
37
+ setNodeStatus({
38
+ fill: open ? 'red' : 'green',
39
+ shape: 'dot',
40
+ text: `${statusLabel}: ${open ? 'open' : 'closed'}`,
41
+ });
42
+
33
43
  const msg = {
34
44
  topic: buildTopic(evt && evt.controlTopic),
35
45
  payload: open,
@@ -59,8 +69,17 @@ module.exports = function (RED) {
59
69
  setNodeStatus({ fill: 'red', shape: 'ring', text: `Unknown zone (${zoneId})` });
60
70
  return;
61
71
  }
62
- setNodeStatus({ fill: 'green', shape: 'dot', text: `Connected (${zoneId}: ${selected.open ? 'open' : 'closed'})` });
63
- emitZone(Boolean(selected.open), { alarmId, controlTopic: ui.controlTopic, zone: { id: selected.id, name: selected.name, type: selected.type } }, reason);
72
+ emitZone(Boolean(selected.open), {
73
+ alarmId,
74
+ controlTopic: ui.controlTopic,
75
+ zone: {
76
+ id: selected.id,
77
+ name: selected.name,
78
+ type: selected.type,
79
+ topic: selected.topic || null,
80
+ topicPattern: selected.topicPattern || null,
81
+ },
82
+ }, reason);
64
83
  }
65
84
 
66
85
  function onZoneState(evt) {
@@ -88,4 +107,3 @@ module.exports = function (RED) {
88
107
 
89
108
  RED.nodes.registerType('AlarmUltimateZone', AlarmUltimateZone);
90
109
  };
91
-
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" aria-hidden="true">
2
+ <path fill="#fff" d="M20 7c-6.1 0-11 4.9-11 11v3.1l-2.3 5c-.9 2 .5 4.3 2.7 4.3h21.2c2.2 0 3.6-2.3 2.7-4.3l-2.3-5V18c0-6.1-4.9-11-11-11z"/>
3
+ <path fill="#fff" opacity="0.55" d="M20 10.2c-4.3 0-7.8 3.5-7.8 7.8v4.1l-.7 1.5h17l-.7-1.5V18c0-4.3-3.5-7.8-7.8-7.8z"/>
4
+ <path fill="#fff" d="M14.8 31.2c.3 2.7 2.5 4.8 5.2 4.8s4.9-2.1 5.2-4.8H14.8z"/>
5
+ <path fill="#fff" opacity="0.75" d="M6.2 16.8c.6-4.2 3.4-7.7 7.3-9.3l.6 1.5c-3.3 1.4-5.7 4.3-6.2 7.9l-1.7-.1zm27.6 0-1.7.1c-.5-3.6-2.9-6.5-6.2-7.9l.6-1.5c3.9 1.6 6.7 5.1 7.3 9.3z"/>
6
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" aria-hidden="true">
2
+ <path fill="#fff" d="M20 4 32 9v10c0 8.2-5.2 14.7-12 17-6.8-2.3-12-8.8-12-17V9l12-5z"/>
3
+ <path fill="#fff" opacity="0.55" d="M20 9.5 12.5 13v6.5c0 6 3.6 10.6 7.5 12.4 3.9-1.8 7.5-6.4 7.5-12.4V13L20 9.5z"/>
4
+ <path fill="#fff" d="M13.6 22.6h4.2l1.4-5.2 2.4 9 1.1-3.8h3.7v1.8h-2.3l-2.4 8.2-2.4-8.9-1.2 4.7h-5.2v-1.8z"/>
5
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" aria-hidden="true">
2
+ <path fill="#fff" d="M20 6a14 14 0 1 1 0 28 14 14 0 0 1 0-28zm0 3.2a10.8 10.8 0 1 0 0 21.6 10.8 10.8 0 0 0 0-21.6z"/>
3
+ <path fill="#fff" d="M20 14a6 6 0 1 1 0 12 6 6 0 0 1 0-12zm0 3.2a2.8 2.8 0 1 0 0 5.6 2.8 2.8 0 0 0 0-5.6z"/>
4
+ <path fill="#fff" opacity="0.75" d="M20 10.2h1.6v3.2H20zM20 26.6h1.6v3.2H20zM26.6 19.2h3.2v1.6h-3.2zM10.2 19.2h3.2v1.6h-3.2z"/>
5
+ </svg>
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" aria-hidden="true">
2
+ <path fill="#fff" d="M20 4 32 9v10c0 8.2-5.2 14.7-12 17-6.8-2.3-12-8.8-12-17V9l12-5z"/>
3
+ <path fill="#fff" opacity="0.55" d="M20 9.5 12.5 13v6.5c0 6 3.6 10.6 7.5 12.4 3.9-1.8 7.5-6.4 7.5-12.4V13L20 9.5z"/>
4
+ <path fill="#fff" d="M20 13.2 15.2 17v7.6h9.6V17L20 13.2zm-3.2 11.2V18.1L20 15.6l3.2 2.5v6.3h-6.4z"/>
5
+ <path fill="#fff" d="M19.2 19.6h1.6v4.8h-1.6z"/>
6
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-alarm-ultimate",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Alarm System node for Node-RED.",
5
5
  "author": "Supergiovane (https://github.com/Supergiovane)",
6
6
  "license": "MIT",
@@ -30,4 +30,4 @@
30
30
  "scripts": {
31
31
  "test": "mocha test/**/*.spec.js"
32
32
  }
33
- }
33
+ }