@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
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Most home automations translate an event directly into a command. This package a
|
|
|
18
18
|
## What it solves
|
|
19
19
|
|
|
20
20
|
- **Occupancy without flicker:** combine PIR motion with optional presence sensing before changing room state.
|
|
21
|
-
- **Circadian lighting with manual ownership:**
|
|
21
|
+
- **Circadian lighting with manual ownership:** a circadian lighting policy styles a room's lights over the day, never overwriting a light a person set or an activity holds.
|
|
22
22
|
- **Honest wall inputs:** preserve restart baselines while exposing unconfirmed, stale and unavailable physical-input evidence.
|
|
23
23
|
- **Reliable AV transitions:** coordinate AVR inputs, TV power, projector warm-up and cooldown, and motorised screens from observed state rather than blind toggles.
|
|
24
24
|
- **Honest source readiness:** model controllable, externally controlled, and unavailable playback sources without claiming success from an input selection alone.
|
|
@@ -26,7 +26,7 @@ Most home automations translate an event directly into a command. This package a
|
|
|
26
26
|
- **Bounded receiver volume:** coordinate absolute and relative requests through one transport owner while preserving later physical adjustments.
|
|
27
27
|
- **Recoverable automation:** adopt one fresh, uniquely matching physical activity after lost state; otherwise report the activity as unknown and leave the devices alone until the next request.
|
|
28
28
|
|
|
29
|
-

