@avantics/node-red-home-automation 5.0.0 → 6.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/README.md +413 -77
- package/contract-examples/room-lighting.mjs +39 -27
- package/dist/lib/activity-lighting-controller.d.ts +7 -2
- package/dist/lib/activity-lighting-controller.js +75 -16
- package/dist/lib/avr-controller.d.ts +2 -2
- package/dist/lib/avr-controller.js +21 -26
- package/dist/lib/circadian-policy.d.ts +47 -0
- package/dist/lib/circadian-policy.js +111 -0
- package/dist/lib/circadian-publishing.d.ts +33 -0
- package/dist/lib/circadian-publishing.js +154 -0
- package/dist/lib/circadian-schedule.d.ts +4 -0
- package/dist/lib/circadian-schedule.js +12 -0
- package/dist/lib/command-echo.d.ts +8 -1
- package/dist/lib/command-echo.js +37 -6
- package/dist/lib/cover-controller.js +4 -0
- package/dist/lib/denon-protocol.js +3 -2
- package/dist/lib/enable-input.d.ts +3 -0
- package/dist/lib/enable-input.js +18 -0
- package/dist/lib/house-schedule.js +2 -2
- package/dist/lib/light-contract.d.ts +53 -0
- package/dist/lib/light-contract.js +11 -0
- package/dist/lib/motion-policy.d.ts +0 -1
- package/dist/lib/motion-policy.js +9 -8
- package/dist/lib/motion-publishing.js +2 -1
- package/dist/lib/mqtt-message.d.ts +6 -0
- package/dist/lib/mqtt-message.js +21 -0
- package/dist/lib/room-controller.d.ts +41 -27
- package/dist/lib/room-controller.js +422 -213
- package/dist/lib/room-holds.d.ts +34 -0
- package/dist/lib/room-holds.js +66 -0
- package/dist/lib/room-lighting-discovery.d.ts +0 -14
- package/dist/lib/room-lighting-discovery.js +19 -125
- package/dist/lib/room-publishing.d.ts +7 -12
- package/dist/lib/room-publishing.js +65 -125
- package/dist/lib/shelly-cover.d.ts +2 -4
- package/dist/lib/shelly-cover.js +30 -70
- package/dist/lib/shelly-gen2.d.ts +25 -0
- package/dist/lib/shelly-gen2.js +58 -0
- package/dist/lib/shelly-switch.d.ts +95 -0
- package/dist/lib/shelly-switch.js +237 -0
- package/dist/lib/theatre-state-contract.js +12 -4
- package/dist/lib/z2m-cover.d.ts +49 -0
- package/dist/lib/z2m-cover.js +120 -0
- package/dist/lib/z2m-light-adapter.d.ts +62 -0
- package/dist/lib/z2m-light-adapter.js +195 -0
- package/dist/lib/z2m-light.d.ts +2 -2
- package/dist/lib/z2m-light.js +11 -14
- package/dist/nodes/activity-lighting-controller.html +15 -6
- package/dist/nodes/activity-lighting-controller.js +21 -0
- package/dist/nodes/adapter.d.ts +5 -1
- package/dist/nodes/adapter.js +35 -2
- package/dist/nodes/avr-controller.html +20 -18
- package/dist/nodes/avr-controller.js +5 -5
- package/dist/nodes/circadian-policy.d.ts +3 -0
- package/dist/nodes/circadian-policy.html +145 -0
- package/dist/nodes/circadian-policy.js +162 -0
- package/dist/nodes/cover-controller.html +9 -3
- package/dist/nodes/cover-controller.js +1 -1
- package/dist/nodes/display-mode-controller.html +14 -17
- package/dist/nodes/display-mode-controller.js +4 -1
- package/dist/nodes/house-schedule-mqtt.html +5 -0
- package/dist/nodes/house-schedule-mqtt.js +1 -1
- package/dist/nodes/house-schedule.html +3 -3
- package/dist/nodes/motion-policy.html +10 -2
- package/dist/nodes/motion-policy.js +4 -1
- package/dist/nodes/occupancy-fusion.html +5 -0
- package/dist/nodes/occupancy-fusion.js +1 -1
- package/dist/nodes/refused-enable.d.ts +7 -0
- package/dist/nodes/refused-enable.js +24 -0
- package/dist/nodes/room-controller.html +232 -85
- package/dist/nodes/room-controller.js +71 -97
- package/dist/nodes/shelly-switch.d.ts +3 -0
- package/dist/nodes/shelly-switch.html +87 -0
- package/dist/nodes/shelly-switch.js +48 -0
- package/dist/nodes/theatre-state-contract.html +9 -3
- package/dist/nodes/theatre-state-contract.js +1 -1
- package/dist/nodes/z2m-cover.d.ts +3 -0
- package/dist/nodes/z2m-cover.html +68 -0
- package/dist/nodes/z2m-cover.js +41 -0
- package/dist/nodes/z2m-light.d.ts +3 -0
- package/dist/nodes/z2m-light.html +76 -0
- package/dist/nodes/z2m-light.js +51 -0
- package/examples/Cover control.json +28 -71
- package/examples/Home theatre activity.json +53 -19
- package/examples/House schedule.json +106 -24
- package/examples/Room lighting.json +57 -25
- package/examples/Shelly cover.json +5 -16
- package/examples/Shelly switch.json +197 -0
- package/package.json +12 -4
- package/dist/lib/room-schedule.d.ts +0 -8
- package/dist/lib/room-schedule.js +0 -41
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const z2m_light_adapter_1 = require("../lib/z2m-light-adapter");
|
|
3
|
+
const adapter_1 = require("./adapter");
|
|
4
|
+
const registerZ2mLight = (RED) => {
|
|
5
|
+
function HomeZ2mLight(config) {
|
|
6
|
+
RED.nodes.createNode(this, config);
|
|
7
|
+
const node = this;
|
|
8
|
+
let light;
|
|
9
|
+
try {
|
|
10
|
+
light = (0, z2m_light_adapter_1.normaliseZ2mLightConfig)(config);
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
(0, adapter_1.invalidConfig)(node, error);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const trace = { area: "", component: "z2m-light" };
|
|
17
|
+
node.status({ fill: "grey", shape: "ring", text: light.group ? "group · waiting for its state" : "waiting for the device" });
|
|
18
|
+
(0, adapter_1.onInput)(node, (msg, send) => {
|
|
19
|
+
const result = (0, adapter_1.runReducer)(node, trace, (saved, now) => {
|
|
20
|
+
const decided = (0, z2m_light_adapter_1.transitionZ2mLight)(saved, msg, light, now);
|
|
21
|
+
// Another light's command: nothing to keep or trace, and the result
|
|
22
|
+
// still says it was ignored.
|
|
23
|
+
return decided.ignored ? { ...decided, state: saved ?? decided.state, traces: [] } : decided;
|
|
24
|
+
});
|
|
25
|
+
if (result.ignored)
|
|
26
|
+
return;
|
|
27
|
+
// MQTT publications for the device on output 1, for an MQTT out node;
|
|
28
|
+
// readings for the room controller on output 2.
|
|
29
|
+
const outputs = [
|
|
30
|
+
result.publications.length ? result.publications.map((publication) => ({ ...publication })) : null,
|
|
31
|
+
result.readings.length ? result.readings.map((reading) => ({ payload: undefined, light: reading })) : null
|
|
32
|
+
];
|
|
33
|
+
if (outputs.some((output) => output !== null))
|
|
34
|
+
send(outputs);
|
|
35
|
+
const state = result.state;
|
|
36
|
+
if (state.online === false) {
|
|
37
|
+
node.status({ fill: "grey", shape: "ring", text: "offline" });
|
|
38
|
+
}
|
|
39
|
+
else if (state.report) {
|
|
40
|
+
const values = [
|
|
41
|
+
typeof state.report.brightness === "number" ? Math.round(state.report.brightness * 100 / 254) + "%" : "",
|
|
42
|
+
typeof state.report.color_temp === "number" && state.report.color_temp > 0 ? Math.round(1_000_000 / state.report.color_temp) + "K" : ""
|
|
43
|
+
].filter(Boolean).join(" ");
|
|
44
|
+
node.status({ fill: state.report.on ? "green" : "grey", shape: "dot", text: (state.report.on ? "on" : "off") + (state.report.on && values ? " · " + values : "") });
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
RED.nodes.registerType("home-z2m-light", HomeZ2mLight);
|
|
49
|
+
};
|
|
50
|
+
module.exports = registerZ2mLight;
|
|
51
|
+
//# sourceMappingURL=z2m-light.js.map
|
|
@@ -3,27 +3,16 @@
|
|
|
3
3
|
"id": "example-cover-control-cover-control-example",
|
|
4
4
|
"type": "comment",
|
|
5
5
|
"name": "Cover control example",
|
|
6
|
-
"info": "A position cover (blind, shutter or curtain motor) owned by the cover controller. Requests go in as \"open\", \"close\", \"stop\", a position from 0 to 100, or a preset name; an automatic target sets respectManual so a person's move holds. The
|
|
6
|
+
"info": "A position cover (blind, shutter or curtain motor) owned by the cover controller. Requests go in as \"open\", \"close\", \"stop\", a position from 0 to 100, or a preset name; an automatic target sets respectManual so a person's move holds. The Zigbee2MQTT cover adapter maps to and from a Zigbee2MQTT cover: set its friendly name, feed it from MQTT in nodes on the cover's topic and its availability topic, and wire its first output to an MQTT out node. A button can stop the cover if it is moving and open it otherwise, and the cover's availability report keeps requests from going to an offline device. Output 3 says whether the cover is moving, for other policies to react to. Here it pauses motion lighting while the cover moves, through the motion policy's pause input, which never touches the user's own enable.\n\nThe \"MQTT out connected\" status node sends the cover controller its startup message each time an MQTT out node connects to the broker, so what it announces reaches it: the broker drops anything sent before it connects. It watches every node on this flow, and the nodes act only on an MQTT out node's connected status; you can scope it to your MQTT out node instead.",
|
|
7
7
|
"x": 170,
|
|
8
8
|
"y": 40,
|
|
9
9
|
"wires": []
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
"id": "example-cover-control-
|
|
13
|
-
"type": "
|
|
14
|
-
"name": "
|
|
15
|
-
"
|
|
16
|
-
{
|
|
17
|
-
"p": "cover",
|
|
18
|
-
"v": "{\"kind\":\"startup\"}",
|
|
19
|
-
"vt": "json"
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
"repeat": "",
|
|
23
|
-
"crontab": "",
|
|
24
|
-
"once": true,
|
|
25
|
-
"onceDelay": 3,
|
|
26
|
-
"topic": "",
|
|
12
|
+
"id": "example-cover-control-mqtt-connected",
|
|
13
|
+
"type": "status",
|
|
14
|
+
"name": "MQTT out connected",
|
|
15
|
+
"scope": null,
|
|
27
16
|
"x": 130,
|
|
28
17
|
"y": 100,
|
|
29
18
|
"wires": [
|
|
@@ -136,41 +125,43 @@
|
|
|
136
125
|
{
|
|
137
126
|
"id": "example-cover-control-report",
|
|
138
127
|
"type": "inject",
|
|
139
|
-
"name": "state report from the cover",
|
|
128
|
+
"name": "state report from the cover (MQTT in)",
|
|
140
129
|
"props": [
|
|
141
130
|
{
|
|
142
131
|
"p": "payload",
|
|
143
132
|
"v": "{\"position\":60,\"motor_state\":\"stopped\",\"battery\":87,\"charging_status\":\"false\"}",
|
|
144
133
|
"vt": "json"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"p": "topic",
|
|
137
|
+
"vt": "str"
|
|
145
138
|
}
|
|
146
139
|
],
|
|
147
140
|
"repeat": "",
|
|
148
141
|
"crontab": "",
|
|
149
142
|
"once": false,
|
|
150
143
|
"onceDelay": 0.1,
|
|
151
|
-
"topic": "",
|
|
144
|
+
"topic": "zigbee2mqtt/<your cover>",
|
|
152
145
|
"x": 180,
|
|
153
146
|
"y": 320,
|
|
154
147
|
"wires": [
|
|
155
148
|
[
|
|
156
|
-
"example-cover-control-
|
|
149
|
+
"example-cover-control-adapter"
|
|
157
150
|
]
|
|
158
151
|
]
|
|
159
152
|
},
|
|
160
153
|
{
|
|
161
|
-
"id": "example-cover-control-
|
|
162
|
-
"type": "
|
|
163
|
-
"name": "
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"timeout": 0,
|
|
167
|
-
"noerr": 0,
|
|
168
|
-
"initialize": "",
|
|
169
|
-
"finalize": "",
|
|
170
|
-
"libs": [],
|
|
154
|
+
"id": "example-cover-control-adapter",
|
|
155
|
+
"type": "home-z2m-cover",
|
|
156
|
+
"name": "",
|
|
157
|
+
"baseTopic": "zigbee2mqtt",
|
|
158
|
+
"friendlyName": "<your cover>",
|
|
171
159
|
"x": 420,
|
|
172
160
|
"y": 320,
|
|
173
161
|
"wires": [
|
|
162
|
+
[
|
|
163
|
+
"example-cover-control-device-commands"
|
|
164
|
+
],
|
|
174
165
|
[
|
|
175
166
|
"example-cover-control-cover"
|
|
176
167
|
]
|
|
@@ -192,7 +183,7 @@
|
|
|
192
183
|
"y": 200,
|
|
193
184
|
"wires": [
|
|
194
185
|
[
|
|
195
|
-
"example-cover-control-
|
|
186
|
+
"example-cover-control-adapter"
|
|
196
187
|
],
|
|
197
188
|
[
|
|
198
189
|
"example-cover-control-state"
|
|
@@ -203,25 +194,6 @@
|
|
|
203
194
|
]
|
|
204
195
|
]
|
|
205
196
|
},
|
|
206
|
-
{
|
|
207
|
-
"id": "example-cover-control-to-device",
|
|
208
|
-
"type": "function",
|
|
209
|
-
"name": "to Zigbee2MQTT",
|
|
210
|
-
"func": "// Neutral cover commands to a Zigbee2MQTT cover. Put your cover's name in\n// the topic; wire the result to an MQTT out node.\nconst topic = \"zigbee2mqtt/<your cover>\";\nconst command = msg.cover_command;\nif (command.operation === \"observe\") return {topic: topic + \"/get\", payload: {position: \"\"}};\nif (command.operation === \"stop\") return {topic: topic + \"/set\", payload: \"STOP\"};\nreturn {topic: topic + \"/set\", payload: {position: command.position}};",
|
|
211
|
-
"outputs": 1,
|
|
212
|
-
"timeout": 0,
|
|
213
|
-
"noerr": 0,
|
|
214
|
-
"initialize": "",
|
|
215
|
-
"finalize": "",
|
|
216
|
-
"libs": [],
|
|
217
|
-
"x": 880,
|
|
218
|
-
"y": 140,
|
|
219
|
-
"wires": [
|
|
220
|
-
[
|
|
221
|
-
"example-cover-control-device-commands"
|
|
222
|
-
]
|
|
223
|
-
]
|
|
224
|
-
},
|
|
225
197
|
{
|
|
226
198
|
"id": "example-cover-control-device-commands",
|
|
227
199
|
"type": "debug",
|
|
@@ -286,43 +258,28 @@
|
|
|
286
258
|
{
|
|
287
259
|
"id": "example-cover-control-availability-report",
|
|
288
260
|
"type": "inject",
|
|
289
|
-
"name": "availability
|
|
261
|
+
"name": "availability from the cover (MQTT in)",
|
|
290
262
|
"props": [
|
|
291
263
|
{
|
|
292
264
|
"p": "payload",
|
|
293
265
|
"v": "{\"state\":\"online\"}",
|
|
294
266
|
"vt": "json"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"p": "topic",
|
|
270
|
+
"vt": "str"
|
|
295
271
|
}
|
|
296
272
|
],
|
|
297
273
|
"repeat": "",
|
|
298
274
|
"crontab": "",
|
|
299
275
|
"once": false,
|
|
300
276
|
"onceDelay": 0.1,
|
|
301
|
-
"topic": "",
|
|
277
|
+
"topic": "zigbee2mqtt/<your cover>/availability",
|
|
302
278
|
"x": 200,
|
|
303
279
|
"y": 360,
|
|
304
280
|
"wires": [
|
|
305
281
|
[
|
|
306
|
-
"example-cover-control-
|
|
307
|
-
]
|
|
308
|
-
]
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
"id": "example-cover-control-from-availability",
|
|
312
|
-
"type": "function",
|
|
313
|
-
"name": "availability from Zigbee2MQTT",
|
|
314
|
-
"func": "// A Zigbee2MQTT availability report (retained, from an MQTT in node on\n// <your cover>/availability) as the cover controller reads it.\nconst report = typeof msg.payload === \"string\" ? JSON.parse(msg.payload) : msg.payload;\nif (!report || (report.state !== \"online\" && report.state !== \"offline\")) return null;\nreturn {cover: {kind: \"availability\", online: report.state === \"online\"}};",
|
|
315
|
-
"outputs": 1,
|
|
316
|
-
"timeout": 0,
|
|
317
|
-
"noerr": 0,
|
|
318
|
-
"initialize": "",
|
|
319
|
-
"finalize": "",
|
|
320
|
-
"libs": [],
|
|
321
|
-
"x": 460,
|
|
322
|
-
"y": 360,
|
|
323
|
-
"wires": [
|
|
324
|
-
[
|
|
325
|
-
"example-cover-control-cover"
|
|
282
|
+
"example-cover-control-adapter"
|
|
326
283
|
]
|
|
327
284
|
]
|
|
328
285
|
},
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "example-home-theatre-activity-home-theatre-activity-example",
|
|
4
4
|
"type": "comment",
|
|
5
5
|
"name": "Home theatre activity example",
|
|
6
|
-
"info": "The state contract turns a request on home/<area>/theatre/request into an activity intent. The activity controller plans each target and sends msg.theatreCommand; the switch routes each command by its target, and a change node moves it onto that controller's input. Every controller reports msg.theatre target state on output 2, wired straight back to the activity controller, which publishes a complete snapshot through the contract.\n\nName the area on the state contract before deploying: it names the MQTT topics and Home Assistant entities, and until it is set the contract shows \"invalid configuration\". Put the same area in the \"request tv activity\" inject's topic. Set the display controller's device hosts and TV pre-shared key too; until then it shows \"invalid configuration\" and the activity waits for it. Wire the controllers' output 1 to your device transports and activity lighting to your room lighting controller.",
|
|
6
|
+
"info": "The state contract turns a request on home/<area>/theatre/request into an activity intent. The activity controller plans each target and sends msg.theatreCommand; the switch routes each command by its target, and a change node moves it onto that controller's input. Every controller reports msg.theatre target state on output 2, wired straight back to the activity controller, which publishes a complete snapshot through the contract.\n\nName the area on the state contract before deploying: it names the MQTT topics and Home Assistant entities, and until it is set the contract shows \"invalid configuration\". Put the same area in the \"request tv activity\" inject's topic. Set the display controller's device hosts and TV pre-shared key too; until then it shows \"invalid configuration\" and the activity waits for it. Wire the controllers' output 1 to your device transports and activity lighting to your room lighting controller. Activity lighting holds the room's lights through a room lighting controller, which reaches its light through a zigbee2mqtt light node and passes each light's reading back to activity lighting (its third output), so the lights confirm. Set the light's friendly name, wire the debug's place to MQTT out, and an MQTT in node on the light's topics (zigbee2mqtt/<your light>/#) into the light node.\n\nThe \"MQTT out connected\" status node sends the state contract its startup message each time an MQTT out node connects to the broker, so what it announces reaches it: the broker drops anything sent before it connects. It watches every node on this flow, and the nodes act only on an MQTT out node's connected status; you can scope it to your MQTT out node instead.",
|
|
7
7
|
"x": 190,
|
|
8
8
|
"y": 40,
|
|
9
9
|
"wires": []
|
|
@@ -38,21 +38,10 @@
|
|
|
38
38
|
]
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
|
-
"id": "example-home-theatre-activity-contract-
|
|
42
|
-
"type": "
|
|
43
|
-
"name": "
|
|
44
|
-
"
|
|
45
|
-
{
|
|
46
|
-
"p": "theatreStateContract",
|
|
47
|
-
"v": "{\"kind\":\"startup\"}",
|
|
48
|
-
"vt": "json"
|
|
49
|
-
}
|
|
50
|
-
],
|
|
51
|
-
"repeat": "",
|
|
52
|
-
"crontab": "",
|
|
53
|
-
"once": true,
|
|
54
|
-
"onceDelay": 3,
|
|
55
|
-
"topic": "",
|
|
41
|
+
"id": "example-home-theatre-activity-contract-mqtt-connected",
|
|
42
|
+
"type": "status",
|
|
43
|
+
"name": "MQTT out connected",
|
|
44
|
+
"scope": null,
|
|
56
45
|
"x": 170,
|
|
57
46
|
"y": 140,
|
|
58
47
|
"wires": [
|
|
@@ -133,7 +122,7 @@
|
|
|
133
122
|
"y": 440,
|
|
134
123
|
"wires": [
|
|
135
124
|
[
|
|
136
|
-
"example-home-theatre-activity-room
|
|
125
|
+
"example-home-theatre-activity-room"
|
|
137
126
|
],
|
|
138
127
|
[
|
|
139
128
|
"example-home-theatre-activity-theatre-activity-controller"
|
|
@@ -143,7 +132,7 @@
|
|
|
143
132
|
{
|
|
144
133
|
"id": "example-home-theatre-activity-room-lighting-intents",
|
|
145
134
|
"type": "debug",
|
|
146
|
-
"name": "room
|
|
135
|
+
"name": "room and light MQTT (MQTT out)",
|
|
147
136
|
"active": true,
|
|
148
137
|
"tosidebar": true,
|
|
149
138
|
"console": false,
|
|
@@ -152,7 +141,7 @@
|
|
|
152
141
|
"targetType": "full",
|
|
153
142
|
"statusVal": "",
|
|
154
143
|
"statusType": "auto",
|
|
155
|
-
"x":
|
|
144
|
+
"x": 1880,
|
|
156
145
|
"y": 440,
|
|
157
146
|
"wires": []
|
|
158
147
|
},
|
|
@@ -474,5 +463,50 @@
|
|
|
474
463
|
"x": 1630,
|
|
475
464
|
"y": 520,
|
|
476
465
|
"wires": []
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
"id": "example-home-theatre-activity-room",
|
|
469
|
+
"type": "home-room-lighting-controller",
|
|
470
|
+
"name": "",
|
|
471
|
+
"area": "",
|
|
472
|
+
"publishState": false,
|
|
473
|
+
"discovery": false,
|
|
474
|
+
"idScheme": "node",
|
|
475
|
+
"displayName": "",
|
|
476
|
+
"discoveryPrefix": "homeassistant",
|
|
477
|
+
"targets": "[{\"id\":\"main\"}]",
|
|
478
|
+
"initialTransitionSeconds": 1,
|
|
479
|
+
"x": 1630,
|
|
480
|
+
"y": 440,
|
|
481
|
+
"wires": [
|
|
482
|
+
[
|
|
483
|
+
"example-home-theatre-activity-room-lighting-intents"
|
|
484
|
+
],
|
|
485
|
+
[
|
|
486
|
+
"example-home-theatre-activity-room-light-main"
|
|
487
|
+
],
|
|
488
|
+
[
|
|
489
|
+
"example-home-theatre-activity-activity-lighting-controller"
|
|
490
|
+
]
|
|
491
|
+
]
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
"id": "example-home-theatre-activity-room-light-main",
|
|
495
|
+
"type": "home-z2m-light",
|
|
496
|
+
"name": "",
|
|
497
|
+
"target": "main",
|
|
498
|
+
"baseTopic": "zigbee2mqtt",
|
|
499
|
+
"friendlyName": "<your light>",
|
|
500
|
+
"group": false,
|
|
501
|
+
"x": 1630,
|
|
502
|
+
"y": 520,
|
|
503
|
+
"wires": [
|
|
504
|
+
[
|
|
505
|
+
"example-home-theatre-activity-room-lighting-intents"
|
|
506
|
+
],
|
|
507
|
+
[
|
|
508
|
+
"example-home-theatre-activity-room"
|
|
509
|
+
]
|
|
510
|
+
]
|
|
477
511
|
}
|
|
478
512
|
]
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "example-house-schedule-house-schedule-example",
|
|
4
4
|
"type": "comment",
|
|
5
5
|
"name": "House schedule example",
|
|
6
|
-
"info": "A house schedule shared by two
|
|
6
|
+
"info": "A house schedule shared by two areas. Each area's circadian lighting policy chooses the house schedule as its Schedule and follows it without wires, and styles its own room. \"wake earlier\" changes the schedule through the optional MQTT node, which publishes its times (wire its output to an MQTT out node, and an MQTT in node on its set topics to its input). Each room reaches its light through a zigbee2mqtt light node: set its friendly name, and wire its first output to MQTT out and an MQTT in node on the light's topics (zigbee2mqtt/<your light>/#) into it.",
|
|
7
7
|
"x": 170,
|
|
8
8
|
"y": 40,
|
|
9
9
|
"wires": []
|
|
@@ -49,33 +49,102 @@
|
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
|
-
"id": "example-house-schedule-living",
|
|
53
|
-
"type": "home-
|
|
52
|
+
"id": "example-house-schedule-living-circadian",
|
|
53
|
+
"type": "home-circadian-lighting-policy",
|
|
54
54
|
"name": "living room",
|
|
55
55
|
"area": "",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
56
|
+
"houseSchedule": "example-house-schedule-house",
|
|
57
|
+
"wakeTime": "07:00",
|
|
58
|
+
"bedTime": "23:00",
|
|
58
59
|
"maxBrightnessPct": 100,
|
|
59
60
|
"maxColorTempKelvin": 6500,
|
|
60
61
|
"sleepBrightnessPct": 1,
|
|
61
62
|
"sleepColorTempKelvin": 2200,
|
|
62
|
-
"initialTransitionSeconds": 1,
|
|
63
63
|
"refreshTransitionSeconds": 60,
|
|
64
64
|
"refreshSeconds": 60,
|
|
65
65
|
"initialSleep": false,
|
|
66
|
+
"publishState": false,
|
|
67
|
+
"discovery": false,
|
|
68
|
+
"discoveryPrefix": "homeassistant",
|
|
69
|
+
"idScheme": "node",
|
|
70
|
+
"x": 340,
|
|
71
|
+
"y": 180,
|
|
72
|
+
"wires": [
|
|
73
|
+
[
|
|
74
|
+
"example-house-schedule-living"
|
|
75
|
+
],
|
|
76
|
+
[]
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "example-house-schedule-bedroom-circadian",
|
|
81
|
+
"type": "home-circadian-lighting-policy",
|
|
82
|
+
"name": "bedroom",
|
|
83
|
+
"area": "",
|
|
84
|
+
"houseSchedule": "example-house-schedule-house",
|
|
85
|
+
"wakeTime": "07:00",
|
|
86
|
+
"bedTime": "23:00",
|
|
87
|
+
"maxBrightnessPct": 100,
|
|
88
|
+
"maxColorTempKelvin": 6500,
|
|
89
|
+
"sleepBrightnessPct": 1,
|
|
90
|
+
"sleepColorTempKelvin": 2200,
|
|
91
|
+
"refreshTransitionSeconds": 60,
|
|
92
|
+
"refreshSeconds": 60,
|
|
93
|
+
"initialSleep": false,
|
|
94
|
+
"publishState": false,
|
|
95
|
+
"discovery": false,
|
|
96
|
+
"discoveryPrefix": "homeassistant",
|
|
97
|
+
"idScheme": "node",
|
|
98
|
+
"x": 340,
|
|
99
|
+
"y": 240,
|
|
100
|
+
"wires": [
|
|
101
|
+
[
|
|
102
|
+
"example-house-schedule-bedroom"
|
|
103
|
+
],
|
|
104
|
+
[]
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": "example-house-schedule-living",
|
|
109
|
+
"type": "home-room-lighting-controller",
|
|
110
|
+
"name": "living room",
|
|
111
|
+
"area": "",
|
|
112
|
+
"displayName": "",
|
|
113
|
+
"targets": "[{\"id\":\"main\"}]",
|
|
114
|
+
"initialTransitionSeconds": 1,
|
|
66
115
|
"x": 600,
|
|
67
116
|
"y": 100,
|
|
68
117
|
"wires": [
|
|
69
118
|
[
|
|
70
119
|
"example-house-schedule-living-commands"
|
|
71
|
-
]
|
|
120
|
+
],
|
|
121
|
+
[
|
|
122
|
+
"example-house-schedule-living-light-main"
|
|
123
|
+
],
|
|
124
|
+
[]
|
|
72
125
|
],
|
|
73
|
-
"wakeTime": "07:00",
|
|
74
|
-
"bedTime": "23:00",
|
|
75
126
|
"publishState": false,
|
|
76
127
|
"discovery": false,
|
|
77
|
-
"idScheme": "node"
|
|
78
|
-
|
|
128
|
+
"idScheme": "node"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "example-house-schedule-living-light-main",
|
|
132
|
+
"type": "home-z2m-light",
|
|
133
|
+
"name": "",
|
|
134
|
+
"target": "main",
|
|
135
|
+
"baseTopic": "zigbee2mqtt",
|
|
136
|
+
"friendlyName": "<your light>",
|
|
137
|
+
"group": false,
|
|
138
|
+
"x": 470,
|
|
139
|
+
"y": 100,
|
|
140
|
+
"wires": [
|
|
141
|
+
[
|
|
142
|
+
"example-house-schedule-living-commands"
|
|
143
|
+
],
|
|
144
|
+
[
|
|
145
|
+
"example-house-schedule-living"
|
|
146
|
+
]
|
|
147
|
+
]
|
|
79
148
|
},
|
|
80
149
|
{
|
|
81
150
|
"id": "example-house-schedule-bedroom",
|
|
@@ -83,28 +152,41 @@
|
|
|
83
152
|
"name": "bedroom",
|
|
84
153
|
"area": "",
|
|
85
154
|
"displayName": "",
|
|
86
|
-
"targets": "[{\"id\":\"main\"
|
|
87
|
-
"maxBrightnessPct": 100,
|
|
88
|
-
"maxColorTempKelvin": 6500,
|
|
89
|
-
"sleepBrightnessPct": 1,
|
|
90
|
-
"sleepColorTempKelvin": 2200,
|
|
155
|
+
"targets": "[{\"id\":\"main\"}]",
|
|
91
156
|
"initialTransitionSeconds": 1,
|
|
92
|
-
"refreshTransitionSeconds": 60,
|
|
93
|
-
"refreshSeconds": 60,
|
|
94
|
-
"initialSleep": false,
|
|
95
157
|
"x": 600,
|
|
96
158
|
"y": 160,
|
|
97
159
|
"wires": [
|
|
98
160
|
[
|
|
99
161
|
"example-house-schedule-bedroom-commands"
|
|
100
|
-
]
|
|
162
|
+
],
|
|
163
|
+
[
|
|
164
|
+
"example-house-schedule-bedroom-light-main"
|
|
165
|
+
],
|
|
166
|
+
[]
|
|
101
167
|
],
|
|
102
|
-
"wakeTime": "07:00",
|
|
103
|
-
"bedTime": "23:00",
|
|
104
168
|
"publishState": false,
|
|
105
169
|
"discovery": false,
|
|
106
|
-
"idScheme": "node"
|
|
107
|
-
|
|
170
|
+
"idScheme": "node"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"id": "example-house-schedule-bedroom-light-main",
|
|
174
|
+
"type": "home-z2m-light",
|
|
175
|
+
"name": "",
|
|
176
|
+
"target": "main",
|
|
177
|
+
"baseTopic": "zigbee2mqtt",
|
|
178
|
+
"friendlyName": "<your light>",
|
|
179
|
+
"group": false,
|
|
180
|
+
"x": 470,
|
|
181
|
+
"y": 160,
|
|
182
|
+
"wires": [
|
|
183
|
+
[
|
|
184
|
+
"example-house-schedule-bedroom-commands"
|
|
185
|
+
],
|
|
186
|
+
[
|
|
187
|
+
"example-house-schedule-bedroom"
|
|
188
|
+
]
|
|
189
|
+
]
|
|
108
190
|
},
|
|
109
191
|
{
|
|
110
192
|
"id": "example-house-schedule-living-commands",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "example-room-lighting-room-lighting-example",
|
|
4
4
|
"type": "comment",
|
|
5
5
|
"name": "Room lighting example",
|
|
6
|
-
"info": "Motion and illuminance feed occupancy fusion and the motion policy; a wall switch feeds the switch policy. Both send lighting intents to the room controller, which owns the light's commands.\n\nReplace the inject nodes with your sensors
|
|
6
|
+
"info": "Motion and illuminance feed occupancy fusion and the motion policy; a wall switch feeds the switch policy. Both send lighting intents to the room controller, which owns the light's commands. The circadian lighting policy sends the room how its lights should look over the day; the room uses it for lights nobody has set otherwise.\n\nReplace the inject nodes with your sensors. The room reaches its light through the zigbee2mqtt light node: set its friendly name, wire the room's first output and the light node's first output to MQTT out, and an MQTT in node on the light's topics (zigbee2mqtt/<your light>/#) into the light node. Set the circadian policy's wake and bed times (Node-RED host time) before deploying. Give the room controller an area to publish each light's control state and its Home Assistant discovery, and the circadian policy one to publish its circadian and sleep switches; without one they still control and style the lights.\n\nThe \"MQTT out connected\" status node sends the room controller and the circadian policy its startup message each time an MQTT out node connects to the broker, so what they announce reaches it: the broker drops anything sent before it connects. It watches every node on this flow, and the nodes act only on an MQTT out node's connected status; you can scope it to your MQTT out node instead.",
|
|
7
7
|
"x": 170,
|
|
8
8
|
"y": 40,
|
|
9
9
|
"wires": []
|
|
@@ -96,26 +96,16 @@
|
|
|
96
96
|
]
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
|
-
"id": "example-room-lighting-room-
|
|
100
|
-
"type": "
|
|
101
|
-
"name": "
|
|
102
|
-
"
|
|
103
|
-
{
|
|
104
|
-
"p": "lighting",
|
|
105
|
-
"v": "{\"kind\":\"startup\"}",
|
|
106
|
-
"vt": "json"
|
|
107
|
-
}
|
|
108
|
-
],
|
|
109
|
-
"repeat": "",
|
|
110
|
-
"crontab": "",
|
|
111
|
-
"once": true,
|
|
112
|
-
"onceDelay": 3,
|
|
113
|
-
"topic": "",
|
|
99
|
+
"id": "example-room-lighting-room-mqtt-connected",
|
|
100
|
+
"type": "status",
|
|
101
|
+
"name": "MQTT out connected",
|
|
102
|
+
"scope": null,
|
|
114
103
|
"x": 150,
|
|
115
104
|
"y": 280,
|
|
116
105
|
"wires": [
|
|
117
106
|
[
|
|
118
|
-
"example-room-lighting-room-lighting-controller"
|
|
107
|
+
"example-room-lighting-room-lighting-controller",
|
|
108
|
+
"example-room-lighting-circadian"
|
|
119
109
|
]
|
|
120
110
|
]
|
|
121
111
|
},
|
|
@@ -167,33 +157,75 @@
|
|
|
167
157
|
]
|
|
168
158
|
},
|
|
169
159
|
{
|
|
170
|
-
"id": "example-room-lighting-
|
|
171
|
-
"type": "home-
|
|
160
|
+
"id": "example-room-lighting-circadian",
|
|
161
|
+
"type": "home-circadian-lighting-policy",
|
|
172
162
|
"name": "",
|
|
173
163
|
"area": "",
|
|
174
|
-
"
|
|
175
|
-
"
|
|
164
|
+
"houseSchedule": "",
|
|
165
|
+
"wakeTime": "07:00",
|
|
166
|
+
"bedTime": "23:00",
|
|
176
167
|
"maxBrightnessPct": 100,
|
|
177
168
|
"maxColorTempKelvin": 6500,
|
|
178
169
|
"sleepBrightnessPct": 1,
|
|
179
170
|
"sleepColorTempKelvin": 2200,
|
|
180
|
-
"initialTransitionSeconds": 1,
|
|
181
171
|
"refreshTransitionSeconds": 60,
|
|
182
172
|
"refreshSeconds": 60,
|
|
183
173
|
"initialSleep": false,
|
|
174
|
+
"publishState": false,
|
|
175
|
+
"discovery": false,
|
|
176
|
+
"discoveryPrefix": "homeassistant",
|
|
177
|
+
"idScheme": "node",
|
|
178
|
+
"x": 620,
|
|
179
|
+
"y": 280,
|
|
180
|
+
"wires": [
|
|
181
|
+
[
|
|
182
|
+
"example-room-lighting-room-lighting-controller"
|
|
183
|
+
],
|
|
184
|
+
[]
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"id": "example-room-lighting-room-lighting-controller",
|
|
189
|
+
"type": "home-room-lighting-controller",
|
|
190
|
+
"name": "",
|
|
191
|
+
"area": "",
|
|
192
|
+
"displayName": "",
|
|
193
|
+
"targets": "[{\"id\":\"main\"}]",
|
|
194
|
+
"initialTransitionSeconds": 1,
|
|
184
195
|
"x": 880,
|
|
185
196
|
"y": 180,
|
|
186
197
|
"wires": [
|
|
187
198
|
[
|
|
188
199
|
"example-room-lighting-room-commands"
|
|
189
|
-
]
|
|
200
|
+
],
|
|
201
|
+
[
|
|
202
|
+
"example-room-lighting-room-lighting-controller-light-main"
|
|
203
|
+
],
|
|
204
|
+
[]
|
|
190
205
|
],
|
|
191
|
-
"wakeTime": "07:00",
|
|
192
|
-
"bedTime": "23:00",
|
|
193
206
|
"publishState": false,
|
|
194
207
|
"discovery": false,
|
|
195
208
|
"idScheme": "node"
|
|
196
209
|
},
|
|
210
|
+
{
|
|
211
|
+
"id": "example-room-lighting-room-lighting-controller-light-main",
|
|
212
|
+
"type": "home-z2m-light",
|
|
213
|
+
"name": "",
|
|
214
|
+
"target": "main",
|
|
215
|
+
"baseTopic": "zigbee2mqtt",
|
|
216
|
+
"friendlyName": "<your light>",
|
|
217
|
+
"group": false,
|
|
218
|
+
"x": 880,
|
|
219
|
+
"y": 240,
|
|
220
|
+
"wires": [
|
|
221
|
+
[
|
|
222
|
+
"example-room-lighting-room-commands"
|
|
223
|
+
],
|
|
224
|
+
[
|
|
225
|
+
"example-room-lighting-room-lighting-controller"
|
|
226
|
+
]
|
|
227
|
+
]
|
|
228
|
+
},
|
|
197
229
|
{
|
|
198
230
|
"id": "example-room-lighting-room-commands",
|
|
199
231
|
"type": "debug",
|