@avantics/node-red-home-automation 4.0.3 → 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.
Files changed (116) hide show
  1. package/README.md +447 -64
  2. package/contract-examples/room-lighting.mjs +39 -27
  3. package/contract-examples/switch-gestures.mjs +1 -1
  4. package/contract-examples/volume-ownership.mjs +6 -5
  5. package/dist/lib/activity-lighting-controller.d.ts +9 -2
  6. package/dist/lib/activity-lighting-controller.js +107 -19
  7. package/dist/lib/adopted-request.d.ts +17 -0
  8. package/dist/lib/adopted-request.js +61 -7
  9. package/dist/lib/avr-controller.d.ts +9 -3
  10. package/dist/lib/avr-controller.js +71 -24
  11. package/dist/lib/avr-publishing.d.ts +3 -3
  12. package/dist/lib/avr-publishing.js +11 -5
  13. package/dist/lib/backlighting-controller.d.ts +2 -0
  14. package/dist/lib/backlighting-controller.js +27 -7
  15. package/dist/lib/circadian-policy.d.ts +47 -0
  16. package/dist/lib/circadian-policy.js +111 -0
  17. package/dist/lib/circadian-publishing.d.ts +33 -0
  18. package/dist/lib/circadian-publishing.js +154 -0
  19. package/dist/lib/circadian-schedule.d.ts +4 -0
  20. package/dist/lib/circadian-schedule.js +12 -0
  21. package/dist/lib/command-echo.d.ts +8 -1
  22. package/dist/lib/command-echo.js +37 -6
  23. package/dist/lib/cover-controller.js +4 -0
  24. package/dist/lib/cover-publishing.js +1 -1
  25. package/dist/lib/denon-protocol.d.ts +5 -1
  26. package/dist/lib/denon-protocol.js +27 -11
  27. package/dist/lib/display-mode-controller.d.ts +12 -5
  28. package/dist/lib/display-mode-controller.js +181 -87
  29. package/dist/lib/enable-input.d.ts +3 -0
  30. package/dist/lib/enable-input.js +18 -0
  31. package/dist/lib/house-schedule-publishing.js +1 -1
  32. package/dist/lib/house-schedule.js +2 -2
  33. package/dist/lib/light-contract.d.ts +53 -0
  34. package/dist/lib/light-contract.js +11 -0
  35. package/dist/lib/light-styling.d.ts +2 -2
  36. package/dist/lib/light-styling.js +5 -4
  37. package/dist/lib/motion-policy.d.ts +0 -1
  38. package/dist/lib/motion-policy.js +9 -8
  39. package/dist/lib/motion-publishing.js +3 -2
  40. package/dist/lib/mqtt-message.d.ts +6 -0
  41. package/dist/lib/mqtt-message.js +21 -0
  42. package/dist/lib/occupancy-publishing.js +1 -1
  43. package/dist/lib/power-reading.d.ts +5 -0
  44. package/dist/lib/power-reading.js +13 -0
  45. package/dist/lib/room-controller.d.ts +39 -29
  46. package/dist/lib/room-controller.js +314 -192
  47. package/dist/lib/room-lighting-discovery.d.ts +0 -14
  48. package/dist/lib/room-lighting-discovery.js +20 -126
  49. package/dist/lib/room-publishing.d.ts +10 -12
  50. package/dist/lib/room-publishing.js +65 -125
  51. package/dist/lib/shelly-cover.d.ts +44 -0
  52. package/dist/lib/shelly-cover.js +153 -0
  53. package/dist/lib/shelly-gen2.d.ts +25 -0
  54. package/dist/lib/shelly-gen2.js +58 -0
  55. package/dist/lib/shelly-switch.d.ts +95 -0
  56. package/dist/lib/shelly-switch.js +237 -0
  57. package/dist/lib/source-capability-controller.d.ts +2 -0
  58. package/dist/lib/source-capability-controller.js +27 -6
  59. package/dist/lib/switch-policy.d.ts +1 -1
  60. package/dist/lib/switch-policy.js +1 -1
  61. package/dist/lib/theatre-requests.d.ts +29 -0
  62. package/dist/lib/theatre-requests.js +89 -0
  63. package/dist/lib/theatre-state-contract.d.ts +5 -22
  64. package/dist/lib/theatre-state-contract.js +30 -77
  65. package/dist/lib/toggle-power.d.ts +41 -0
  66. package/dist/lib/toggle-power.js +74 -0
  67. package/dist/lib/topic-names.d.ts +1 -0
  68. package/dist/lib/topic-names.js +7 -0
  69. package/dist/lib/{display-transport.d.ts → transports/display-transport.d.ts} +1 -1
  70. package/dist/lib/{display-transport.js → transports/display-transport.js} +32 -7
  71. package/dist/lib/z2m-cover.d.ts +49 -0
  72. package/dist/lib/z2m-cover.js +120 -0
  73. package/dist/lib/z2m-light-adapter.d.ts +62 -0
  74. package/dist/lib/z2m-light-adapter.js +195 -0
  75. package/dist/lib/z2m-light.d.ts +8 -0
  76. package/dist/lib/z2m-light.js +61 -3
  77. package/dist/nodes/activity-lighting-controller.html +20 -3
  78. package/dist/nodes/activity-lighting-controller.js +21 -0
  79. package/dist/nodes/avr-controller.html +25 -6
  80. package/dist/nodes/avr-controller.js +16 -6
  81. package/dist/nodes/circadian-policy.d.ts +3 -0
  82. package/dist/nodes/circadian-policy.html +140 -0
  83. package/dist/nodes/circadian-policy.js +162 -0
  84. package/dist/nodes/cover-controller.html +4 -3
  85. package/dist/nodes/display-mode-controller.html +58 -11
  86. package/dist/nodes/display-mode-controller.js +19 -6
  87. package/dist/nodes/house-schedule.html +3 -3
  88. package/dist/nodes/motion-policy.html +5 -2
  89. package/dist/nodes/motion-policy.js +3 -0
  90. package/dist/nodes/refused-enable.d.ts +7 -0
  91. package/dist/nodes/refused-enable.js +24 -0
  92. package/dist/nodes/room-controller.html +215 -82
  93. package/dist/nodes/room-controller.js +71 -83
  94. package/dist/nodes/shelly-cover.d.ts +3 -0
  95. package/dist/nodes/shelly-cover.html +65 -0
  96. package/dist/nodes/shelly-cover.js +34 -0
  97. package/dist/nodes/shelly-switch.d.ts +3 -0
  98. package/dist/nodes/shelly-switch.html +82 -0
  99. package/dist/nodes/shelly-switch.js +48 -0
  100. package/dist/nodes/theatre-state-contract.html +4 -3
  101. package/dist/nodes/z2m-cover.d.ts +3 -0
  102. package/dist/nodes/z2m-cover.html +68 -0
  103. package/dist/nodes/z2m-cover.js +41 -0
  104. package/dist/nodes/z2m-light.d.ts +3 -0
  105. package/dist/nodes/z2m-light.html +72 -0
  106. package/dist/nodes/z2m-light.js +50 -0
  107. package/examples/Cover control.json +24 -56
  108. package/examples/Home theatre activity.json +54 -9
  109. package/examples/Home theatre equipment.json +4 -4
  110. package/examples/House schedule.json +106 -24
  111. package/examples/Room lighting.json +54 -11
  112. package/examples/Shelly cover.json +252 -0
  113. package/examples/Shelly switch.json +197 -0
  114. package/package.json +13 -4
  115. package/dist/lib/room-schedule.d.ts +0 -8
  116. package/dist/lib/room-schedule.js +0 -41