|
|
30
30
|
|
|
31
31
|
Each controller keeps the desired and the observed state, sends semantic
|
|
32
32
|
commands, and reports done only when fresh observations confirm them.
|
|
@@ -39,52 +39,85 @@ The nodes come in four groups. Each group has an importable example flow
|
|
|
39
39
|
### Room lighting
|
|
40
40
|
|
|
41
41
|
Motion, presence, illuminance and wall switches drive one room's lights, with
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
manual ownership, and a circadian lighting policy styles them over the day.
|
|
43
|
+
Wire occupancy fusion into the motion policy, wall switches into the switch
|
|
44
|
+
policy, and both policies and the circadian policy into the room controller. A
|
|
45
|
+
room without a circadian policy styles nothing: its lights just go on and off.
|
|
46
|
+
The room controller keeps a light a person set after the room went
|
|
45
47
|
vacant, so motion doesn't switch it straight off. Without a Node-RED context
|
|
46
48
|
store, a motion node that restarts or is redeployed doesn't know whether the
|
|
47
49
|
room is occupied, so it counts the room as vacant from then: someone sitting
|
|
48
50
|
still in a lit room has the motion-lit lights switched off after the vacancy
|
|
49
51
|
delay unless motion is seen. After a restart the room has also forgotten which
|
|
50
52
|
lights a person set, so it doesn't keep those either. Circadian
|
|
51
|
-
levels follow the
|
|
53
|
+
levels follow the circadian policy's wake and bed times (default 07:00 and
|
|
52
54
|
23:00): they rise over the hour after waking, stay bright and cool through the
|
|
53
55
|
day, and wind down to the sleep settings over the three hours before bed. Times
|
|
54
|
-
are the Node-RED host's local time.
|
|
56
|
+
are the Node-RED host's local time. The policy sends the room a *style* (a
|
|
57
|
+
brightness and colour temperature) once the flows start, every restyle
|
|
58
|
+
interval and at every change; the room uses it for lights it controls, never
|
|
59
|
+
for one a person set or an owner such as an activity holds. One policy can
|
|
60
|
+
style several rooms, or each area can have its own, with its own switches in
|
|
61
|
+
Home Assistant. A light that only switches on and off can be marked
|
|
62
|
+
`"onOffOnly": true` in the room's targets: it is never sent brightness, colour
|
|
63
|
+
or a transition.
|
|
55
64
|
Example: [`Room lighting.json`](https://github.com/avantics-hq/node-red-home-automation/blob/main/examples/Room%20lighting.json).
|
|
56
65
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
The room controller reaches each light through an adapter: a **zigbee2mqtt
|
|
67
|
+
light** node per Zigbee2MQTT light or group. Wire the room's second output into
|
|
68
|
+
every light's node and each node's second output back into the room; each
|
|
69
|
+
node's first output goes to MQTT out unchanged, and an MQTT in node on the
|
|
70
|
+
light's `<base>/<friendly name>/#` feeds it. The light's node tells the room's
|
|
71
|
+
own commands from other people's on the light's `/set` topic, so a function
|
|
72
|
+
that rewrites them on the way makes them look like someone else's. To stop that
|
|
73
|
+
becoming a loop, a bare ON or OFF that arrives within 5 seconds of one of its
|
|
74
|
+
own commands with that power, before that command has come back on the topic,
|
|
75
|
+
is taken as that command, and the room restyles a light after someone else's
|
|
76
|
+
bare ON at most once every 5 seconds. A person's bare ON or OFF in that moment
|
|
77
|
+
is taken as the room's own, which changes nothing, as the light is already being
|
|
78
|
+
set that way; other rewrites can still be misread. The node also skips a
|
|
79
|
+
restyle the light already shows.
|
|
67
80
|
|
|
68
81
|
| Node | Purpose |
|
|
69
82
|
|---|---|
|
|
70
83
|
| `home-occupancy-fusion` | Combines PIR motion with optional presence sensing. |
|
|
71
84
|
| `home-motion-lighting-policy` | Converts occupancy and illuminance into lighting intent. A `delay` message (in seconds) or `illuminance-cut-off` message overrides its settings until they are changed and redeployed. |
|
|
72
85
|
| `home-switch-lighting-policy` | Converts raw edges or pre-classified button actions into lighting intent while exposing input freshness and availability. |
|
|
73
|
-
| `home-
|
|
86
|
+
| `home-circadian-lighting-policy` | Styles rooms over the day: brightness and colour temperature from wake and bed times, sleep mode, and circadian and sleep switches for Home Assistant. |
|
|
87
|
+
| `home-room-lighting-controller` | Owns the room's light commands, manual and held lights, and lighting state, and applies the style it is sent. |
|
|
88
|
+
| `home-z2m-light` | Connects one Zigbee2MQTT light or group to a room controller: the room's neutral commands become Zigbee2MQTT's `/set` messages, and the light's reports become readings. |
|
|
89
|
+
| `home-shelly-switch` | Connects one switch channel of a Shelly Gen2+ relay as the device is set up: a detached wall switch's presses to the switch policy, or the relay as the light. |
|
|
90
|
+
|
|
91
|
+
A Shelly Gen2 or later relay behind a wall switch wires straight in through the
|
|
92
|
+
Shelly switch adapter, with no function nodes: an MQTT in node on the device's
|
|
93
|
+
`<prefix>/#` feeds it, and its first output goes to an MQTT out node. It reads
|
|
94
|
+
the device's own configuration for its channel (with `Shelly.GetConfig`, the
|
|
95
|
+
reply addressed under the device's prefix so the same MQTT in node receives it)
|
|
96
|
+
at startup and whenever the device comes online, and shows what it found. In
|
|
97
|
+
detached mode, where the relay stays on to power smart bulbs, the switch's
|
|
98
|
+
presses go to the switch policy: a toggle switch's on/off as edges, with the
|
|
99
|
+
device's status as the baseline, and a push button's single, double or long
|
|
100
|
+
presses as actions (the switch policy acts on single and double; long is passed
|
|
101
|
+
on for later use). The relay is never commanded, and a relay that reports off
|
|
102
|
+
is flagged, as the bulbs have lost power. In any other mode the relay is the
|
|
103
|
+
light: the node reports its state and takes on and off. Its **Mode** setting
|
|
104
|
+
overrides what was read, and decides when the configuration can't be read.
|
|
105
|
+
Example: [`Shelly switch.json`](https://github.com/avantics-hq/node-red-home-automation/blob/main/examples/Shelly%20switch.json).
|
|
74
106
|
|
|
75
107
|
One house schedule can set the wake and bed times for many rooms. It is a
|
|
76
|
-
configuration node, like an MQTT broker: choose it as a
|
|
77
|
-
**Schedule** and the
|
|
78
|
-
Those
|
|
79
|
-
Assistant.
|
|
80
|
-
Deleting the house schedule in the editor returns its
|
|
108
|
+
configuration node, like an MQTT broker: choose it as a circadian lighting
|
|
109
|
+
policy's **Schedule** and the policy follows it, hearing of every change
|
|
110
|
+
without wires. Those policies then have no wake and bed time entities of their
|
|
111
|
+
own in Home Assistant. A policy that needs its own times (a child's room, say)
|
|
112
|
+
chooses none. Deleting the house schedule in the editor returns its policies to
|
|
113
|
+
their own times.
|
|
81
114
|
The optional house schedule MQTT node publishes the schedule's times and Home
|
|
82
115
|
Assistant time entities, and takes changes from them.
|
|
83
116
|
Example: [`House schedule.json`](https://github.com/avantics-hq/node-red-home-automation/blob/main/examples/House%20schedule.json).
|
|
84
117
|
|
|
85
118
|
| Node | Purpose |
|
|
86
119
|
|---|---|
|
|
87
|
-
| `home-house-schedule` | A configuration node: one wake and bed time for every
|
|
120
|
+
| `home-house-schedule` | A configuration node: one wake and bed time for every circadian lighting policy that uses it. |
|
|
88
121
|
| `home-house-schedule-mqtt` | Publishes a house schedule for Home Assistant and changes it from Home Assistant. |
|
|
89
122
|
|
|
90
123
|
### Home theatre equipment
|
|
@@ -171,14 +204,14 @@ moves, send it to the motion policy's pause input
|
|
|
171
204
|
cover), as the example does; a pause lasts at most the motion policy's
|
|
172
205
|
**Maximum pause** unless sent again; never its enable (`area-enabled`), which is the
|
|
173
206
|
user's own switch. Device commands come out in a neutral
|
|
174
|
-
shape (`set_position`, `stop` or `observe`); the example flow
|
|
175
|
-
from a Zigbee2MQTT cover
|
|
176
|
-
facts and never acted on.
|
|
207
|
+
shape (`set_position`, `stop` or `observe`); the example flow wires them to and
|
|
208
|
+
from a Zigbee2MQTT cover through the Zigbee2MQTT cover adapter (below). Battery
|
|
209
|
+
and charging status are kept as reported facts and never acted on.
|
|
177
210
|
|
|
178
211
|
Switched on, a cover node publishes its state (and position) under
|
|
179
212
|
`home/<area>/cover/<name>/`, named by its **Name in topics** (no default: give
|
|
180
|
-
each cover in a room its own), and announces a Home Assistant cover entity. Its open,
|
|
181
|
-
close
|
|
213
|
+
each cover in a room its own), and announces a Home Assistant cover entity of that name. Its open,
|
|
214
|
+
close and stop (and, for a position cover, set position) come back to the cover node on its own set topics
|
|
182
215
|
as requests like any other, carried out and confirmed as above; nothing
|
|
183
216
|
commands the device through Home Assistant. A cover group has no entity of its
|
|
184
217
|
own: Home Assistant can group the covers' entities itself.
|
|
@@ -187,6 +220,7 @@ A cover group moves several covers as one, such as the left and right of a
|
|
|
187
220
|
curtain: it sends each member the request on that member's own output, labelled
|
|
188
221
|
from its Members setting, and reports ready only when every member confirms,
|
|
189
222
|
or, if only some do, which did what.
|
|
223
|
+
Example: [`Cover pair.json`](https://github.com/avantics-hq/node-red-home-automation/blob/main/examples/Cover%20pair.json).
|
|
190
224
|
|
|
191
225
|
A Shelly Gen2 or later device in cover mode wires straight to a cover
|
|
192
226
|
controller through the Shelly cover adapter, with no function nodes: an MQTT in
|
|
@@ -201,16 +235,29 @@ into availability. A cover that isn't calibrated, or has lost its position,
|
|
|
201
235
|
fails the command in hand with the reason rather than reporting a position.
|
|
202
236
|
Example: [`Shelly cover.json`](https://github.com/avantics-hq/node-red-home-automation/blob/main/examples/Shelly%20cover.json).
|
|
203
237
|
|
|
238
|
+
A Zigbee2MQTT cover wires the same way through the Zigbee2MQTT cover adapter:
|
|
239
|
+
set its base topic (`zigbee2mqtt` by default) and the device's friendly name,
|
|
240
|
+
feed it from MQTT in nodes on `<base>/<friendly name>` and its `/availability`,
|
|
241
|
+
and wire it between the cover controller and an MQTT out node. It sends
|
|
242
|
+
`{"position": n}` and `{"state": "OPEN" | "CLOSE" | "STOP"}` on the device's
|
|
243
|
+
`/set`, and asks for a fresh reading on its `/get`. Each state report becomes a
|
|
244
|
+
position reading, with motion from `motor_state` or `moving` where the device
|
|
245
|
+
reports one; a cover that reports none is confirmed by the controller's settle
|
|
246
|
+
time. A cover with no position (set the controller to open, close and stop
|
|
247
|
+
only) reports its end state once its motion says it has stopped.
|
|
248
|
+
Example: [`Cover control.json`](https://github.com/avantics-hq/node-red-home-automation/blob/main/examples/Cover%20control.json).
|
|
249
|
+
|
|
204
250
|
| Node | Purpose |
|
|
205
251
|
|---|---|
|
|
206
252
|
| `home-cover-controller` | Owns one cover's moves (a position cover, or open, close and stop only), confirmed from what it reports, with presets, manual ownership and a moving signal. |
|
|
207
253
|
| `home-cover-group` | Moves several covers as one, with an honest result when only some confirm. |
|
|
208
254
|
| `home-shelly-cover` | Connects a Shelly Gen2+ cover to a cover controller over the device's own MQTT API. |
|
|
255
|
+
| `home-z2m-cover` | Connects a Zigbee2MQTT cover to a cover controller over Zigbee2MQTT's MQTT messages. |
|
|
209
256
|
|
|
210
257
|
## Requirements
|
|
211
258
|
|
|
212
|
-
- Node.js
|
|
213
|
-
- Node-RED 5.0.
|
|
259
|
+
- Node.js 24 or newer
|
|
260
|
+
- Node-RED 5.0.0 or newer
|
|
214
261
|
|
|
215
262
|
## Install
|
|
216
263
|
|
|
@@ -227,11 +274,195 @@ also attaches the package tarball and its SHA-256 checksum. Install a downloaded
|
|
|
227
274
|
tarball through **Manage palette → Install → Upload module**, or with:
|
|
228
275
|
|
|
229
276
|
```sh
|
|
230
|
-
npm install /path/to/avantics-node-red-home-automation-
|
|
277
|
+
npm install /path/to/avantics-node-red-home-automation-6.1.0.tgz
|
|
231
278
|
```
|
|
232
279
|
|
|
233
280
|
Add the installed nodes from the **home automation** section of the Node-RED palette, then configure the room, device hosts, MQTT topics, source mappings, and timing limits for your deployment.
|
|
234
281
|
|
|
282
|
+
### 6.1.0
|
|
283
|
+
|
|
284
|
+
Nothing to migrate from 6.0.0, but check one wiring change: publishing nodes
|
|
285
|
+
now announce themselves when MQTT out connects.
|
|
286
|
+
|
|
287
|
+
**Wire a Status node watching MQTT out into each publishing node.** Node-RED's
|
|
288
|
+
MQTT broker node connects after the flows start and drops anything sent before
|
|
289
|
+
then, so in 6.0.0 the Home Assistant discovery and availability a node announced
|
|
290
|
+
as the flows started could be lost after a restart or a full deploy (#185). A
|
|
291
|
+
message from a Status node whose scope is your MQTT out node now counts as the
|
|
292
|
+
node's startup message when it reports "connected", including after every
|
|
293
|
+
reconnect. An existing startup inject keeps working. The examples now use the
|
|
294
|
+
Status node.
|
|
295
|
+
|
|
296
|
+
**Room owners hold lights on or off, stack, and give lights back.** An owner,
|
|
297
|
+
such as an activity or the coming scene node, now keeps a light it switches
|
|
298
|
+
off held off, so motion leaves it alone. Owners stack per light: the newest
|
|
299
|
+
holds a shared light and hands it to the one beneath when it releases. When the
|
|
300
|
+
last owner lets go, a light the room was running is the room's again, a light
|
|
301
|
+
that was off goes off, and a light a person set gets its values back and stays
|
|
302
|
+
manual. In a home theatre, a light a person changed during an activity and a
|
|
303
|
+
later request took back now gets the person's values back when the activity
|
|
304
|
+
ends.
|
|
305
|
+
|
|
306
|
+
Also fixed:
|
|
307
|
+
|
|
308
|
+
- **Zigbee2MQTT light nodes** no longer log an error for every command meant for
|
|
309
|
+
another light in the same room (#184).
|
|
310
|
+
- **Zigbee2MQTT groups:** the docs recommend `retain: true` under the group in
|
|
311
|
+
Zigbee2MQTT's `configuration.yaml`, so the room has a group's state after a
|
|
312
|
+
restart (#186).
|
|
313
|
+
|
|
314
|
+
### 6.0.0
|
|
315
|
+
|
|
316
|
+
Circadian lighting becomes its own node, the room controller reaches its
|
|
317
|
+
lights through light adapters, 6.0 requires Node.js 24, and it removes what 5.0
|
|
318
|
+
kept working for a release. Check these after upgrading from 5.x; each shows
|
|
319
|
+
itself rather than failing silently.
|
|
320
|
+
|
|
321
|
+
**Every room lighting controller needs migrating.** Two things moved out of the
|
|
322
|
+
room controller: circadian lighting, sleep, the wake and bed times and the house
|
|
323
|
+
schedule, to a new **circadian lighting policy**; and each light's Zigbee2MQTT
|
|
324
|
+
topics, to a **zigbee2mqtt light** node per light, which now speaks to the
|
|
325
|
+
light. A room saved before 6.0 is an *invalid configuration* until you migrate
|
|
326
|
+
it, and its lights don't respond to anything until then. Every room saved by
|
|
327
|
+
5.x has both, so migrate each one; its edit dialog lists everything below. One
|
|
328
|
+
edit covers both moves:
|
|
329
|
+
|
|
330
|
+
1. **Its lights.** In the room's dialog, click **Create Zigbee2MQTT light
|
|
331
|
+
nodes**: it adds a zigbee2mqtt light per light, with the base topic and
|
|
332
|
+
friendly name read from the light's old topics, wired from the room's light
|
|
333
|
+
commands (its new second output) and back into the room, its MQTT messages to
|
|
334
|
+
the MQTT out the room publishes through, and an MQTT in node on the light's
|
|
335
|
+
topics when that MQTT out shows the broker. Or add them yourself: Target is
|
|
336
|
+
the light's id, and an MQTT in node on `<base>/<friendly name>/#` feeds each.
|
|
337
|
+
Delete the old MQTT in nodes on the lights' state and command topics. A light
|
|
338
|
+
whose topics weren't Zigbee2MQTT's (`<base>/<name>` and `<base>/<name>/set`)
|
|
339
|
+
is flagged: set it up by hand on the
|
|
340
|
+
[neutral light contract](#neutral-light-contract). A Zigbee2MQTT group works
|
|
341
|
+
the same way: tick **Zigbee2MQTT group** on its node, and set
|
|
342
|
+
`retain: true` under the group in Zigbee2MQTT's `configuration.yaml`, so the room has its state after a restart (a
|
|
343
|
+
group can't be asked for it).
|
|
344
|
+
2. Add a **circadian lighting policy** from the palette and wire its first
|
|
345
|
+
output into the room controller. One policy can feed several rooms that
|
|
346
|
+
share its settings, but its Home Assistant switches and set topics are named
|
|
347
|
+
after its own area only: rooms in other areas lose their
|
|
348
|
+
`home/<area>/circadian/set` topics and switches, so give each area that
|
|
349
|
+
needs its own switches its own policy.
|
|
350
|
+
3. Copy the room's old settings into it: wake and bed times (or its house
|
|
351
|
+
schedule), the daytime and sleep brightness and kelvin, the refresh
|
|
352
|
+
transition and interval (now *Restyle transition* and *Restyle interval*),
|
|
353
|
+
and initial sleep. The room's edit dialog lists its old values.
|
|
354
|
+
4. To keep the Home Assistant switches, give the policy the room's area, switch
|
|
355
|
+
on **Publish state** and **Home Assistant discovery**, and wire its second
|
|
356
|
+
output to MQTT out. Move any MQTT in node on `home/<area>/circadian/set`,
|
|
357
|
+
`…/sleep/set`, `…/wake-time/set` or `…/bed-time/set` from the room to the
|
|
358
|
+
policy, and any flow sending `{kind: "circadian" | "sleep" | "schedule"}`.
|
|
359
|
+
5. Click **Done**: saving keeps only each light's id in Targets JSON and clears
|
|
360
|
+
the old circadian settings, and the room runs again. Deploy it with its
|
|
361
|
+
policy and light nodes. A room that should stay unstyled skips steps 2 to 4.
|
|
362
|
+
|
|
363
|
+
The room's own output is now three: 1, its MQTT publications (control states,
|
|
364
|
+
availability, discovery), still wired to MQTT out; 2, light commands
|
|
365
|
+
(`msg.light`) for its lights' nodes; 3, each light's reading, for activity
|
|
366
|
+
lighting, which now confirms its lights from them. A flow that filtered the
|
|
367
|
+
room's output by the old command topics must now take the zigbee2mqtt light
|
|
368
|
+
nodes' output instead. The `/set` messages are byte for byte what the room sent
|
|
369
|
+
before, proven by a regression test over 400 generated histories.
|
|
370
|
+
|
|
371
|
+
As it starts, the policy clears the circadian, sleep, wake and bed entities
|
|
372
|
+
that rooms in its area published before 6.0, migrated or not, then announces
|
|
373
|
+
its own in the same batch, so Home Assistant can give them the old entity IDs.
|
|
374
|
+
The room clears its own as it starts too. A 5.x room deleted rather than
|
|
375
|
+
migrated is invalid, so it clears nothing: remove its retained topics and
|
|
376
|
+
entities yourself. A room inside a subflow isn't found this way yet
|
|
377
|
+
([#171](https://github.com/avantics-hq/node-red-home-automation/issues/171)):
|
|
378
|
+
migrate it and send it a startup message before you add its policy, so it
|
|
379
|
+
clears its own old entities first. A room without
|
|
380
|
+
a circadian policy just switches its lights on and off. Two further room
|
|
381
|
+
changes come with it:
|
|
382
|
+
|
|
383
|
+
- **A light's availability** from its node (Zigbee2MQTT's availability) is shown
|
|
384
|
+
on its control state (`available`) and in the room's status, and changes
|
|
385
|
+
nothing.
|
|
386
|
+
|
|
387
|
+
- **A light can be marked on/off only** with `"onOffOnly": true` in the room's
|
|
388
|
+
targets: it is never sent brightness, colour or a transition, and values for
|
|
389
|
+
it are left out with a warning. Activity lighting judges each light by what it
|
|
390
|
+
reports: one that has never reported brightness or colour temperature since
|
|
391
|
+
start is confirmed by being on, with a warning once per deploy if a profile
|
|
392
|
+
gives it values.
|
|
393
|
+
- **An intent's values alone no longer make a light manual**: only
|
|
394
|
+
`manual: true` does (a wall switch's double press sends it). Before 6.0, an
|
|
395
|
+
owner-less intent with values made the light manual, so circadian lighting
|
|
396
|
+
left it alone; now the next style restyles it.
|
|
397
|
+
- **A person changing a light an activity holds is a manual override.** Before
|
|
398
|
+
6.0, activity lighting counted such a light as preserved and stayed ready.
|
|
399
|
+
Now it reports `manual_override` for it, as the display, receiver and
|
|
400
|
+
backlight do; lighting is optional, so the theatre is degraded, not failed,
|
|
401
|
+
and the next activity request takes the light back. A light that was a
|
|
402
|
+
person's before the activity is still left alone, as before.
|
|
403
|
+
- **An intent's `refresh: true` no longer changes its transition.** Before 6.0
|
|
404
|
+
it styled the light over the refresh transition instead of the turn-on one;
|
|
405
|
+
the circadian policy now sends a new style whenever anything changes.
|
|
406
|
+
|
|
407
|
+
The other changes:
|
|
408
|
+
|
|
409
|
+
- **Node.js 24 or newer is required.** Node.js 22 is no longer supported.
|
|
410
|
+
- **Enable inputs take only `true` or `false`.** The motion policy's
|
|
411
|
+
`area-enabled`, `global-enabled` and `pause`, and the circadian lighting
|
|
412
|
+
policy's `{kind: "circadian" | "sleep", enabled}`, no longer read strings such
|
|
413
|
+
as `"ON"` or `"on"`. Any other value is refused: nothing changes, the node logs
|
|
414
|
+
a warning once per input per deploy, and its status says what was refused.
|
|
415
|
+
Before 6.0 the motion policy read "on" in any case as on and anything else as
|
|
416
|
+
off, and the room controller read anything but `true` as off. Home Assistant's own `ON`
|
|
417
|
+
and `OFF` on the `…/set` topics are unchanged: the nodes translate them.
|
|
418
|
+
- **Lighting values in Zigbee2MQTT's units are gone.** Intents take only
|
|
419
|
+
`brightnessPct` (0-100) and `colorTempKelvin`: a `brightness` or `color_temp`
|
|
420
|
+
in an intent is left out, never sent to the light, and the room controller
|
|
421
|
+
logs a warning once per deploy. An activity lighting profile using them is an
|
|
422
|
+
invalid configuration, shown on the node. For example, brightness 64 becomes
|
|
423
|
+
brightnessPct 25, and color_temp 400 becomes colorTempKelvin 2500.
|
|
424
|
+
- **Receiver volume is only in dB.** A volume request with `value` (the
|
|
425
|
+
receiver's 0-98) and no `valueDb` is answered `volume_rejected` with reason
|
|
426
|
+
`removed-volume-value`, and the node logs a warning once per deploy. A node
|
|
427
|
+
saved before 5.0 and never re-saved, with only its 0-98 **minVolume** and
|
|
428
|
+
**maxVolume**, is an invalid configuration naming the dB setting to set,
|
|
429
|
+
rather than getting the default bounds, which could be louder than its old
|
|
430
|
+
cap. In the editor such a node shows as invalid until its dB bounds are set,
|
|
431
|
+
and deploying it from the editor keeps it invalid rather than dropping the
|
|
432
|
+
old bounds.
|
|
433
|
+
- **`projectorMeterHost` is no longer read.** Set **Projector power meter
|
|
434
|
+
host** (`projectorPowerMeterHost`). A node that still names only the old key
|
|
435
|
+
is an invalid configuration saying so, in the editor and when deployed, until
|
|
436
|
+
the new host is set.
|
|
437
|
+
- **The package's files can no longer be imported directly.** Its exports map
|
|
438
|
+
exposes only `package.json`, so `require` or `import` of
|
|
439
|
+
`@avantics/node-red-home-automation/dist/…` fails with
|
|
440
|
+
`ERR_PACKAGE_PATH_NOT_EXPORTED`. Only the nodes are a public interface, as
|
|
441
|
+
5.0.0 said. Node-RED loads them by file path, so installing and using the
|
|
442
|
+
nodes is unchanged.
|
|
443
|
+
|
|
444
|
+
Also new in 6.0.0, with nothing to change:
|
|
445
|
+
|
|
446
|
+
- **Zigbee2MQTT cover** and **Shelly switch** nodes. The Zigbee2MQTT cover
|
|
447
|
+
adapter replaces the hand-written function nodes in the Cover control
|
|
448
|
+
example. The Shelly switch node follows the relay's own mode: a detached
|
|
449
|
+
wall switch's presses go to the switch policy, and the relay is never
|
|
450
|
+
switched.
|
|
451
|
+
- **A Shelly script** (`shelly/wall-switch-fallback.js`) that keeps a detached
|
|
452
|
+
wall switch working as an ordinary switch while MQTT or Node-RED is down (see
|
|
453
|
+
the wall switches guide).
|
|
454
|
+
- **Discovery as the flows start.** Every publishing node, now including the
|
|
455
|
+
room controller and the theatre state contract, announces its Home Assistant
|
|
456
|
+
entities once the flows start, as well as at its startup message. On a
|
|
457
|
+
first start, a full deploy or a restart that announcement is lost, as
|
|
458
|
+
Node-RED's MQTT broker node connects only afterwards, so from 6.0.1 wire a
|
|
459
|
+
**Status node** watching your MQTT out node into each publishing node: it
|
|
460
|
+
announces again each time MQTT out connects (see "Send each publishing node
|
|
461
|
+
its startup message" below).
|
|
462
|
+
- **A documentation site** with a guide for each area, a reference page for
|
|
463
|
+
every node and a releases page:
|
|
464
|
+
[avantics-hq.github.io/node-red-home-automation](https://avantics-hq.github.io/node-red-home-automation/).
|
|
465
|
+
|
|
235
466
|
### 5.0.0
|
|
236
467
|
|
|
237
468
|
Separates the decision logic from the devices it drives, adds a Shelly cover
|
|
@@ -395,7 +626,8 @@ Version 3.0 changed some behaviour, and later versions added to it. Check these
|
|
|
395
626
|
the topics it publishes. A theatre state contract added from now on doesn't need one for Home Assistant
|
|
396
627
|
discovery: its entity IDs then come from its display name. With an area, it suggests that area to Home Assistant,
|
|
397
628
|
which creates it if no area of that name exists. One saved before needs an area for discovery, as before. A room
|
|
398
|
-
lighting controller with no area still controls its lights
|
|
629
|
+
lighting controller with no area still controls its lights only with state publishing and discovery both off;
|
|
630
|
+
with either on (or unset, as on a room saved before 3.0), it reports an invalid configuration.
|
|
399
631
|
- **MQTT state publishing and Home Assistant discovery are opt-in** on the room lighting controller and the theatre
|
|
400
632
|
state contract. New nodes start with them off. Nodes in a flow saved before 3.0 keep publishing until you untick
|
|
401
633
|
the setting. Switching discovery off removes the entities from Home Assistant.
|
|
@@ -433,9 +665,16 @@ Version 3.0 changed some behaviour, and later versions added to it. Check these
|
|
|
433
665
|
publishing off entirely, are cleared only from the record. A node that never gets a startup message
|
|
434
666
|
keeps clearing its old topics at every start, so to move an area from one older room node to another, send the old
|
|
435
667
|
node a startup message, or delete it.
|
|
436
|
-
- **Send each publishing node
|
|
437
|
-
|
|
438
|
-
|
|
668
|
+
- **Send each publishing node its startup message once MQTT out has connected: wire in a Status node.** Node-RED's
|
|
669
|
+
MQTT broker node connects after the flows have started and drops anything it is given before then, without a
|
|
670
|
+
warning, so what a node announces as the flows start (its availability, discovery and state) is lost on a first
|
|
671
|
+
start, a full deploy or a restart. Add a **Status node** whose scope is your MQTT out node and wire it into each
|
|
672
|
+
publishing node (room, circadian policy, house schedule MQTT, motion, occupancy, cover controller, AVR controller,
|
|
673
|
+
theatre state contract, Shelly switch). Each time MQTT out shows "connected", including after the broker
|
|
674
|
+
reconnects, the Status node passes it on, and the node takes it as its startup message. Other status messages are
|
|
675
|
+
ignored, so a Status node watching every node on the flow works too; the example flows use one. Since 6.0.1; before
|
|
676
|
+
that, the examples sent the startup message from an inject node 3 seconds after a deploy, which is lost if the
|
|
677
|
+
broker takes longer. A node still takes its own startup message (each node's section gives it).
|
|
439
678
|
- **Removing entities:** deleting a node clears its Home Assistant entities and retained state, but only when you
|
|
440
679
|
deploy with "Modified nodes" or "Modified flows". On a full deploy (the deploy button's default), Node-RED stops the
|
|
441
680
|
MQTT out node at the same moment, so the clearing never reaches the broker. Disabling a node or its flow keeps its
|
|
@@ -450,8 +689,9 @@ Version 3.0 changed some behaviour, and later versions added to it. Check these
|
|
|
450
689
|
restart or a shutdown, Node-RED stops the MQTT out node at the same moment and reconnects to the broker afterwards,
|
|
451
690
|
so set the MQTT broker node's **Birth message** to `online`, and its **Close message** and **Will message** (which
|
|
452
691
|
covers crashes) to `offline`, all retained, on the same topic; with several publishing nodes, the broker can cover
|
|
453
|
-
one of them.
|
|
454
|
-
|
|
692
|
+
one of them. With discovery on, each publishing node also announces its Home Assistant entries once the flows have
|
|
693
|
+
started, just before its `online`, and again at its startup message. The theatre's readiness (`unknown`,
|
|
694
|
+
`available`, `degraded` or `unavailable`), which used `<base>/availability` before, is now on `<base>/readiness`.
|
|
455
695
|
|
|
456
696
|
## Theatre MQTT contract
|
|
457
697
|
|
|
@@ -525,16 +765,16 @@ Without a context store, after a node is redeployed or Node-RED restarts:
|
|
|
525
765
|
|
|
526
766
|
- **A room forgets which lights are held or manual:** every light an activity
|
|
527
767
|
held, or a person set by hand, is back under the room's control, so the next
|
|
528
|
-
|
|
768
|
+
style restyles an activity's lights and lights a person set.
|
|
529
769
|
- **Changes made at runtime go back to the node's settings:** for example motion
|
|
530
|
-
lighting's enable, vacancy delay and lux cutoff, a
|
|
531
|
-
sleep, and wake and bed times, and the house schedule's
|
|
532
|
-
Assistant or a message.
|
|
770
|
+
lighting's enable, vacancy delay and lux cutoff, a circadian policy's
|
|
771
|
+
circadian lighting, sleep, and wake and bed times, and the house schedule's
|
|
772
|
+
times, set from Home Assistant or a message.
|
|
533
773
|
- **The theatre starts its counts again:** its counters and operational SLO
|
|
534
774
|
samples restart, and the activity controller no longer knows the current
|
|
535
|
-
activity.
|
|
536
|
-
|
|
537
|
-
|
|
775
|
+
activity. The activity is unknown, and the devices are left alone, until the
|
|
776
|
+
next request. Working the activity out from what the devices report after a
|
|
777
|
+
cold start is [issue #179](https://github.com/avantics-hq/node-red-home-automation/issues/179).
|
|
538
778
|
- **Work in progress is not recovered:** a motion off-timer that was running,
|
|
539
779
|
or a theatre device change still being confirmed. The node starts afresh
|
|
540
780
|
and goes by what it next observes.
|
|
@@ -547,23 +787,28 @@ Without a context store, after a node is redeployed or Node-RED restarts:
|
|
|
547
787
|
|
|
548
788
|
The room lighting controller gives each target one control state:
|
|
549
789
|
|
|
550
|
-
- `in-control`:
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
-
|
|
790
|
+
- `in-control`: the room styles the light with the style it is sent, such as a
|
|
791
|
+
circadian lighting policy's (the default).
|
|
792
|
+
- `overridden`: another owner, such as an activity or a scene, holds the light
|
|
793
|
+
on or off; styles and owner-less intents leave it alone until it is released.
|
|
794
|
+
- `manual`: a person changed the light: an intent with `manual: true` (a wall
|
|
795
|
+
switch's double press), or someone else's command with values on its command
|
|
796
|
+
topic. An intent's values alone don't make a light manual. Switching circadian
|
|
797
|
+
lighting on returns manual lights to `in-control`.
|
|
554
798
|
|
|
555
799
|
The control states live in the node's context. A room controller that starts
|
|
556
800
|
with nothing saved (its first deploy, or a redeploy or restart without a
|
|
557
801
|
context store) can't know which lights an activity held or a person set, so it
|
|
558
|
-
leaves every light as it is:
|
|
559
|
-
|
|
802
|
+
leaves every light as it is: a style restyles a light again only once an
|
|
803
|
+
intent or release names it, someone switches it on with a bare ON, or
|
|
560
804
|
circadian lighting is switched on. A light that is on at that start and that
|
|
561
805
|
nothing names can keep its start-time style all day; to bring it back into step,
|
|
562
806
|
switch circadian lighting on (for example with the Home Assistant circadian
|
|
563
807
|
switch), or let motion or a wall switch name it.
|
|
564
808
|
|
|
565
|
-
Add `owner` to an intent to
|
|
566
|
-
`preserveManual: true`,
|
|
809
|
+
Add `owner` to an intent to hold its targets, on or off: an owner's OFF keeps
|
|
810
|
+
the light off, so motion can't switch it back on. With `preserveManual: true`,
|
|
811
|
+
manual lights are skipped:
|
|
567
812
|
|
|
568
813
|
```js
|
|
569
814
|
msg.lighting = {
|
|
@@ -578,14 +823,15 @@ msg.lighting = {
|
|
|
578
823
|
```
|
|
579
824
|
|
|
580
825
|
An intent's `values` use the package's own units: `brightnessPct` (0-100) and
|
|
581
|
-
`colorTempKelvin`.
|
|
582
|
-
|
|
826
|
+
`colorTempKelvin`. Each light's adapter converts them for the light (a
|
|
827
|
+
zigbee2mqtt light, to its 1-254 brightness and mireds); other fields, such as
|
|
583
828
|
`effect`, are passed on as they are. `brightnessPct: 0` is the dimmest the
|
|
584
829
|
light goes, not off: send `state: "OFF"` to switch it off. A value that isn't a
|
|
585
830
|
number (a numeric string such as `"50"` counts), or a colour temperature of 0
|
|
586
|
-
or less, is left out with a warning in the log.
|
|
587
|
-
|
|
588
|
-
room controller logs a warning once per
|
|
831
|
+
or less, is left out with a warning in the log. Zigbee2MQTT's own `brightness`
|
|
832
|
+
and `color_temp`, which 5.x still took, were removed in 6.0: they are left out
|
|
833
|
+
and never reach the light, and the room controller logs a warning once per
|
|
834
|
+
deploy.
|
|
589
835
|
|
|
590
836
|
`home-activity-lighting-controller` does this itself: while a profile is active
|
|
591
837
|
it overrides that profile's lights under its configured owner (default
|
|
@@ -596,22 +842,42 @@ hands back lights the other still holds. A flow that sets its own `owner` must
|
|
|
596
842
|
set it on every lighting message from the node, releases included, or leave it
|
|
597
843
|
to the node's Owner setting.
|
|
598
844
|
|
|
845
|
+
Owners stack, per light. The first owner to take a light records what it was:
|
|
846
|
+
its control state, whether it was on, and the brightness and colour temperature
|
|
847
|
+
it last reported. A newer owner goes on top and sets the light; the owner
|
|
848
|
+
beneath keeps its own request, and sending again updates it without changing
|
|
849
|
+
the light.
|
|
850
|
+
|
|
599
851
|
Release overridden targets (default: all; with `owner`, only that owner's
|
|
600
|
-
lights)
|
|
852
|
+
lights):
|
|
601
853
|
|
|
602
854
|
```js
|
|
603
855
|
msg.lighting = {kind: "release", targets: ["wall", "lamp"], owner: "theatre"};
|
|
604
856
|
```
|
|
605
857
|
|
|
858
|
+
- Releasing the owner on top hands the light to the owner beneath, with what
|
|
859
|
+
that owner last asked for.
|
|
860
|
+
- Releasing an owner beneath a newer one just drops it; the light is left as
|
|
861
|
+
it is.
|
|
862
|
+
- When the last owner lets go (or a release without `owner`), the light goes
|
|
863
|
+
back to what was recorded. A light the room was running is the room's again,
|
|
864
|
+
on or off as it was: on, it takes the room's style as it is now (over the
|
|
865
|
+
style's own transition if it was still on, the room's turn-on transition if
|
|
866
|
+
it was held off). A light that was off goes off. A light a person had set
|
|
867
|
+
gets the brightness and colour temperature it last reported, and stays
|
|
868
|
+
`manual`.
|
|
869
|
+
|
|
606
870
|
A held (`overridden`) light changes only for an intent with an `owner` (its own,
|
|
607
871
|
or a newer owner who takes it over), a person (`manual: true`, an external
|
|
608
|
-
command on the
|
|
872
|
+
command on the light (from its adapter), or a change seen at the light), or a release.
|
|
609
873
|
Other intents, such as motion ON or OFF and owner-less values, leave it alone
|
|
610
874
|
and are traced as `ignored held-by`; their other targets are still handled.
|
|
611
875
|
The switch policy marks presses with `person: true`. Owner-less
|
|
612
876
|
intents, with or without values, reach a held light only with `manual: true` or
|
|
613
877
|
`person: true`; a flow acting for a person, such as a dashboard, sets one.
|
|
614
|
-
|
|
878
|
+
A person switching a held light off returns it to `in-control`; a person
|
|
879
|
+
switching on a light an owner holds off makes it `manual`. Either way it leaves
|
|
880
|
+
every owner, and their later releases leave it alone. With
|
|
615
881
|
**Publish state over MQTT** on (new nodes start with it off; nodes saved before
|
|
616
882
|
the setting existed keep it on), on startup and whenever a target's state
|
|
617
883
|
changes, the controller sends a retained message on its command output:
|
|
@@ -621,17 +887,86 @@ changes, the controller sends a retained message on its command output:
|
|
|
621
887
|
```
|
|
622
888
|
|
|
623
889
|
Flows that filter that output by topic must pass the `/control` topics through.
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
890
|
+
With discovery on, Home Assistant gets a diagnostic sensor per light showing
|
|
891
|
+
its control state, with the owner as an attribute.
|
|
892
|
+
|
|
893
|
+
The circadian lighting policy publishes the circadian state on
|
|
894
|
+
`home/<area>/circadian/state`, and acts on ON or OFF sent to
|
|
895
|
+
`home/<area>/circadian/set`, which is where the Home Assistant circadian switch
|
|
896
|
+
sends them: wire an MQTT in node subscribed to that topic into the policy. In
|
|
897
|
+
the same way it publishes and acts on sleep (`home/<area>/sleep/state` and
|
|
898
|
+
`/set`, ON or OFF) and its wake and bed times (`home/<area>/wake-time/state`
|
|
899
|
+
and `/set`, likewise `bed-time`, as `HH:MM:SS`); subscribing to
|
|
900
|
+
`home/<area>/+/set` covers all four. These are the topics the room controller
|
|
901
|
+
used before 6.0. A time set from Home Assistant lasts until the node is
|
|
902
|
+
deployed with a different setting for it. With discovery on, Home Assistant
|
|
903
|
+
gets Circadian lighting and Sleep switches and, with its own times, Wake time
|
|
904
|
+
and Bed time entities, on the policy's own device. The policy's publishing is
|
|
905
|
+
off until you switch it on.
|
|
906
|
+
|
|
907
|
+
## Neutral light contract
|
|
908
|
+
|
|
909
|
+
The room lighting controller speaks to each light through an adapter on
|
|
910
|
+
`msg.light`. The **zigbee2mqtt light** node is one; for any other kind of light,
|
|
911
|
+
a flow (or your own node) that answers the same messages works in its place.
|
|
912
|
+
Every message names its `target`: the light's id in the room's Targets JSON.
|
|
913
|
+
Values are the package's own: brightness in percent, colour temperature in
|
|
914
|
+
kelvin.
|
|
915
|
+
|
|
916
|
+
From the room (its second output), to every light's adapter, each acting only on
|
|
917
|
+
its own target:
|
|
918
|
+
|
|
919
|
+
```js
|
|
920
|
+
// Switch a light, with values when given.
|
|
921
|
+
msg.light = {
|
|
922
|
+
kind: "command", target: "ceiling", state: "ON" | "OFF",
|
|
923
|
+
brightnessPct?: number, // 0-100: 0 is the dimmest, not off
|
|
924
|
+
colorTempKelvin?: number, // above 0
|
|
925
|
+
transitionSeconds?: number, // the fade
|
|
926
|
+
extra?: {effect: "blink"}, // other fields an intent gave, to pass on as they are
|
|
927
|
+
restyle?: true, // a restyle of a light already on (see "skipped")
|
|
928
|
+
source: "motion", // who asked
|
|
929
|
+
id: "42" // the room's id for this command
|
|
930
|
+
};
|
|
931
|
+
// Ask for a fresh reading (the room sends one per light at its startup message).
|
|
932
|
+
msg.light = {kind: "observe", target: "ceiling"};
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
An OFF carries no values. A light marked `onOffOnly` is never sent values or a
|
|
936
|
+
transition.
|
|
937
|
+
|
|
938
|
+
From the adapter, into the room's input:
|
|
939
|
+
|
|
940
|
+
```js
|
|
941
|
+
// The light's own report, whenever it reports.
|
|
942
|
+
msg.light = {kind: "observed", target, on: true,
|
|
943
|
+
brightnessPct?: 25.2, colorTempKelvin?: 2500, // what it shows, as it reported it
|
|
944
|
+
fields: ["brightness", "colorTemp"], // what it reports at all, since start
|
|
945
|
+
showsLast: true, // it shows exactly the last command sent to it
|
|
946
|
+
observedAt: "<ISO time>"};
|
|
947
|
+
// Someone else's command on the light (power ON, OFF, TOGGLE or "", and whether it sets values).
|
|
948
|
+
msg.light = {kind: "external", target, state: "ON", setsValues: false, observedAt};
|
|
949
|
+
// One of the room's own commands, seen again changed on the way.
|
|
950
|
+
msg.light = {kind: "echo-changed", target, id, state: "ON"}; // id null when the adapter has sent nothing it knows of
|
|
951
|
+
// Every restyle answered: skipped, as the light already shows it (with its last report's time), or sent.
|
|
952
|
+
msg.light = {kind: "skipped", target, id, observedAt};
|
|
953
|
+
msg.light = {kind: "sent", target, id};
|
|
954
|
+
// Whether the light is reachable: shown, never acted on.
|
|
955
|
+
msg.light = {kind: "availability", target, online: true};
|
|
956
|
+
```
|
|
957
|
+
|
|
958
|
+
What the room expects of an adapter:
|
|
959
|
+
- **Its own commands:** never report the light's echo of the room's own command
|
|
960
|
+
as someone else's. An ON or OFF arriving while one of its own with that power
|
|
961
|
+
hasn't come back counts as its own, changed on the way.
|
|
962
|
+
- **Someone else's commands:** report them as `external`; with `setsValues`,
|
|
963
|
+
the room takes the light as a person's change.
|
|
964
|
+
- **Restyles:** answer every `restyle` command with `skipped` or `sent`. Only
|
|
965
|
+
ever skip a restyle, and only when the light already shows it.
|
|
966
|
+
- **Matching:** `showsLast` and `skipped` are judged in the device's own units.
|
|
967
|
+
The room and activity lighting never compare values themselves.
|
|
968
|
+
- **No reading support:** an adapter that can't ask its light for a reading
|
|
969
|
+
ignores `observe`.
|
|
635
970
|
|
|
636
971
|
## Receiver volume ownership
|
|
637
972
|
|
|
@@ -650,10 +985,11 @@ msg.avr = {
|
|
|
650
985
|
Volume is in dB: `valueDb` is the volume for `absolute`, or the change for
|
|
651
986
|
`relative`, and the bounds, results, published state and Home Assistant
|
|
652
987
|
number are in dB too. The controller converts for the receiver (for a Denon,
|
|
653
|
-
whose 0-98 has 80 at 0 dB, -80 to +18 dB in half steps).
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
988
|
+
whose 0-98 has 80 at 0 dB, -80 to +18 dB in half steps). A request with
|
|
989
|
+
`value` in the receiver's own 0-98, which 5.x still took, is rejected
|
|
990
|
+
(`volume_rejected`, reason `removed-volume-value`) with a warning in the log,
|
|
991
|
+
and a node whose bounds are still only **minVolume** and **maxVolume** is an
|
|
992
|
+
invalid configuration until its dB bounds are set.
|
|
657
993
|
|
|
658
994
|
`mode` may be `absolute` or `relative`. The controller resolves relative input
|
|
659
995
|
from fresh observed volume, accumulates rapid requests against the pending
|
|
@@ -696,7 +1032,7 @@ Each example uses synthetic identifiers and configuration, asserts its central i
|
|
|
696
1032
|
|
|
697
1033
|
## Configuration and security
|
|
698
1034
|
|
|
699
|
-
The repository contains no home-network addresses, deployment coordinates, or live credentials. Device hosts
|
|
1035
|
+
The repository contains no home-network addresses, deployment coordinates, or live credentials. Device hosts are required configuration where applicable.
|
|
700
1036
|
|
|
701
1037
|
The display controller stores its TV pre-shared key as a Node-RED credential. Keep credentials in Node-RED's encrypted credential store rather than flow fields or repository files.
|
|
702
1038
|
|