@avantics/node-red-home-automation 4.0.1 → 4.0.2

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 CHANGED
@@ -200,11 +200,21 @@ also attaches the package tarball and its SHA-256 checksum. Install a downloaded
200
200
  tarball through **Manage palette → Install → Upload module**, or with:
201
201
 
202
202
  ```sh
203
- npm install /path/to/avantics-node-red-home-automation-4.0.1.tgz
203
+ npm install /path/to/avantics-node-red-home-automation-4.0.2.tgz
204
204
  ```
205
205
 
206
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.
207
207
 
208
+ ### 4.0.2
209
+
210
+ Fixes the display controller switching the TV off before the projector was
211
+ ready: with a source playing, there was sound but no picture while the screen
212
+ opened and the projector warmed up. Projector mode now starts the projector and
213
+ waits for its warm-up, opens the screen, then puts the TV in standby, so the
214
+ picture stays up and the TV stays on if the projector fails to start. A request
215
+ made while the projector is warming up or cooling down now waits for that to
216
+ finish, so the lamp is no longer left on or toggled mid-warm-up.
217
+
208
218
  ### 4.0.1
209
219
 
210
220
  Fixes the cover controller ending a move too early when a transport echoes the
@@ -290,17 +290,20 @@ function transitionDisplay(saved, msg, suppliedConfig = {}, now = new Date()) {
290
290
  return issueScreen(0);
291
291
  return markReady();
292
292
  }
293
+ // Make before break, as TV mode does: the projector warms up and the
294
+ // screen opens while the TV still shows the picture, which goes to
295
+ // standby last. A projector that fails to start leaves the TV on.
293
296
  if (mode === "projector") {
294
- if (state.observed.tv?.power !== "standby")
295
- return issueTv("standby");
296
- if (!screenAtPosition(state.observed.screen, config.screenOpenPosition, config.screenTolerance)) {
297
- return issueScreen(config.screenOpenPosition);
298
- }
299
297
  if (state.observed.projector?.power !== "on") {
300
298
  if (state.observed.projector?.power === "standby")
301
299
  return issueProjectorStart();
302
300
  return awaitProjectorPower();
303
301
  }
302
+ if (!screenAtPosition(state.observed.screen, config.screenOpenPosition, config.screenTolerance)) {
303
+ return issueScreen(config.screenOpenPosition);
304
+ }
305
+ if (state.observed.tv?.power !== "standby")
306
+ return issueTv("standby");
304
307
  return markReady();
305
308
  }
306
309
  if (state.observed.tv?.power !== "standby")
@@ -421,6 +424,23 @@ function transitionDisplay(saved, msg, suppliedConfig = {}, now = new Date()) {
421
424
  return;
422
425
  }
423
426
  if (now.getTime() >= pending.deadlineAt) {
427
+ // A projector step kept from an older request (see the intent) that
428
+ // never confirmed isn't the newer request's failure: its goal may
429
+ // already be met. Drop it, read the projector afresh, and let the
430
+ // newer request act on what it reports; its own steps fail it, under
431
+ // its own generation, if the projector really is stuck.
432
+ if (state.desired && pending.command.generation !== state.desired.generation) {
433
+ state.pending = null;
434
+ state.seen.projector = false;
435
+ state.querying.projector = true;
436
+ commands.push(queryFor(state, "projector"));
437
+ trace("transition", "dropped", "superseded-operation-unconfirmed", {
438
+ device: pending.device,
439
+ operation: pending.operation,
440
+ generation: pending.command.generation
441
+ });
442
+ return;
443
+ }
424
444
  if (pending.retryable && pending.attempt < config.maxAttempts) {
425
445
  retry(pending, null);
426
446
  return;
@@ -489,7 +509,11 @@ function transitionDisplay(saved, msg, suppliedConfig = {}, now = new Date()) {
489
509
  state.lastAttempt = 0;
490
510
  state.fallbackUsed = false;
491
511
  state.blockedGeneration = null;
492
- state.pending = null;
512
+ // As at startup, a projector power operation in flight (a warm-up, a
513
+ // shutdown or a cool-down) carries on under the new request: a toggle
514
+ // now could switch a warming lamp off or a cooling one back on. The
515
+ // new request's steps follow once it settles.
516
+ state.pending = state.pending && !state.pending.retryable ? state.pending : null;
493
517
  state.seen = { tv: false, screen: false, projector: false };
494
518
  state.querying = { tv: false, screen: false, projector: false };
495
519
  beginDiscovery();
@@ -59,6 +59,11 @@
59
59
 
60
60
  <script type="text/html" data-help-name="home-display-mode-controller">
61
61
  <p>Owns Bravia power, projector lamp power and projector-screen position for <code>off</code>, <code>tv</code> and <code>projector</code> modes.</p>
62
+ <p>Switching between the TV and the projector is make before break, so a source that is already playing keeps a
63
+ picture: for the projector, the lamp starts and warms up, then the screen opens, and the TV goes to standby last;
64
+ for the TV, it comes on before the projector shuts down and the screen closes. If the projector fails to start, the
65
+ 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
+ newer request carries on from what the projector then reports.</p>
62
67
  <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>
63
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>
64
69
  <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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avantics/node-red-home-automation",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Deterministic home automation components for Node-RED",
5
5
  "keywords": [
6
6
  "node-red",