@@ -0,0 +1,72 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType("home-z2m-light", {
3
+ category: "home automation",
4
+ color: "#e2d96e",
5
+ defaults: {
6
+ name: {value: ""},
7
+ // The room's id for this light: no default, it names the user's own.
8
+ target: {value: "", required: true, validate: function (v) { return String(v || "").trim() !== ""; }},
9
+ baseTopic: {value: "zigbee2mqtt", required: true, validate: function (v) {
10
+ var base = String(v || "").trim().replace(/^\/+|\/+$/g, "");
11
+ return base !== "" && !/[+#]/.test(base);
12
+ }},
13
+ // No default: it names the user's own light or group.
14
+ friendlyName: {value: "", required: true, validate: function (v) {
15
+ var name = String(v || "").trim().replace(/^\/+|\/+$/g, "");
16
+ return name !== "" && !/[+#]/.test(name);
17
+ }},
18
+ group: {value: false}
19
+ },
20
+ inputs: 1,
21
+ outputs: 2,
22
+ outputLabels: ["to the light (MQTT out)", "to the room lighting controller"],
23
+ icon: "font-awesome/fa-lightbulb-o",
24
+ label: function () { return this.name || this.friendlyName || "zigbee2mqtt light"; },
25
+ paletteLabel: "zigbee2mqtt light"
26
+ });
27
+ </script>
28
+
29
+ <script type="text/html" data-template-name="home-z2m-light">
30
+ <div class="form-row"><label for="node-input-name">Name</label><input type="text" id="node-input-name"></div>
31
+ <div class="form-row"><label for="node-input-target">Target</label><input type="text" id="node-input-target" placeholder="the room's id for this light"></div>
32
+ <div class="form-row"><label for="node-input-baseTopic">Base topic</label><input type="text" id="node-input-baseTopic"></div>
33
+ <div class="form-row"><label for="node-input-friendlyName">Friendly name</label><input type="text" id="node-input-friendlyName" placeholder="the light's or group's name in Zigbee2MQTT"></div>
34
+ <div class="form-row"><label for="node-input-group">Zigbee2MQTT group</label><input type="checkbox" id="node-input-group" style="display:inline-block; width:auto;"></div>
35
+ </script>
36
+
37
+ <script type="text/html" data-help-name="home-z2m-light">
38
+ <p>Connects one Zigbee2MQTT light, or a Zigbee2MQTT group of lights, to a <b>room lighting controller</b>, over
39
+ Zigbee2MQTT's MQTT messages: no function nodes, and never Home Assistant. Use one per light in the room's targets.</p>
40
+ <h3>Wiring</h3>
41
+ <ol>
42
+ <li>An <b>MQTT in</b> node subscribed to <code>&lt;base&gt;/&lt;friendly name&gt;/#</code> (output: auto-detect)
43
+ → this node. That covers the light's state, its <code>/set</code> topic (to see other people's commands) and its
44
+ availability.</li>
45
+ <li>The room controller's second output (its light commands) → this node. One wire can feed every light's node:
46
+ each acts only on its own <b>Target</b>.</li>
47
+ <li>This node's first output → an <b>MQTT out</b> node on the same broker, with no topic set.</li>
48
+ <li>This node's second output (readings) → the room controller.</li>
49
+ </ol>
50
+ <h3>What it does</h3>
51
+ <p>It turns the room's commands into Zigbee2MQTT's <code>/set</code> payloads (brightness 1-254, colour temperature
52
+ in mireds, the transition), exactly as the room sent them before 6.0, and the light's reports into readings in
53
+ percent and kelvin. It tells its own commands from someone else's: an exact echo on <code>/set</code> is its own;
54
+ a bare ON or OFF arriving while one of its own with that power hasn't come back is its own, changed on the way;
55
+ anything else is someone else's, which the room may take as a person's change. When the room restyles a light that
56
+ already shows that style, it sends nothing and tells the room so. When the room starts, it asks the light to report
57
+ (<code>/get</code>).</p>
58
+ <p>Availability (<code>/availability</code>) is passed on and shown by the room, but changes nothing.</p>
59
+ <h3>Groups</h3>
60
+ <p>Tick <b>Zigbee2MQTT group</b> for a group. Commands are the same. Zigbee2MQTT works out a group's state itself,
61
+ from what it sent and its members' reports, so a group's report follows a command at once. A group has no
62
+ availability and can't be asked to report, so at the room's startup the node sends nothing: the room waits for
63
+ Zigbee2MQTT's next state for the group. (Passing on an old state could settle a command still on its way.)</p>
64
+ <h3>Settings</h3>
65
+ <dl class="message-properties">
66
+ <dt>Target</dt><dd>The light's id in the room controller's Targets JSON.</dd>
67
+ <dt>Base topic</dt><dd>Zigbee2MQTT's base topic, <code>zigbee2mqtt</code> unless you changed it.</dd>
68
+ <dt>Friendly name</dt><dd>The light's or group's name in Zigbee2MQTT.</dd>
69
+ </dl>
70
+ <p>For a light that isn't Zigbee2MQTT's, see the neutral light contract in the README: any flow that answers the
71
+ room's <code>msg.light</code> commands with <code>msg.light</code> readings works in this node's place.</p>
72
+ </script>
@@ -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 function nodes show the mapping to and from a Zigbee2MQTT cover: wire them to MQTT out and in nodes on your cover's topic. 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.",
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-from-device"
160
+ "example-cover-control-adapter"
157
161
  ]
