@avantics/node-red-home-automation 4.0.0 → 4.0.1
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 +18 -2
- package/dist/lib/cover-controller.js +32 -1
- package/dist/nodes/cover-controller.html +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -134,7 +134,13 @@ One cover controller owns one position cover: a blind, shutter or curtain motor
|
|
|
134
134
|
that takes and reports a position from 0 (closed) to 100 (open). Send it
|
|
135
135
|
`"open"`, `"close"`, `"stop"`, a position, or the name of a preset such as
|
|
136
136
|
`partial`. It confirms a move from what the cover reports, retries a bounded
|
|
137
|
-
number of times, and leaves a cover a person moved where they put it.
|
|
137
|
+
number of times, and leaves a cover a person moved where they put it. A move is
|
|
138
|
+
confirmed only once the cover has stopped at the target, from a `stopped`
|
|
139
|
+
motion report or the same position for the settle time (with or without
|
|
140
|
+
another report), so a transport that echoes the requested position at once
|
|
141
|
+
doesn't end the move early. Set the settle time to at least how often the
|
|
142
|
+
motor reports while it travels: otherwise an echo can be confirmed before the
|
|
143
|
+
first travel report arrives. An
|
|
138
144
|
automatic target, such as a position computed from the weather, sets
|
|
139
145
|
`msg.respectManual = true` so it waits while a person's move holds; a target
|
|
140
146
|
the cover is already at is confirmed without a command. A button can send
|
|
@@ -194,11 +200,21 @@ also attaches the package tarball and its SHA-256 checksum. Install a downloaded
|
|
|
194
200
|
tarball through **Manage palette → Install → Upload module**, or with:
|
|
195
201
|
|
|
196
202
|
```sh
|
|
197
|
-
npm install /path/to/avantics-node-red-home-automation-4.0.
|
|
203
|
+
npm install /path/to/avantics-node-red-home-automation-4.0.1.tgz
|
|
198
204
|
```
|
|
199
205
|
|
|
200
206
|
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.
|
|
201
207
|
|
|
208
|
+
### 4.0.1
|
|
209
|
+
|
|
210
|
+
Fixes the cover controller ending a move too early when a transport echoes the
|
|
211
|
+
requested position as soon as the command is sent, before the motor moves: the
|
|
212
|
+
cover showed as stopped while it was still travelling, and the travel after it
|
|
213
|
+
was taken for a person's move. A move now confirms only once the cover has
|
|
214
|
+
stopped at the target, from a `stopped` motion report or the same position for
|
|
215
|
+
the settle time. Set the settle time to at least how often the motor reports
|
|
216
|
+
while it travels (see Covers).
|
|
217
|
+
|
|
202
218
|
### 4.0.0
|
|
203
219
|
|
|
204
220
|
Adds cover control, a house schedule, and Home Assistant entities for every
|
|
@@ -291,9 +291,20 @@ function transitionCover(saved, msg, suppliedConfig = {}, nowValue = new Date())
|
|
|
291
291
|
|| (pending.startPosition !== null && Math.abs(position - pending.startPosition) > config.positionTolerance)) {
|
|
292
292
|
pending.moved = true;
|
|
293
293
|
}
|
|
294
|
-
|
|
294
|
+
// A move confirms only once the cover has stopped at the target: some
|
|
295
|
+
// transports echo the requested position as soon as the command goes,
|
|
296
|
+
// before the motor moves, so a report at the target is not enough. A
|
|
297
|
+
// reliable "stopped", or the same position held for settleMs, is.
|
|
298
|
+
// Re-reading after a restart or an outage keeps confirming at once.
|
|
299
|
+
if (within && !moving && (pending.operation !== "set_position" || settled)) {
|
|
295
300
|
ready(target);
|
|
296
301
|
}
|
|
302
|
+
else if (within && !moving) {
|
|
303
|
+
// Settled once it holds here for settleMs, with or without another
|
|
304
|
+
// report: the tick then confirms it (see settledAtTarget).
|
|
305
|
+
pending.nextAt = Math.min(pending.nextAt, (pending.stableSince ?? observedAt) + config.settleMs);
|
|
306
|
+
trace("observation", "accepted", "awaiting-settle", { position, motion });
|
|
307
|
+
}
|
|
297
308
|
else if (pending.verifying && !moving) {
|
|
298
309
|
latchManual("moved-while-offline", target, position);
|
|
299
310
|
}
|
|
@@ -328,6 +339,20 @@ function transitionCover(saved, msg, suppliedConfig = {}, nowValue = new Date())
|
|
|
328
339
|
ready(state.desired.position);
|
|
329
340
|
}
|
|
330
341
|
}
|
|
342
|
+
// A set_position move whose last report is at the target, not moving, and
|
|
343
|
+
// has held there for settleMs. Travel reports after an echo reset the
|
|
344
|
+
// hold, so an echo alone settles only if nothing follows it for settleMs.
|
|
345
|
+
function settledAtTarget() {
|
|
346
|
+
const pending = state.pending;
|
|
347
|
+
const observed = state.observed;
|
|
348
|
+
if (!pending || pending.operation !== "set_position" || !observed || state.desired?.position === null || state.desired?.position === undefined)
|
|
349
|
+
return false;
|
|
350
|
+
if (observed.motion === "opening" || observed.motion === "closing")
|
|
351
|
+
return false;
|
|
352
|
+
if (pending.stableSince === null || pending.stablePosition !== observed.position)
|
|
353
|
+
return false;
|
|
354
|
+
return Math.abs(observed.position - state.desired.position) <= config.positionTolerance && nowMs - pending.stableSince >= config.settleMs;
|
|
355
|
+
}
|
|
331
356
|
function latchManual(reason, expected, observed) {
|
|
332
357
|
state.pending = null;
|
|
333
358
|
state.classification = "manual_override";
|
|
@@ -356,6 +381,12 @@ function transitionCover(saved, msg, suppliedConfig = {}, nowValue = new Date())
|
|
|
356
381
|
if (!state.desired || event.generation !== state.generation || !state.pending) {
|
|
357
382
|
trace("tick", "ignored", "stale-generation");
|
|
358
383
|
}
|
|
384
|
+
else if (settledAtTarget()) {
|
|
385
|
+
// At the target for settleMs, with no newer report: a cover that
|
|
386
|
+
// reports once on arrival, and doesn't answer polls, is done too.
|
|
387
|
+
trace("tick", "settled", "held-at-target", { position: state.observed.position });
|
|
388
|
+
ready(state.desired.position);
|
|
389
|
+
}
|
|
359
390
|
else if (nowMs >= state.pending.deadlineAt) {
|
|
360
391
|
retryOrFail(state.pending.operation === "observe" ? "confirmation-timeout" : "travel-timeout");
|
|
361
392
|
}
|
|
@@ -108,7 +108,11 @@
|
|
|
108
108
|
<script type="text/html" data-help-name="home-cover-controller">
|
|
109
109
|
<p>Owns one position cover: a blind, shutter or curtain motor that takes and reports a position from 0 (closed) to
|
|
110
110
|
100 (open). It sends a move, confirms it from what the cover reports, retries a bounded number of times, and
|
|
111
|
-
leaves a cover a person moved where they put it
|
|
111
|
+
leaves a cover a person moved where they put it. A move is confirmed only once the cover has stopped at the
|
|
112
|
+
target: a <code>stopped</code> motion report, or the same position for the <b>Settle time</b>, with or without
|
|
113
|
+
another report. A transport that echoes the requested position as soon as the command goes doesn't end the move,
|
|
114
|
+
or make the travel after it look like a person's, as long as the <b>Settle time</b> is at least how often the
|
|
115
|
+
motor reports while it travels.</p>
|
|
112
116
|
<h3>Inputs</h3>
|
|
113
117
|
<dl class="message-properties">
|
|
114
118
|
<dt>payload</dt><dd><code>"open"</code>, <code>"close"</code> or <code>"stop"</code>; a position from 0 to 100;
|