@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
@@ -40,8 +40,8 @@ const registerAvrController = (RED) => {
40
40
  discoveryPrefix: (0, ha_discovery_1.discoveryPrefixSetting)(config.discoveryPrefix),
41
41
  nodeId: node.id,
42
42
  idScheme: (0, settings_1.optionalChoiceSetting)(config.idScheme, "ID scheme", ha_discovery_1.ID_SCHEMES) ?? "node",
43
- minVolume: controllerConfig.minVolume,
44
- maxVolume: controllerConfig.maxVolume
43
+ minVolumeDb: controllerConfig.minVolumeDb,
44
+ maxVolumeDb: controllerConfig.maxVolumeDb
45
45
  };
46
46
  }
47
47
  catch (error) {
@@ -70,8 +70,10 @@ const registerAvrController = (RED) => {
70
70
  process({ avr: { kind: "tick" } }, node.send.bind(node));
71
71
  }), delay);
72
72
  }
73
+ // As the reducer restores it, so a state saved before 5.0 is published in dB.
73
74
  function observed() {
74
- return context.get("state")?.observed;
75
+ const saved = context.get("state");
76
+ return saved ? (0, avr_controller_1.createAvrState)(controllerConfig, saved).observed : undefined;
75
77
  }
76
78
  // MQTT publications go on the third output, apart from the receiver's
77
79
  // commands and the theatre's events. Available, and clear of what it no
@@ -85,6 +87,7 @@ const registerAvrController = (RED) => {
85
87
  output: 2,
86
88
  outputs: 3
87
89
  });
90
+ let warnedRemovedVolume = false;
88
91
  function process(msg, send) {
89
92
  const before = observed();
90
93
  const result = (0, adapter_1.runReducer)(node, { area: controllerConfig.area, component: "avr-controller" }, (saved, now) => (0, avr_controller_1.transitionAvr)(saved, msg, controllerConfig, now));
@@ -92,6 +95,13 @@ const registerAvrController = (RED) => {
92
95
  payload: Buffer.from(command.payload, "utf8"),
93
96
  avr_command: command.avrCommand
94
97
  }));
98
+ // Once per deploy, so a flow still sending the receiver's own units is
99
+ // told without filling the log.
100
+ if (!warnedRemovedVolume && result.events.some(({ avr }) => avr.kind === "volume_rejected" && avr.reason === avr_controller_1.REMOVED_VOLUME_VALUE)) {
101
+ warnedRemovedVolume = true;
102
+ node.warn("volume requests with value in the receiver's own 0-98 were removed in 6.0 and are rejected: " +
103
+ "send valueDb (dB, where the receiver's 80 is 0 dB) instead");
104
+ }
95
105
  const outputs = [...result.events, ...result.targetStates];
