@avantics/node-red-home-automation 5.0.0 → 6.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/README.md +340 -70
- 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 +38 -27
- package/dist/lib/room-controller.js +310 -204
- 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 +14 -5
- package/dist/nodes/activity-lighting-controller.js +21 -0
- package/dist/nodes/avr-controller.html +15 -18
- package/dist/nodes/avr-controller.js +4 -4
- package/dist/nodes/circadian-policy.d.ts +3 -0
- package/dist/nodes/circadian-policy.html +140 -0
- package/dist/nodes/circadian-policy.js +162 -0
- package/dist/nodes/cover-controller.html +4 -3
- package/dist/nodes/display-mode-controller.html +14 -17
- package/dist/nodes/display-mode-controller.js +4 -1
- package/dist/nodes/house-schedule.html +3 -3
- package/dist/nodes/motion-policy.html +5 -2
- package/dist/nodes/motion-policy.js +3 -0
- package/dist/nodes/refused-enable.d.ts +7 -0
- package/dist/nodes/refused-enable.js +24 -0
- package/dist/nodes/room-controller.html +215 -82
- package/dist/nodes/room-controller.js +70 -96
- package/dist/nodes/shelly-switch.d.ts +3 -0
- package/dist/nodes/shelly-switch.html +82 -0
- package/dist/nodes/shelly-switch.js +48 -0
- package/dist/nodes/theatre-state-contract.html +4 -3
- 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 +72 -0
- package/dist/nodes/z2m-light.js +50 -0
- package/examples/Cover control.json +24 -56
- package/examples/Home theatre activity.json +49 -4
- package/examples/House schedule.json +106 -24
- package/examples/Room lighting.json +54 -11
- 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,50 @@
|
|
|
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.
|
|
22
|
+
return decided.ignored ? { state: saved ?? decided.state, traces: [] } : decided;
|
|
23
|
+
});
|
|
24
|
+
if (result.ignored)
|
|
25
|
+
return;
|
|
26
|
+
// MQTT publications for the device on output 1, for an MQTT out node;
|
|
27
|
+
// readings for the room controller on output 2.
|
|
28
|
+
const outputs = [
|
|
29
|
+
result.publications.length ? result.publications.map((publication) => ({ ...publication })) : null,
|
|
30
|
+
result.readings.length ? result.readings.map((reading) => ({ payload: undefined, light: reading })) : null
|
|
31
|
+
];
|
|
32
|
+
if (outputs.some((output) => output !== null))
|
|
33
|
+
send(outputs);
|
|
34
|
+
const state = result.state;
|
|
35
|
+
if (state.online === false) {
|
|
36
|
+
node.status({ fill: "grey", shape: "ring", text: "offline" });
|
|
37
|
+
}
|
|
38
|
+
else if (state.report) {
|
|
39
|
+
const values = [
|
|
40
|
+
typeof state.report.brightness === "number" ? Math.round(state.report.brightness * 100 / 254) + "%" : "",
|
|
41
|
+
typeof state.report.color_temp === "number" && state.report.color_temp > 0 ? Math.round(1_000_000 / state.report.color_temp) + "K" : ""
|
|
42
|
+
].filter(Boolean).join(" ");
|
|
43
|
+
node.status({ fill: state.report.on ? "green" : "grey", shape: "dot", text: (state.report.on ? "on" : "off") + (state.report.on && values ? " · " + values : "") });
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
RED.nodes.registerType("home-z2m-light", HomeZ2mLight);
|
|
48
|
+
};
|
|
49
|
+
module.exports = registerZ2mLight;
|
|
50
|
+
//# sourceMappingURL=z2m-light.js.map
|
|
@@ -3,7 +3,7 @@
|
|
|
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.",
|
|
7
7
|
"x": 170,
|
|
8
8
|
"y": 40,
|
|
9
9
|
"wires": []
|
|
@@ -136,41 +136,43 @@
|
|
|
136
136
|
{
|
|
137
137
|
"id": "example-cover-control-report",
|
|
138
138
|
"type": "inject",
|
|
139
|
-
"name": "state report from the cover",
|
|
139
|
+
"name": "state report from the cover (MQTT in)",
|
|
140
140
|
"props": [
|
|
141
141
|
{
|
|
142
142
|
"p": "payload",
|
|
143
143
|
"v": "{\"position\":60,\"motor_state\":\"stopped\",\"battery\":87,\"charging_status\":\"false\"}",
|
|
144
144
|
"vt": "json"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"p": "topic",
|
|
148
|
+
"vt": "str"
|
|
145
149
|
}
|
|
146
150
|
],
|
|
147
151
|
"repeat": "",
|
|
148
152
|
"crontab": "",
|
|
149
153
|
"once": false,
|
|
150
154
|
"onceDelay": 0.1,
|
|
151
|
-
"topic": "",
|
|
155
|
+
"topic": "zigbee2mqtt/<your cover>",
|
|
152
156
|
"x": 180,
|
|
153
157
|
"y": 320,
|
|
154
158
|
"wires": [
|
|
155
159
|
[
|
|
156
|
-
"example-cover-control-
|
|
160
|
+
"example-cover-control-adapter"
|
|
157
161
|
]
|
|
158
162
|
]
|
|
159
163
|
},
|
|
160
164
|
{
|
|
161
|
-
"id": "example-cover-control-
|
|
162
|
-
"type": "
|
|
163
|
-
"name": "
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"timeout": 0,
|
|
167
|
-
"noerr": 0,
|
|
168
|
-
"initialize": "",
|
|
169
|
-
"finalize": "",
|
|
170
|
-
"libs": [],
|
|
165
|
+
"id": "example-cover-control-adapter",
|
|
166
|
+
"type": "home-z2m-cover",
|
|
167
|
+
"name": "",
|
|
168
|
+
"baseTopic": "zigbee2mqtt",
|
|
169
|
+
"friendlyName": "<your cover>",
|
|
171
170
|
"x": 420,
|
|
172
171
|
"y": 320,
|
|
173
172
|
"wires": [
|
|
173
|
+
[
|
|
174
|
+
"example-cover-control-device-commands"
|
|
175
|
+
],
|
|
174
176
|
[
|
|
175
177
|
"example-cover-control-cover"
|
|
176
178
|
]
|
|
@@ -192,7 +194,7 @@
|
|
|
192
194
|
"y": 200,
|
|
193
195
|
"wires": [
|
|
194
196
|
[
|
|
195
|
-
"example-cover-control-
|
|
197
|
+
"example-cover-control-adapter"
|
|
196
198
|
],
|
|
197
199
|
[
|
|
198
200
|
"example-cover-control-state"
|
|
@@ -203,25 +205,6 @@
|
|
|
203
205
|
]
|
|
204
206
|
]
|
|
205
207
|
},
|
|
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
208
|
{
|
|
226
209
|
"id": "example-cover-control-device-commands",
|
|
227
210
|
"type": "debug",
|
|
@@ -286,43 +269,28 @@
|
|
|
286
269
|
{
|
|
287
270
|
"id": "example-cover-control-availability-report",
|
|
288
271
|
"type": "inject",
|
|
289
|
-
"name": "availability
|
|
272
|
+
"name": "availability from the cover (MQTT in)",
|
|
290
273
|
"props": [
|
|
291
274
|
{
|
|
292
275
|
"p": "payload",
|
|
293
276
|
"v": "{\"state\":\"online\"}",
|
|
294
277
|
"vt": "json"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"p": "topic",
|
|
281
|
+
"vt": "str"
|
|
295
282
|
}
|
|
296
283
|
],
|
|
297
284
|
"repeat": "",
|
|
298
285
|
"crontab": "",
|
|
299
286
|
"once": false,
|
|
300
287
|
"onceDelay": 0.1,
|
|
301
|
-
"topic": "",
|
|
288
|
+
"topic": "zigbee2mqtt/<your cover>/availability",
|
|
302
289
|
"x": 200,
|
|
303
290
|
"y": 360,
|
|
304
291
|
"wires": [
|
|
305
292
|
[
|
|
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"
|
|
293
|
+
"example-cover-control-adapter"
|
|
326
294
|
]
|
|
327
295
|
]
|
|
328
296
|
},
|
|
@@ -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.",
|
|
7
7
|
"x": 190,
|
|
8
8
|
"y": 40,
|
|
9
9
|
"wires": []
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"y": 440,
|
|
134
134
|
"wires": [
|
|
135
135
|
[
|
|
136
|
-
"example-home-theatre-activity-room
|
|
136
|
+
"example-home-theatre-activity-room"
|
|
137
137
|
],
|
|
138
138
|
[
|
|
139
139
|
"example-home-theatre-activity-theatre-activity-controller"
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
{
|
|
144
144
|
"id": "example-home-theatre-activity-room-lighting-intents",
|
|
145
145
|
"type": "debug",
|
|
146
|
-
"name": "room
|
|
146
|
+
"name": "room and light MQTT (MQTT out)",
|
|
147
147
|
"active": true,
|
|
148
148
|
"tosidebar": true,
|
|
149
149
|
"console": false,
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
"targetType": "full",
|
|
153
153
|
"statusVal": "",
|
|
154
154
|
"statusType": "auto",
|
|
155
|
-
"x":
|
|
155
|
+
"x": 1880,
|
|
156
156
|
"y": 440,
|
|
157
157
|
"wires": []
|
|
158
158
|
},
|
|
@@ -474,5 +474,50 @@
|
|
|
474
474
|
"x": 1630,
|
|
475
475
|
"y": 520,
|
|
476
476
|
"wires": []
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
"id": "example-home-theatre-activity-room",
|
|
480
|
+
"type": "home-room-lighting-controller",
|
|
481
|
+
"name": "",
|
|
482
|
+
"area": "",
|
|
483
|
+
"publishState": false,
|
|
484
|
+
"discovery": false,
|
|
485
|
+
"idScheme": "node",
|
|
486
|
+
"displayName": "",
|
|
487
|
+
"discoveryPrefix": "homeassistant",
|
|
488
|
+
"targets": "[{\"id\":\"main\"}]",
|
|
489
|
+
"initialTransitionSeconds": 1,
|
|
490
|
+
"x": 1630,
|
|
491
|
+
"y": 440,
|
|
492
|
+
"wires": [
|
|
493
|
+
[
|
|
494
|
+
"example-home-theatre-activity-room-lighting-intents"
|
|
495
|
+
],
|
|
496
|
+
[
|
|
497
|
+
"example-home-theatre-activity-room-light-main"
|
|
498
|
+
],
|
|
499
|
+
[
|
|
500
|
+
"example-home-theatre-activity-activity-lighting-controller"
|
|
501
|
+
]
|
|
502
|
+
]
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
"id": "example-home-theatre-activity-room-light-main",
|
|
506
|
+
"type": "home-z2m-light",
|
|
507
|
+
"name": "",
|
|
508
|
+
"target": "main",
|
|
509
|
+
"baseTopic": "zigbee2mqtt",
|
|
510
|
+
"friendlyName": "<your light>",
|
|
511
|
+
"group": false,
|
|
512
|
+
"x": 1630,
|
|
513
|
+
"y": 520,
|
|
514
|
+
"wires": [
|
|
515
|
+
[
|
|
516
|
+
"example-home-theatre-activity-room-lighting-intents"
|
|
517
|
+
],
|
|
518
|
+
[
|
|
519
|
+
"example-home-theatre-activity-room"
|
|
520
|
+
]
|
|
521
|
+
]
|
|
477
522
|
}
|
|
478
523
|
]
|
|
@@ -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.",
|
|
7
7
|
"x": 170,
|
|
8
8
|
"y": 40,
|
|
9
9
|
"wires": []
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
{
|
|
99
99
|
"id": "example-room-lighting-room-startup",
|
|
100
100
|
"type": "inject",
|
|
101
|
-
"name": "
|
|
101
|
+
"name": "startup",
|
|
102
102
|
"props": [
|
|
103
103
|
{
|
|
104
104
|
"p": "lighting",
|
|
@@ -115,7 +115,8 @@
|
|
|
115
115
|
"y": 280,
|
|
116
116
|
"wires": [
|
|
117
117
|
[
|
|
118
|
-
"example-room-lighting-room-lighting-controller"
|
|
118
|
+
"example-room-lighting-room-lighting-controller",
|
|
119
|
+
"example-room-lighting-circadian"
|
|
119
120
|
]
|
|
120
121
|
]
|
|
121
122
|
},
|
|
@@ -167,33 +168,75 @@
|
|
|
167
168
|
]
|
|
168
169
|
},
|
|
169
170
|
{
|
|
170
|
-
"id": "example-room-lighting-
|
|
171
|
-
"type": "home-
|
|
171
|
+
"id": "example-room-lighting-circadian",
|
|
172
|
+
"type": "home-circadian-lighting-policy",
|
|
172
173
|
"name": "",
|
|
173
174
|
"area": "",
|
|
174
|
-
"
|
|
175
|
-
"
|
|
175
|
+
"houseSchedule": "",
|
|
176
|
+
"wakeTime": "07:00",
|
|
177
|
+
"bedTime": "23:00",
|
|
176
178
|
"maxBrightnessPct": 100,
|
|
177
179
|
"maxColorTempKelvin": 6500,
|
|
178
180
|
"sleepBrightnessPct": 1,
|
|
179
181
|
"sleepColorTempKelvin": 2200,
|
|
180
|
-
"initialTransitionSeconds": 1,
|
|
181
182
|
"refreshTransitionSeconds": 60,
|
|
182
183
|
"refreshSeconds": 60,
|
|
183
184
|
"initialSleep": false,
|
|
185
|
+
"publishState": false,
|
|
186
|
+
"discovery": false,
|
|
187
|
+
"discoveryPrefix": "homeassistant",
|
|
188
|
+
"idScheme": "node",
|
|
189
|
+
"x": 620,
|
|
190
|
+
"y": 280,
|
|
191
|
+
"wires": [
|
|
192
|
+
[
|
|
193
|
+
"example-room-lighting-room-lighting-controller"
|
|
194
|
+
],
|
|
195
|
+
[]
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"id": "example-room-lighting-room-lighting-controller",
|
|
200
|
+
"type": "home-room-lighting-controller",
|
|
201
|
+
"name": "",
|
|
202
|
+
"area": "",
|
|
203
|
+
"displayName": "",
|
|
204
|
+
"targets": "[{\"id\":\"main\"}]",
|
|
205
|
+
"initialTransitionSeconds": 1,
|
|
184
206
|
"x": 880,
|
|
185
207
|
"y": 180,
|
|
186
208
|
"wires": [
|
|
187
209
|
[
|
|
188
210
|
"example-room-lighting-room-commands"
|
|
189
|
-
]
|
|
211
|
+
],
|
|
212
|
+
[
|
|
213
|
+
"example-room-lighting-room-lighting-controller-light-main"
|
|
214
|
+
],
|
|
215
|
+
[]
|
|
190
216
|
],
|
|
191
|
-
"wakeTime": "07:00",
|
|
192
|
-
"bedTime": "23:00",
|
|
193
217
|
"publishState": false,
|
|
194
218
|
"discovery": false,
|
|
195
219
|
"idScheme": "node"
|
|
196
220
|
},
|
|
221
|
+
{
|
|
222
|
+
"id": "example-room-lighting-room-lighting-controller-light-main",
|
|
223
|
+
"type": "home-z2m-light",
|
|
224
|
+
"name": "",
|
|
225
|
+
"target": "main",
|
|
226
|
+
"baseTopic": "zigbee2mqtt",
|
|
227
|
+
"friendlyName": "<your light>",
|
|
228
|
+
"group": false,
|
|
229
|
+
"x": 880,
|
|
230
|
+
"y": 240,
|
|
231
|
+
"wires": [
|
|
232
|
+
[
|
|
233
|
+
"example-room-lighting-room-commands"
|
|
234
|
+
],
|
|
235
|
+
[
|
|
236
|
+
"example-room-lighting-room-lighting-controller"
|
|
237
|
+
]
|
|
238
|
+
]
|
|
239
|
+
},
|
|
197
240
|
{
|
|
198
241
|
"id": "example-room-lighting-room-commands",
|
|
199
242
|
"type": "debug",
|