158
162
  ]
159
163
  },
160
164
  {
161
- "id": "example-cover-control-from-device",
162
- "type": "function",
163
- "name": "from Zigbee2MQTT",
164
- "func": "// A Zigbee2MQTT cover's state report (from an MQTT in node on its topic)\n// as what the cover controller reads. Position 100 is open.\nconst report = typeof msg.payload === \"string\" ? JSON.parse(msg.payload) : msg.payload;\nif (!report || typeof report.position !== \"number\") return null;\nconst motion = [\"opening\", \"closing\", \"stopped\"].includes(report.motor_state) ? report.motor_state : undefined;\nreturn {cover: {\n kind: \"observed\",\n position: report.position,\n motion,\n observedAt: new Date().toISOString(),\n battery: typeof report.battery === \"number\" ? report.battery : undefined,\n charging: typeof report.charging_status === \"string\" ? report.charging_status : undefined\n}};",
165
- "outputs": 1,
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-to-device"
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 report from the cover",
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-from-availability"
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": []
@@ -126,14 +126,14 @@
126
126
  "type": "home-activity-lighting-controller",
127
127
  "name": "",
128
128
  "area": "",
129
- "profiles": "{\"off\":{\"targets\":[],\"values\":{}},\"tv\":{\"targets\":[\"main\"],\"values\":{\"brightness\":64,\"color_temp\":400}}}",
129
+ "profiles": "{\"off\":{\"targets\":[],\"values\":{}},\"tv\":{\"targets\":[\"main\"],\"values\":{\"brightnessPct\":25,\"colorTempKelvin\":2500}}}",
130
130
  "confirmationTimeoutMs": 15000,
131
131
  "maxAttempts": 2,
132
132
  "x": 1380,
133
133
  "y": 440,
134
134
  "wires": [
135
135
  [
136
- "example-home-theatre-activity-room-lighting-intents"
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 lighting intents",
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": 1630,
155
+ "x": 1880,
156
156
  "y": 440,
157
157
  "wires": []
158
158
  },
@@ -240,8 +240,8 @@
240
240
  "area": "",
241
241
  "tvHost": "",
242
242
  "screenHost": "",
243
- "projectorMeterHost": "",
244
- "screenOpenPosition": 82,
243
+ "projectorPowerMeterHost": "",
244
+ "screenOpenPosition": "",
245
245
  "screenTolerance": 2,
246
246
  "pollMs": 2000,
247
247
  "queryTimeoutMs": 5000,
@@ -312,8 +312,8 @@
312
312
  "sources": "{\"shield\":\"SAT/CBL\",\"playstation\":\"GAME\"}",
313
313
  "retryMs": 2000,
314
314
  "maxAttempts": 3,
315
- "minVolume": 0,
316
- "maxVolume": 60,
315
+ "minVolumeDb": -80,
316
+ "maxVolumeDb": -20,
317
317
  "x": 1380,
318
318
  "y": 280,
319
319
  "wires": [
@@ -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
  ]
@@ -40,8 +40,8 @@
40
40
  "sources": "{\"shield\":\"SAT/CBL\",\"playstation\":\"GAME\"}",
41
41
  "retryMs": 2000,
42
42
  "maxAttempts": 3,
43
- "minVolume": 0,
44
- "maxVolume": 60,
43
+ "minVolumeDb": -80,
44
+ "maxVolumeDb": -20,
45
45
  "x": 420,
46
46
  "y": 100,
47
47
  "wires": [
@@ -116,8 +116,8 @@
116
116
  "area": "",
117
117
  "tvHost": "",
118
118
  "screenHost": "",
119
- "projectorMeterHost": "",
120
- "screenOpenPosition": 82,
119
+ "projectorPowerMeterHost": "",
120
+ "screenOpenPosition": "",
121
121
  "screenTolerance": 2,
122
122
  "pollMs": 2000,
123
123
  "queryTimeoutMs": 5000,
@@ -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 rooms. Both room controllers choose the house schedule as their Schedule and follow it without wires. \"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).",
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-room-lighting-controller",
52
+ "id": "example-house-schedule-living-circadian",
53
+ "type": "home-circadian-lighting-policy",
54
54
  "name": "living room",
55
55
  "area": "",
56
- "displayName": "",
57
- "targets": "[{\"id\":\"main\",\"stateTopic\":\"room/light/main\",\"commandTopic\":\"room/light/main/set\"}]",
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
- "houseSchedule": "example-house-schedule-house"
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\",\"stateTopic\":\"room/light/main\",\"commandTopic\":\"room/light/main/set\"}]",
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
- "houseSchedule": "example-house-schedule-house"
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",