96
106
  if (commands.length || outputs.length) {
97
107
  send([
@@ -123,9 +133,9 @@ const registerAvrController = (RED) => {
123
133
  // to the last one first.
124
134
  let volumeRequests = 0;
125
135
  let volumeSetTimer;
126
- function requestVolume(value) {
136
+ function requestVolume(valueDb) {
127
137
  volumeRequests += 1;
128
- process({ avr: { kind: "volume", requestId: `mqtt-volume-${Date.now()}-${volumeRequests}`, mode: "absolute", value } }, node.send.bind(node));
138
+ process({ avr: { kind: "volume", requestId: `mqtt-volume-${Date.now()}-${volumeRequests}`, mode: "absolute", valueDb } }, node.send.bind(node));
129
139
  }
130
140
  (0, adapter_1.onInput)(node, (msg, send) => {
131
141
  const volume = (0, avr_publishing_1.avrVolumeRequest)(msg, publishing);
@@ -137,7 +147,7 @@ const registerAvrController = (RED) => {
137
147
  clearTimeout(volumeSetTimer);
138
148
  volumeSetTimer = setTimeout((0, adapter_1.guarded)(node, () => {
139
149
  volumeSetTimer = undefined;
140
- requestVolume(volume.value);
150
+ requestVolume(volume.valueDb);
141
151
  }), avr_publishing_1.VOLUME_SET_SETTLE_MS);
142
152
  return;
143
153
  }
@@ -0,0 +1,3 @@
1
+ import type { NodeInitializer } from "node-red";
2
+ declare const registerCircadianPolicy: NodeInitializer;
3
+ export = registerCircadianPolicy;
@@ -0,0 +1,140 @@
1
+ <script type="text/javascript">
2
+ (function () {
3
+ function clockTime(v) { return /^([01]\d|2[0-3]):[0-5]\d$/.test(String(v || "")); }
4
+ RED.nodes.registerType("home-circadian-lighting-policy", {
5
+ category: "home automation",
6
+ color: "#ffd27f",
7
+ defaults: {
8
+ name: {value: ""},
9
+ // Required only when the node publishes, and then with a letter or
10
+ // digit, from which its topics are made.
11
+ area: {value: "", validate: function (v) {
12
+ var publishing = $("#node-input-publishState").length
13
+ ? $("#node-input-publishState").prop("checked") || $("#node-input-discovery").prop("checked")
14
+ : this.publishState === true || this.discovery === true;
15
+ return !publishing || /[a-z0-9]/i.test(String(v || ""));
16
+ }},
17
+ // The house schedule it follows; none: its own wake and bed times.
18
+ houseSchedule: {value: "", type: "home-house-schedule", required: false},
19
+ wakeTime: {value: "07:00", validate: function (v) { return Boolean(this.houseSchedule) || clockTime(v); }},
20
+ bedTime: {value: "23:00", validate: function (v) { return Boolean(this.houseSchedule) || clockTime(v); }},
21
+ maxBrightnessPct: {value: 100, required: true, validate: RED.validators.number()},
22
+ maxColorTempKelvin: {value: 6500, required: true, validate: RED.validators.number()},
23
+ sleepBrightnessPct: {value: 1, required: true, validate: RED.validators.number()},
24
+ sleepColorTempKelvin: {value: 2200, required: true, validate: RED.validators.number()},
25
+ refreshTransitionSeconds: {value: 60, required: true, validate: RED.validators.number()},
26
+ refreshSeconds: {value: 60, required: true, validate: function (v) { return RED.validators.number()(v) && Number(v) >= 10; }},
27
+ initialSleep: {value: false},
28
+ publishState: {value: false},
29
+ discovery: {value: false},
30
+ discoveryPrefix: {value: "homeassistant", required: true, validate: function (v) { var prefix = String(v || "").trim().replace(/^\/+|\/+$/g, ""); return Boolean(prefix) && !/[+#]/.test(prefix); }},
31
+ // A new node, so its Home Assistant entities are named after it.
32
+ idScheme: {value: "node"}
33
+ },
34
+ oneditprepare: function () {
35
+ // Discovery describes the published state, so it needs it.
36
+ function follow() {
37
+ var publishing = $("#node-input-publishState").prop("checked");
38
+ if (!publishing) $("#node-input-discovery").prop("checked", false);
39
+ $("#node-input-discovery").prop("disabled", !publishing);
40
+ $("#node-input-area").trigger("change");
41
+ }
42
+ $("#node-input-publishState, #node-input-discovery").on("change", follow);
43
+ follow();
44
+ // Following a house, the times are the house's.
45
+ function times() {
46
+ var own = !$("#node-input-houseSchedule").val() || $("#node-input-houseSchedule").val() === "_ADD_";
47
+ $(".circadian-own-times").toggle(own);
48
+ }
49
+ $("#node-input-houseSchedule").on("change", times);
50
+ times();
51
+ },
52
+ inputs: 1,
53
+ outputs: 2,
54
+ outputLabels: ["style, to room lighting controllers", "publications (MQTT out)"],
55
+ icon: "font-awesome/fa-sun-o",
56
+ label: function () { return this.name || (this.area ? this.area + " " : "") + "circadian lighting"; }
57
+ });
58
+ })();
59
+ </script>
60
+
61
+ <script type="text/html" data-template-name="home-circadian-lighting-policy">
62
+ <div class="form-row"><label for="node-input-name">Name</label><input type="text" id="node-input-name"></div>
63
+ <div class="form-row"><label for="node-input-houseSchedule">Schedule</label><input type="text" id="node-input-houseSchedule"></div>
64
+ <div class="form-row circadian-own-times"><label for="node-input-wakeTime">Wake time</label><input type="text" id="node-input-wakeTime" placeholder="07:00"></div>
65
+ <div class="form-row circadian-own-times"><label for="node-input-bedTime">Bed time</label><input type="text" id="node-input-bedTime" placeholder="23:00"></div>
66
+ <div class="form-row"><label for="node-input-maxBrightnessPct">Daytime brightness %</label><input type="number" id="node-input-maxBrightnessPct"></div>
67
+ <div class="form-row"><label for="node-input-maxColorTempKelvin">Daytime kelvin</label><input type="number" id="node-input-maxColorTempKelvin"></div>
68
+ <div class="form-row"><label for="node-input-sleepBrightnessPct">Sleep brightness %</label><input type="number" id="node-input-sleepBrightnessPct"></div>
69
+ <div class="form-row"><label for="node-input-sleepColorTempKelvin">Sleep kelvin</label><input type="number" id="node-input-sleepColorTempKelvin"></div>
70
+ <div class="form-row"><label for="node-input-refreshTransitionSeconds">Restyle transition (s)</label><input type="number" id="node-input-refreshTransitionSeconds"></div>
71
+ <div class="form-row"><label for="node-input-refreshSeconds">Restyle interval (s)</label><input type="number" min="10" id="node-input-refreshSeconds"></div>
72
+ <div class="form-row"><label for="node-input-initialSleep">Start in sleep mode</label><input type="checkbox" id="node-input-initialSleep" style="display:inline-block; width:auto;"></div>
73
+ <div class="form-row"><label for="node-input-area">Area</label><input type="text" id="node-input-area" placeholder="needed when publishing"></div>
74
+ <div class="form-row"><label for="node-input-publishState">Publish state over MQTT</label><input type="checkbox" id="node-input-publishState" style="display:inline-block; width:auto;"></div>
75
+ <div class="form-row"><label for="node-input-discovery">Home Assistant discovery</label><input type="checkbox" id="node-input-discovery" style="display:inline-block; width:auto;"> <span>(needs Publish state)</span></div>
76
+ <div class="form-row"><label for="node-input-discoveryPrefix">Discovery prefix</label><input type="text" id="node-input-discoveryPrefix"></div>
77
+ </script>
78
+
79
+ <script type="text/html" data-help-name="home-circadian-lighting-policy">
80
+ <p>Works out how lights should look over the day and sends it to room lighting controllers as a <i>style</i>: a
81
+ brightness and colour temperature for lights that nobody has set otherwise. Wire its first output to one or more
82
+ room lighting controllers. A room without it styles nothing: its lights just go on and off.</p>
83
+ <p>The lights rise to the daytime level over the hour after waking, stay there through the day, and wind down to
84
+ the sleep levels over the three hours before bed. Sleep mode holds the sleep levels whatever the time. Times are
85
+ the Node-RED host's local time.</p>
86
+ <h3>What a room does with a style</h3>
87
+ <p>A style is not a request to change a light: it never switches one on or off, and never reaches a light that an
88
+ owner (such as an activity) holds or a person set. A room uses it when a light it controls comes on with no values
89
+ given (motion, a wall-switch press), on each new style for lights that are on, after someone else's bare ON, and
90
+ when an owner releases a light. Switching circadian lighting on is the one exception: it takes back the lights a
91
+ person set, even when it is already on, so a flow can send it to bring lights back into step.</p>
92
+ <p>It sends a style once the flows start, every <b>Restyle interval</b>, at its startup message, and at once when
93
+ circadian lighting, sleep or the times change. Each style lasts three intervals: if the policy stops (deleted,
94
+ disabled, or its flow stopped), rooms stop styling soon after. Deleted with a modified deploy, it tells rooms at
95
+ once. While circadian lighting is off it sends a style with no values, and rooms style nothing.</p>
96
+ <h3>Inputs</h3>
97
+ <dl class="message-properties">
98
+ <dt>lighting.kind = "circadian" or "sleep"</dt>
99
+ <dd><code>lighting.enabled</code> <code>true</code> or <code>false</code> switches circadian lighting or sleep. Any
100
+ other value, such as <code>"on"</code>, is refused: nothing changes, and the node logs a warning once per deploy
101
+ and shows it on its status.</dd>
102
+ <dt>lighting.kind = "schedule"</dt>
103
+ <dd><code>lighting.wakeTime</code> and <code>lighting.bedTime</code>, <code>"HH:MM"</code>, either alone. A time set
104
+ this way lasts until the node is deployed with a different setting for it.</dd>
105
+ <dt>lighting.kind = "startup"</dt>
106
+ <dd>Sends the style, and with publishing on, its availability, state and discovery. Send it a few seconds after
107
+ the flows start, as the examples do.</dd>
108
+ <dt>topic = home/&lt;area&gt;/circadian/set, home/&lt;area&gt;/sleep/set</dt>
109
+ <dd><code>ON</code> or <code>OFF</code> from Home Assistant, as <code>lighting.kind = "circadian"</code> or
110
+ <code>"sleep"</code> does. Read only while <b>Publish state</b> is on. Retained messages and other payloads are
111
+ ignored.</dd>
112
+ <dt>topic = home/&lt;area&gt;/wake-time/set or bed-time/set</dt>
113
+ <dd>A time from Home Assistant, with its own times only.</dd>
114
+ </dl>
115
+ <h3>Outputs</h3>
116
+ <ol class="node-ports">
117
+ <li>Style, to room lighting controllers: <code>msg.lighting = {kind: "style", source: "circadian", values:
118
+ {brightnessPct, colorTempKelvin} | null, transitionSeconds, until, takeBack?}</code>.</li>
119
+ <li>Publications, to an MQTT out node with no topic set: availability on
120
+ <code>home/&lt;area&gt;/circadian/availability</code>, the circadian and sleep state on
121
+ <code>home/&lt;area&gt;/circadian/state</code> and <code>home/&lt;area&gt;/sleep/state</code>, its own wake and
122
+ bed times on <code>home/&lt;area&gt;/wake-time/state</code> and <code>…/bed-time/state</code>, and discovery.</li>
123
+ </ol>
124
+ <h3>Settings</h3>
125
+ <dl class="message-properties">
126
+ <dt>Schedule</dt><dd>A house schedule, so several rooms share one wake and bed time; none uses its own
127
+ <b>Wake time</b> and <b>Bed time</b>. Following a house, it has no time entities of its own: the house schedule
128
+ MQTT node offers them.</dd>
129
+ <dt>Daytime and sleep brightness and kelvin</dt><dd>The levels at full day and in sleep.</dd>
130
+ <dt>Restyle transition</dt><dd>How long a room takes to move a light that is on to a new style. A light turning
131
+ on uses the room's own transition.</dd>
132
+ <dt>Restyle interval</dt><dd>How often it sends its style, at least 10 seconds.</dd>
133
+ <dt>Publish state over MQTT, Home Assistant discovery</dt><dd>Off unless switched on. With both on, Home Assistant
134
+ shows Circadian lighting and Sleep switches and, with its own times, Wake time and Bed time, named after this
135
+ node. The topics keep the names the room controller used before 6.0, so a flow already writing
136
+ <code>home/&lt;area&gt;/circadian/set</code> keeps working when this node has that area. Before announcing, it
137
+ clears the circadian entities older room controllers in its area published, migrated or not, in the same batch,
138
+ so Home Assistant can give the new ones the same entity IDs.</dd>
139
+ </dl>
140
+ </script>
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ const circadian_1 = require("../lib/circadian");
3
+ const circadian_policy_1 = require("../lib/circadian-policy");
4
+ const circadian_publishing_1 = require("../lib/circadian-publishing");
5
+ const circadian_schedule_1 = require("../lib/circadian-schedule");
6
+ const ha_discovery_1 = require("../lib/ha-discovery");
7
+ const publishing_node_1 = require("../lib/publishing-node");
8
+ const settings_1 = require("../lib/settings");
9
+ const topic_names_1 = require("../lib/topic-names");
10
+ const adapter_1 = require("./adapter");
11
+ const publishing_lifecycle_1 = require("./publishing-lifecycle");
12
+ const refused_enable_1 = require("./refused-enable");
13
+ const shared_schedule_1 = require("./shared-schedule");
14
+ const registerCircadianPolicy = (RED) => {
15
+ function HomeCircadianLightingPolicy(config) {
16
+ RED.nodes.createNode(this, config);
17
+ const node = this;
18
+ const context = node.context();
19
+ let tickTimer;
20
+ // A schedule that is set but not running, as when it was deleted: the
21
+ // policy keeps to its own times and says so.
22
+ const { schedule: house, missing: houseMissing } = (0, shared_schedule_1.referencedSchedule)(RED, config.houseSchedule);
23
+ let policyConfig;
24
+ let publishing;
25
+ try {
26
+ const area = (0, adapter_1.optionalArea)(config);
27
+ const levels = {
28
+ maxBrightnessPct: (0, settings_1.numberSetting)(config.maxBrightnessPct, "daytime brightness", 100),
29
+ maxColorTempKelvin: (0, settings_1.numberSetting)(config.maxColorTempKelvin, "daytime colour temperature", 6500),
30
+ sleepBrightnessPct: (0, settings_1.numberSetting)(config.sleepBrightnessPct, "sleep brightness", 1),
31
+ sleepColorTempKelvin: (0, settings_1.numberSetting)(config.sleepColorTempKelvin, "sleep colour temperature", 2200)
32
+ };
33
+ const schedule = house
34
+ ? house.schedule()
35
+ : (0, circadian_schedule_1.resolveSchedule)((0, settings_1.textSetting)(config.wakeTime, "wake time", "07:00"), (0, settings_1.textSetting)(config.bedTime, "bed time", "23:00"));
36
+ policyConfig = {
37
+ lighting: (0, circadian_1.scheduledLighting)(schedule, levels),
38
+ schedule,
39
+ timesFrom: house ? "house" : "own",
40
+ initialSleep: (0, settings_1.booleanSetting)(config.initialSleep, "initial sleep", false),
41
+ transitionSeconds: (0, settings_1.numberSetting)(config.refreshTransitionSeconds, "restyle transition", 60),
42
+ intervalSeconds: Math.max(10, (0, settings_1.numberSetting)(config.refreshSeconds, "restyle interval", 60))
43
+ };
44
+ // Off unless switched on; a new node, so its entities are named after
45
+ // it.
46
+ const publishState = (0, settings_1.optionalBooleanSetting)(config.publishState, "publish state") ?? false;
47
+ const discovery = (0, settings_1.optionalBooleanSetting)(config.discovery, "Home Assistant discovery") ?? false;
48
+ if (publishState || discovery)
49
+ (0, topic_names_1.publishingArea)(area, true);
50
+ publishing = {
51
+ area,
52
+ publishState,
53
+ discovery,
54
+ discoveryPrefix: (0, ha_discovery_1.discoveryPrefixSetting)(config.discoveryPrefix),
55
+ nodeId: node.id,
56
+ // Always named after the node, so its entries never share a topic
57
+ // with the area-named ones older rooms published, which it clears.
58
+ idScheme: "node",
59
+ timesFrom: policyConfig.timesFrom
60
+ };
61
+ }
62
+ catch (error) {
63
+ (0, adapter_1.invalidConfig)(node, error);
64
+ return;
65
+ }
66
+ function savedState() {
67
+ return (0, circadian_policy_1.createCircadianState)(policyConfig, context.get("state"));
68
+ }
69
+ // The room controllers in the flows with this area, migrated or not:
70
+ // their old circadian entries named after them are cleared with this
71
+ // node's own (see circadianStartingOutputs).
72
+ function roomsInArea() {
73
+ const ids = [];
74
+ RED.nodes.eachNode((entry) => {
75
+ const room = entry;
76
+ if (room.type === "home-room-lighting-controller" && typeof room.area === "string" && publishing.area !== "" &&
77
+ (0, topic_names_1.areaId)(room.area) === (0, topic_names_1.areaId)(publishing.area))
78
+ ids.push(room.id);
79
+ });
80
+ return ids;
81
+ }
82
+ // Styles go to rooms on the first output; MQTT publications on the
83
+ // second.
84
+ const lifecycle = (0, publishing_lifecycle_1.publishingLifecycle)(RED, node, {
85
+ retainedTopics: () => (0, circadian_publishing_1.circadianRetainedTopics)(publishing),
86
+ possible: { owner: publishing, topics: () => (0, publishing_node_1.publishesState)(publishing) ? (0, circadian_publishing_1.circadianRetainedTopics)({ ...publishing, publishState: true, discovery: true }) : [] },
87
+ starting: () => (0, circadian_publishing_1.circadianStartingOutputs)(publishing, savedState(), roomsInArea()),
88
+ stopping: () => (0, circadian_publishing_1.circadianStoppingOutputs)(publishing),
89
+ output: 1,
90
+ outputs: 2
91
+ });
92
+ function updateStatus(status) {
93
+ const values = status.values;
94
+ node.status(values
95
+ ? { fill: "green", shape: "dot", text: (status.sleeping ? "sleep" : "day") + " · " +
96
+ Math.round(values.brightnessPct) + "% " + Math.round(values.colorTempKelvin) + "K" +
97
+ (houseMissing ? " · schedule missing: own times" : "") }
98
+ : { fill: "grey", shape: "dot", text: "off" + (houseMissing ? " · schedule missing: own times" : "") });
99
+ }
100
+ const showRefused = (0, refused_enable_1.refusedEnables)(node, (source) => `${source}'s enabled`);
101
+ function process(event, send, inboundTraces = [], fromSetTopic = false) {
102
+ const result = (0, adapter_1.runReducer)(node, { area: publishing.area, component: "circadian-policy" }, (saved, now) => {
103
+ const decided = (0, circadian_policy_1.transitionCircadian)(saved, event, policyConfig, now);
104
+ return { ...decided, traces: [...inboundTraces, ...decided.traces] };
105
+ });
106
+ if (result.style)
107
+ send([{ payload: undefined, lighting: result.style }, null]);
108
+ // Published whenever it changes, and in answer to a set, so Home
109
+ // Assistant shows what is in use.
110
+ if (result.stateChanged || fromSetTopic)
111
+ lifecycle.publish(send, (0, circadian_publishing_1.circadianStateOutputs)(publishing, result.state));
112
+ updateStatus(result.status);
113
+ showRefused(result.traces);
114
+ return result;
115
+ }
116
+ // Once the flows have started: the house's times (this node may have
117
+ // restarted alone) and the style. Its publications go out then too, from
118
+ // the lifecycle.
119
+ (0, adapter_1.whenFlowsStarted)(RED, node, (0, adapter_1.guarded)(node, () => {
120
+ const send = node.send.bind(node);
121
+ if (house)
122
+ process({ kind: "schedule", ...house.schedule() }, send);
123
+ process({ kind: "tick" }, send);
124
+ }));
125
+ if (house) {
126
+ node.on("close", house.subscribe((0, adapter_1.guarded)(node, () => {
127
+ process({ kind: "schedule", ...house.schedule() }, node.send.bind(node));
128
+ })));
129
+ }
130
+ (0, adapter_1.onInput)(node, (msg, send) => {
131
+ const lighting = (0, adapter_1.objectField)(msg, "lighting");
132
+ if (lighting?.kind === "startup") {
133
+ lifecycle.startup(send, (0, circadian_publishing_1.circadianStartingOutputs)(publishing, savedState(), roomsInArea()));
134
+ process({ kind: "tick" }, send);
135
+ return;
136
+ }
137
+ // Home Assistant's set topics become the policy's own events; a flow
138
+ // sends the same shapes the room controller took before 6.0.
139
+ const inbound = (0, circadian_publishing_1.circadianInbound)(msg, publishing);
140
+ if (inbound) {
141
+ process(inbound.event, send, inbound.traces, true);
142
+ }
143
+ else {
144
+ process(lighting ?? { kind: undefined }, send);
145
+ }
146
+ });
147
+ tickTimer = setInterval((0, adapter_1.guarded)(node, () => process({ kind: "tick" }, node.send.bind(node))), policyConfig.intervalSeconds * 1000);
148
+ // Deleted: rooms stop styling at once rather than when the last style
149
+ // runs out.
150
+ node.on("close", (removed, done) => {
151
+ clearInterval(tickTimer);
152
+ if ((0, adapter_1.wasDeleted)(RED, node, removed)) {
153
+ node.send([{ payload: undefined, lighting: { ...(0, circadian_policy_1.styleMessage)(policyConfig, savedState(), new Date()), values: null } }, null]);
154
+ }
155
+ done();
156
+ });
157
+ updateStatus((0, circadian_policy_1.transitionCircadian)(context.get("state"), { kind: "tick" }, policyConfig).status);
158
+ }
159
+ RED.nodes.registerType("home-circadian-lighting-policy", HomeCircadianLightingPolicy);
160
+ };
161
+ module.exports = registerCircadianPolicy;
162
+ //# sourceMappingURL=circadian-policy.js.map
@@ -137,8 +137,8 @@
137
137
  <ol class="node-ports">
138
138
  <li>Device commands, in a neutral shape: <code>msg.cover_command = {operation, position, requestId, generation,
139
139
  attempt}</code>, where <code>operation</code> is <code>set_position</code>, <code>stop</code> or
140
- <code>observe</code> (read the cover now). Map them to your device, as the example flow does for a
141
- Zigbee2MQTT cover.</li>
140
+ <code>observe</code> (read the cover now). Wire them to a device adapter, such as the zigbee2mqtt cover or
141
+ shelly cover node, as the example flows do.</li>
142
142
  <li>State and results: <code>msg.theatre = {kind: "target_state", target: "cover", status, details}</code>, with
143
143
  the confirmed and observed positions and any failure or manual override.</li>
144
144
  <li>Whether the cover is moving, <code>msg.payload</code> <code>true</code> or <code>false</code> with
@@ -159,7 +159,8 @@
159
159
  <code>…/set</code>, and a position on <code>…/position/set</code>, as requests like any other, carried out and
160
160
  confirmed as above; wire an MQTT in node on <code>home/&lt;area&gt;/cover/&lt;name&gt;/+</code> (and
161
161
  <code>…/position/set</code>) into this node. Nothing commands the device through Home Assistant. With
162
- <b>Home Assistant discovery</b>, a cover entity, named after this node.</p>
162
+ <b>Home Assistant discovery</b>, a cover entity named by <b>Name in topics</b>, with open, close and stop, and
163
+ for a position cover also its position and set position.</p>
163
164
  <h3>Open, close and stop only</h3>
164
165
  <p>For a motor with no reliable position, set <b>Cover</b> to <i>Open, close and stop only</i>. It takes
165
166
  <code>"open"</code>, <code>"close"</code> and <code>"stop"</code> (positions and presets are ignored), and sends
@@ -7,8 +7,23 @@
7
7
  area: {value: ""},
8
8
  tvHost: {value: "", required: true},
9
9
  screenHost: {value: "", required: true},
10
- projectorMeterHost: {value: "", required: true},
11
- screenOpenPosition: {value: 82, required: true, validate: RED.validators.number()},
10
+ // Optional: without one, the flow reports the projector's power. A node
11
+ // still naming only the old key is invalid until this is set.
12
+ projectorPowerMeterHost: {value: "", validate: function (v) {
13
+ return String(v || "").trim() !== "" || String(this.projectorMeterHost || "").trim() === "";
14
+ }},
15
+ // The name before 5.0, removed in 6.0 but kept here, with no form row,
16
+ // so the editor carries it: dropped, a deploy from the editor would
17
+ // quietly switch the node to having no built-in meter. With it, the
18
+ // node stays an invalid configuration until the new host is set.
19
+ projectorMeterHost: {value: ""},
20
+ // Empty: the screen's own open command. No shared default position: a
21
+ // node saved with one keeps it.
22
+ screenOpenPosition: {value: "", validate: function (v) {
23
+ if (v === undefined || v === null || String(v).trim() === "") return true;
24
+ var position = Number(v);
25
+ return isFinite(position) && position > 0 && position <= 100;
26
+ }},
12
27
  screenTolerance: {value: 2, required: true, validate: RED.validators.number()},
13
28
  pollMs: {value: 2000, required: true, validate: RED.validators.number()},
14
29
  queryTimeoutMs: {value: 5000, required: true, validate: RED.validators.number()},
@@ -25,9 +40,13 @@
25
40
  transportTimeoutMs: {value: 5000, required: true, validate: RED.validators.number()}
26
41
  },
27
42
  credentials: {tvPsk: {type: "password"}},
43
+ // Once the new host is set, the removed name goes.
44
+ oneditsave: function () {
45
+ if (String($("#node-input-projectorPowerMeterHost").val() || "").trim() !== "") this.projectorMeterHost = "";
46
+ },
28
47
  inputs: 1,
29
- outputs: 2,
30
- outputLabels: ["projector IR fallback", "state and results"],
48
+ outputs: 3,
49
+ outputLabels: ["projector IR fallback", "state and results", "projector power queries"],
31
50
  icon: "font-awesome/fa-television",
32
51
  label: function () { return this.name || (this.area ? this.area + " " : "") + "display mode"; }
33
52
  });
@@ -36,11 +55,11 @@
36
55
  <script type="text/html" data-template-name="home-display-mode-controller">
37
56
  <div class="form-row"><label for="node-input-name">Name</label><input type="text" id="node-input-name"></div>
38
57
  <div class="form-row"><label for="node-input-area">Area</label><input type="text" id="node-input-area"></div>
39
- <div class="form-row"><label for="node-input-tvHost">Bravia host</label><input type="text" id="node-input-tvHost"></div>
40
- <div class="form-row"><label for="node-input-tvPsk">Bravia PSK</label><input type="password" id="node-input-tvPsk"></div>
41
- <div class="form-row"><label for="node-input-screenHost">Screen Shelly host</label><input type="text" id="node-input-screenHost"></div>
42
- <div class="form-row"><label for="node-input-projectorMeterHost">Projector Shelly host</label><input type="text" id="node-input-projectorMeterHost"></div>
43
- <div class="form-row"><label for="node-input-screenOpenPosition">Screen viewing position</label><input type="number" id="node-input-screenOpenPosition"></div>
58
+ <div class="form-row"><label for="node-input-tvHost">TV host</label><input type="text" id="node-input-tvHost"></div>
59
+ <div class="form-row"><label for="node-input-tvPsk">TV pre-shared key</label><input type="password" id="node-input-tvPsk"></div>
60
+ <div class="form-row"><label for="node-input-screenHost">Screen controller host</label><input type="text" id="node-input-screenHost"></div>
61
+ <div class="form-row"><label for="node-input-projectorPowerMeterHost">Projector power meter host (optional)</label><input type="text" id="node-input-projectorPowerMeterHost"></div>
62
+ <div class="form-row"><label for="node-input-screenOpenPosition">Screen viewing position</label><input type="number" min="1" max="100" id="node-input-screenOpenPosition" placeholder="fully open"></div>
44
63
  <div class="form-row"><label for="node-input-screenTolerance">Screen position tolerance</label><input type="number" id="node-input-screenTolerance"></div>
45
64
  <div class="form-row"><label for="node-input-pollMs">Confirmation poll milliseconds</label><input type="number" id="node-input-pollMs"></div>
46
65
  <div class="form-row"><label for="node-input-queryTimeoutMs">Query timeout milliseconds</label><input type="number" id="node-input-queryTimeoutMs"></div>
@@ -65,7 +84,35 @@
65
84
  TV is left on. A projector warming up or cooling down finishes before a newer request changes it; if it doesn't finish in time, the
66
85
  newer request carries on from what the projector then reports.</p>
67
86
  <p>Send <code>msg.display = {kind: "intent", requestId, generation, mode}</code>. Send <code>kind: "startup"</code> after deployment to query every owned device and reconcile persisted intent. Send <code>kind: "refresh"</code> to re-confirm a settled display from fresh readings.</p>
68
- <p>The Bravia and both Shelly devices use direct LAN APIs. Output 1 carries the projector power toggle (<code>msg.payload = "power"</code> with <code>msg.display_command</code>) for your infrared transport, commanded directly rather than through Home Assistant. Enable “Projector power is fallback” to include its use in activity metrics. Output 2 emits observed state plus ready, manual-override, failed, rejected and superseded results, and <code>msg.theatre</code> target state for the theatre activity controller: wire it straight back to that controller.</p>
87
+ <p>Each device is reached directly over its LAN API. The <b>TV host</b> is a Sony Bravia with IP control and a
88
+ pre-shared key. The <b>Screen controller host</b> is a Shelly Gen2 cover (its <code>Cover</code> RPC). For
89
+ projector mode it opens the screen to the <b>Screen viewing position</b> (a percentage of its travel) and confirms it
90
+ within the <b>Screen position tolerance</b>; left empty, it uses the screen's own open command and confirms the
91
+ screen fully open, which also suits a screen that isn't calibrated for positions. Other modes close it with its
92
+ own close, which runs to the end and restores a position the screen has lost. A viewing position needs a screen
93
+ that knows where it is: one that doesn't is closed first, and if it still has no position (not calibrated), the
94
+ request fails with reason <code>screen-not-calibrated</code>; calibrate it, or clear the viewing position. The
95
+ <b>Projector power meter host</b>, if set, is a Shelly Gen2 switch with power metering on the projector's supply
96
+ (switch 1), read against <b>Projector on watts</b> and <b>Projector standby watts</b>. A node still naming
97
+ that host <code>projectorMeterHost</code>, as before 5.0, is an invalid configuration, in the editor and when
98
+ deployed: that name was removed in 6.0, so set <b>Projector power meter host</b>.</p>
99
+ <p>Output 1 carries the projector power toggle (<code>msg.payload = "power"</code> with <code>msg.display_command</code>) for your infrared transport, commanded directly rather than through Home Assistant. Enable “Projector power is fallback” to include its use in activity metrics. Output 2 emits observed state plus ready, manual-override, failed, rejected and superseded results, and <code>msg.theatre</code> target state for the theatre activity controller: wire it straight back to that controller. Output 3 asks for the projector's power when there is no meter host (below).</p>
100
+ <h3>Projector power from your own flow</h3>
101
+ <p>Leave <b>Projector power meter host</b> empty to report the projector's power from any meter or adapter: send
102
+ <code>msg.display = {kind: "observed", device: "projector", power: "on"}</code> (<code>"on"</code>,
103
+ <code>"standby"</code> or <code>"transitioning"</code>, in lower case), or a meter's reading as <code>watts: 140</code>,
104
+ read against the on and standby watts. A smart plug's own <code>ON</code> and <code>OFF</code> are its socket, not the
105
+ lamp, so send its power in watts instead. A lamp <code>"transitioning"</code>, or watts between the two, keeps its last
106
+ settled state while it warms or cools. <code>observedAt</code> (an ISO time) and <code>source</code> are optional.</p>
107
+ <p>The node needs a fresh projector reading at every request and while it confirms a change. When it does, it sends
108
+ <code>msg.payload = "query"</code> on output 3: wire that to whatever makes your meter report, such as a Zigbee2MQTT
109
+ plug's <code>/get</code> topic. Output 3 can be left unwired only if the meter reports on its own at least once every
110
+ <b>Query timeout milliseconds</b>, whether or not the power changes; a meter that reports only on a change says
111
+ nothing while the projector sits steady. A device that hasn't reported within the query timeout is asked again, up to
112
+ <b>Maximum idempotent attempts</b> in all, and then the request fails with reason <code>no-reading</code>, naming
113
+ the device. This applies to every device, with or without a meter host: keep <b>Transport timeout milliseconds</b>
114
+ below <b>Query timeout milliseconds</b> &times; <b>Maximum idempotent attempts</b>, so a slow device's answer
115
+ arrives before it is given up on.</p>
69
116
  <p>An unsolicited physical-state change after readiness latches manual ownership. The controller observes and reports it without issuing corrective commands; a newer activity intent resumes automation.</p>
70
- <p>The Bravia PSK remains in Node-RED's encrypted credential store and is never emitted in a message or status.</p>
117
+ <p>The TV pre-shared key remains in Node-RED's encrypted credential store and is never emitted in a message or status.</p>
71
118
  </script>
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const display_mode_controller_1 = require("../lib/display-mode-controller");
3
- const display_transport_1 = require("../lib/display-transport");
3
+ const display_transport_1 = require("../lib/transports/display-transport");
4
4
  const adapter_1 = require("./adapter");
5
5
  const settings_1 = require("../lib/settings");
6
6
  const registerDisplayModeController = (RED) => {
@@ -12,14 +12,21 @@ const registerDisplayModeController = (RED) => {
12
12
  // Defaults and limits come from the reducer's own normalisation.
13
13
  let controllerConfig;
14
14
  let transport;
15
+ let projectorPowerMeterHost;
15
16
  try {
16
17
  controllerConfig = (0, display_mode_controller_1.normaliseConfig)(config);
18
+ // Optional: without a meter of its own, the node asks the flow for the
19
+ // projector's power on its third output, and reads what comes back.
20
+ projectorPowerMeterHost = String(config.projectorPowerMeterHost ?? "").trim();
21
+ if (!projectorPowerMeterHost && String(config.projectorMeterHost ?? "").trim()) {
22
+ throw new Error("projectorMeterHost was removed in 6.0: set Projector power meter host");
23
+ }
17
24
  transport = new display_transport_1.DisplayTransport({
18
25
  // No defaults: these name the user's own devices.
19
26
  tvHost: (0, settings_1.textSetting)(config.tvHost, "TV host"),
20
27
  tvPsk: String(node.credentials?.tvPsk ?? ""),
21
28
  screenHost: (0, settings_1.textSetting)(config.screenHost, "screen host"),
22
- projectorMeterHost: (0, settings_1.textSetting)(config.projectorMeterHost, "projector meter host"),
29
+ projectorMeterHost: projectorPowerMeterHost,
23
30
  timeoutMs: (0, settings_1.numberSetting)(config.transportTimeoutMs, "transport timeout", 5000)
24
31
  });
25
32
  }
@@ -42,9 +49,11 @@ const registerDisplayModeController = (RED) => {
42
49
  function schedule(state) {
43
50
  clearTimeout(timer);
44
51
  timer = undefined;
45
- if (!state.pending?.nextAt)
52
+ // The pending step's next check or the discovery deadline, whichever is first.
53
+ const due = [state.pending?.nextAt, state.discovery?.nextAt].filter((at) => Number.isFinite(at));
54
+ if (!due.length)
46
55
  return;
47
- const delay = Math.max(0, state.pending.nextAt - Date.now());
56
+ const delay = Math.max(0, Math.min(...due) - Date.now());
48
57
  const generation = state.desired?.generation || state.generation;
49
58
  timer = setTimeout((0, adapter_1.guarded)(node, () => {
50
59
  process({ display: { kind: "tick", generation } }, node.send.bind(node));
@@ -55,7 +64,11 @@ const registerDisplayModeController = (RED) => {
55
64
  node.send([{
56
65
  payload: "power",
57
66
  display_command: command
58
- }, null]);
67
+ }, null, null]);
68
+ return;
69
+ }
70
+ if (command.device === "projector" && command.operation === "query_power" && !projectorPowerMeterHost) {
71
+ node.send([null, null, { payload: "query", display_command: command }]);
59
72
  return;
60
73
  }
61
74
  const result = await transport.execute(command);
@@ -66,7 +79,7 @@ const registerDisplayModeController = (RED) => {
66
79
  const result = (0, adapter_1.runReducer)(node, { area: (0, adapter_1.optionalArea)(config), component: "display-mode-controller" }, (saved, now) => (0, display_mode_controller_1.transitionDisplay)(saved, msg, controllerConfig, now));
67
80
  const outputs = [...result.events, ...result.targetStates];
68
81
  if (outputs.length) {
69
- send([null, outputs.map((event) => ({ payload: undefined, ...event }))]);
82
+ send([null, outputs.map((event) => ({ payload: undefined, ...event })), null]);
70
83
  }
71
84
  updateStatus(result.status);
72
85
  schedule(result.state);
@@ -22,9 +22,9 @@
22
22
  </script>
23
23
 
24
24
  <script type="text/html" data-help-name="home-house-schedule">
25
- <p>One wake and bed time shared by every room lighting controller whose <b>Schedule</b> is this one. Rooms that keep
26
- their own times (a child's room, say) choose none.</p>
27
- <p>The rooms hear of every change as it happens, without wires. Times change from a message or from Home Assistant
25
+ <p>One wake and bed time shared by every circadian lighting policy whose <b>Schedule</b> is this one. A policy
26
+ that keeps its own times (for a child's room, say) chooses none.</p>
27
+ <p>The policies hear of every change as it happens, without wires. Times change from a message or from Home Assistant
28
28
  through a <i>house schedule MQTT</i> node; a time changed that way lasts until this schedule is deployed with a
29
29
  different <b>Wake time</b> or <b>Bed time</b>, which then applies.</p>
30
30
  <p>The <b>Name</b> labels it and names its topics, <code>home/&lt;name&gt;/schedule/...</code>.</p>
@@ -81,14 +81,17 @@
81
81
  <dl class="message-properties">
82
82
  <dt>occupancy</dt><dd><code>msg.payload.occupied</code>, from the occupancy fusion node.</dd>
83
83
  <dt>illuminance</dt><dd>the light level in lux.</dd>
84
- <dt>area-enabled</dt><dd>ON or OFF for this node; <code>global-enabled</code> for every motion node.</dd>
84
+ <dt>area-enabled</dt><dd><code>true</code> or <code>false</code> for this node; <code>global-enabled</code> for every
85
+ motion node. Any other value, such as <code>"ON"</code> (accepted before 6.0), is refused: nothing changes, the
86
+ node logs a warning once per deploy and shows it on its status.</dd>
85
87
  <dt>delay</dt><dd>a new vacancy time, in <b>seconds</b>, the same unit as <b>Vacancy seconds</b>.</dd>
86
88
  <dt>illuminance-cut-off</dt><dd>a new lux cutoff.</dd>
87
89
  <dt>pause</dt><dd><code>true</code> pauses motion lighting, <code>false</code> releases it, for the owner in
88
90
  <code>msg.owner</code> (for example a cover's name), which is required. A pause lasts at most the
89
91
  <b>Maximum pause</b> unless sent again, so a lost release can't stop motion lighting for good. Motion lighting acts only while no owner holds a pause,
90
92
  and a pause cancels a pending vacancy timer, as switching it off does. A pause never changes the enables,
91
- which are the user's own: wire a cover's <i>moving</i> output here to pause motion while it moves.</dd>
93
+ which are the user's own: wire a cover's <i>moving</i> output here to pause motion while it moves. Any value but
94
+ <code>true</code> or <code>false</code> is refused, as for the enables.</dd>
92
95
  </dl>
93
96
  <p>A <code>delay</code> or <code>illuminance-cut-off</code> message overrides the setting, and lasts across
94
97
  restarts until the node is deployed with a different <b>Vacancy seconds</b> or <b>Lux cutoff</b>, which then