smart-home-engine 1.14.0 → 1.14.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.
@@ -1,4 +1,4 @@
1
- import{m as O}from"./monaco-langs-Dt8a9eeo.js";import{t as I}from"./index-BbvxIUTP.js";/*!-----------------------------------------------------------------------------
1
+ import{m as O}from"./monaco-langs-Dt8a9eeo.js";import{t as I}from"./index-CHFG2eeB.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -172,7 +172,7 @@
172
172
  }
173
173
  })();
174
174
  </script>
175
- <script type="module" crossorigin src="/assets/index-BbvxIUTP.js"></script>
175
+ <script type="module" crossorigin src="/assets/index-CHFG2eeB.js"></script>
176
176
  <link rel="modulepreload" crossorigin href="/assets/monaco-langs-Dt8a9eeo.js">
177
177
  <link rel="stylesheet" crossorigin href="/assets/monaco-langs-DyX1CsEw.css">
178
178
  <link rel="stylesheet" crossorigin href="/assets/index-BXB4YlVH.css">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-home-engine",
3
- "version": "1.14.0",
3
+ "version": "1.14.2",
4
4
  "description": "Node.js based script runner for use in MQTT based Smart Home environments",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -42,7 +42,7 @@
42
42
  "pino": "^9.0.0",
43
43
  "pino-pretty": "^13.0.0",
44
44
  "semantic-compare": "^1.0.2",
45
- "suncalc": "^1.9.0",
45
+ "suncalc": "1.9.0",
46
46
  "ws": "^8.21.0",
47
47
  "yargs": "^17.0.0"
48
48
  },
package/src/index.js CHANGED
@@ -356,7 +356,11 @@ if (config.url) {
356
356
  // Inform newly-connected WS clients of the current MQTT broker connection state.
357
357
  setWelcomeProvider(() => ({ type: 'mqtt:status', ready: _started, connected }));
358
358
 
359
- const _mqttOpts = { will: { topic: config.name + '/connected', payload: '0', retain: true } };
359
+ // resubscribe: false she manually re-subscribes in the connect handler, so MQTT.js's
360
+ // automatic re-subscribe on reconnect must be disabled. If both fire, Mosquitto receives
361
+ // two SUBSCRIBE '#' packets and silently drops QoS-0 retained messages that overflow the
362
+ // per-client queue between the two subscriptions.
363
+ const _mqttOpts = { will: { topic: config.name + '/connected', payload: '0', retain: true }, resubscribe: false };
360
364
  if (config.mqttUsername) _mqttOpts.username = config.mqttUsername;
361
365
  if (config.mqttPassword) _mqttOpts.password = config.mqttPassword;
362
366
  if (config.mqttCa) _mqttOpts.ca = config.mqttCa;
@@ -423,7 +427,10 @@ if (config.url) {
423
427
  // after subscribing to #. When it arrives, all retained messages from the
424
428
  // broker have already been delivered and stored.
425
429
  if (!_started && _sentinelValue !== null && !msg.retain && topic === config.name + '/she-sentinel' && payload.toString() === _sentinelValue) {
426
- startOnce('mqtt: retained state ready, starting scripts');
430
+ let _retainedCount = 0;
431
+ // eslint-disable-next-line no-unused-vars
432
+ for (const _ of store.mqttEntries()) _retainedCount++;
433
+ startOnce('mqtt: retained state ready, starting scripts (' + _retainedCount + ' retained topics loaded)');
427
434
  return; // sentinel is internal — don’t process further
428
435
  }
429
436