Skip to content

Commit

Permalink
Show number of updated values per group
Browse files Browse the repository at this point in the history
On top, it implicitly indicates if demandControl is supported or not.
  • Loading branch information
Matze2 committed Oct 5, 2024
1 parent c3a252b commit 57ad37b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions daikin.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,6 @@ function main() {
}

async function storeDaikinData(err) {
let updated = 0;

if (stopped) return;
if (!err) {
setConnected(true);
Expand Down Expand Up @@ -563,16 +561,18 @@ async function storeDaikinData(err) {
delete basicInfo.power;
}

updated += await handleDaikinUpdate(basicInfo, 'deviceInfo');
updated += await handleDaikinUpdate(daikinDevice.currentACModelInfo, 'modelInfo');
updated += await handleDaikinUpdate(control, 'control');
updated += await handleDaikinUpdate(controlInfo, 'controlInfo');
updated += await handleDaikinUpdate(daikinDevice.currentACSensorInfo, 'sensorInfo');
let updated = {};
updated.deviceInfo = await handleDaikinUpdate(basicInfo, 'deviceInfo');
updated.modelInfo = await handleDaikinUpdate(daikinDevice.currentACModelInfo, 'modelInfo');
updated.control = await handleDaikinUpdate(control, 'control');
updated.controlInfo = await handleDaikinUpdate(controlInfo, 'controlInfo');
updated.sensorInfo = await handleDaikinUpdate(daikinDevice.currentACSensorInfo, 'sensorInfo');
if (daikinDevice.currentACDemandControl) {
updated += await handleDaikinUpdate(daikinDevice.currentACDemandControl, 'demandControl');
updated.demandControl = await handleDaikinUpdate(daikinDevice.currentACDemandControl, 'demandControl');
}
if (updated > 0) {
adapter.log.info(`${updated} Values updated`);
let updatedTotal = Object.values(updated).reduce((sum, num) => { return sum + num }, 0);
if (updatedTotal > 0) {
adapter.log.info(`${updatedTotal} Values updated: ${JSON.stringify(updated)}`);
}
}
else {
Expand Down

0 comments on commit 57ad37b

Please sign in to comment.