@homebridge-plugins/homebridge-tado 8.3.0 → 8.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## v8.3.1 - 2025-10-25
4
+ - Fix: Persist zone states only if not empty
5
+
3
6
  ## v8.3.0 - 2025-10-25
4
7
  - Add tado API counter
5
8
  - Improve task scheduling and interval handling
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebridge-plugins/homebridge-tado",
3
- "version": "8.3.0",
3
+ "version": "8.3.1",
4
4
  "description": "Homebridge plugin for controlling tado° devices.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -717,11 +717,15 @@ export default (api, accessories, config, tado, telegram) => {
717
717
 
718
718
  async function persistStates(homeId, zoneStates) {
719
719
  try {
720
- const homeData = {};
721
- homeData.zoneStates = zoneStates ?? {};
722
- await writeFile(join(storagePath, `tado-states-${homeId}.json`), JSON.stringify(homeData, null, 2), "utf-8");
720
+ if (zoneStates && Object.keys(zoneStates).length) {
721
+ const homeData = {};
722
+ homeData.zoneStates = zoneStates;
723
+ await writeFile(join(storagePath, `tado-states-${homeId}.json`), JSON.stringify(homeData, null, 2), "utf-8");
724
+ } else {
725
+ Logger.info(`Skipping persistence of tado states for home ${homeId}: zone states are empty.`);
726
+ }
723
727
  } catch (error) {
724
- Logger.error(`Error while updating the tado states file for home id ${homeId}: ${error.message || error}`);
728
+ Logger.error(`Error while updating the tado states file for home ${homeId}: ${error.message || error}`);
725
729
  }
726
730
  try {
727
731
  const data = {};
@@ -731,10 +735,10 @@ export default (api, accessories, config, tado, telegram) => {
731
735
  Logger.error(`Error while updating the tado states file: ${error.message || error}`);
732
736
  }
733
737
  try {
734
- //wait for fakegato services to be loaded
738
+ //wait for fakegato history services to be loaded
735
739
  await new Promise(r => setTimeout(r, 4000));
736
- for (const fnRefreshHistory of aRefreshHistoryHandlers) {
737
- fnRefreshHistory();
740
+ for (const refreshHistory of aRefreshHistoryHandlers) {
741
+ refreshHistory();
738
742
  }
739
743
  } catch (error) {
740
744
  Logger.error(`Error while refreshing history: ${error.message || error}`);
@@ -1568,7 +1572,7 @@ export default (api, accessories, config, tado, telegram) => {
1568
1572
  error = err;
1569
1573
  }
1570
1574
 
1571
- Logger.error(error, config.homeName);
1575
+ Logger.error("Error:", error, config.homeName);
1572
1576
 
1573
1577
  return;
1574
1578
  }