Skip to content

Commit

Permalink
add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
TA2k committed May 3, 2024
1 parent f453769 commit ddfe246
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 43 deletions.
26 changes: 23 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ class Viessmannapi extends utils.Adapter {
this.log.info(this.installationArray.length + ' installations found.');
for (const installation of this.installationArray) {
const installationId = installation.id.toString();
this.log.info('Installation ' + installation.description + ' created');
await this.setObjectNotExistsAsync(installationId, {
type: 'device',
common: {
Expand All @@ -205,17 +206,36 @@ class Viessmannapi extends utils.Adapter {
for (const installation of this.installationArray) {
const installationId = installation.id.toString();
if (installation.gateways.length > 1) {
this.log.info('Found ' + installation.gateways.length + ' gateways for installation ');
this.log.info(
'Found ' + installation.gateways.length + ' gateways for installation for installation ' + installation.id,
);
this.log.debug(JSON.stringify(installation.gateways));
this.log.info('Filter out offline gateways.');
installation.gateways = installation.gateways.filter((gateway) => {
return gateway.aggregatedStatus !== 'Offline';
});
this.log.warn(
'Found ' + installation.gateways.length + ' online gateways select ' + this.config.gatewayIndex + ' gateway.',
'Found ' +
installation.gateways.length +
' online gateways select ' +
this.config.gatewayIndex +
' gateway. for installation ' +
installation.id,
);
}
//check if gatewayIndex is valid
if (this.config.gatewayIndex > installation.gateways.length) {
this.log.warn(
'Gateway Index ' +
this.config.gatewayIndex +
' is not valid. Please check the number of gateways for installation ' +
installation.id +
' index is set to 1',
);
this.config.gatewayIndex = 1;
}
const gateway = installation.gateways[this.config.gatewayIndex - 1];
if (!gateway) {
if (!gateway || gateway == null) {
this.log.warn('No gateway found for installation ' + installation.id + 'and index ' + this.config.gatewayIndex);
this.log.info(JSON.stringify(installation.gateways));
return;
Expand Down
70 changes: 35 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
"url": "https://github.com/TA2k/ioBroker.viessmannapi"
},
"dependencies": {
"@iobroker/adapter-core": "^3.0.4",
"@iobroker/adapter-core": "^3.1.4",
"axios": "^1.6.8",
"json-bigint": "^1.0.0",
"qs": "^6.12.0",
"qs": "^6.12.1",
"retry-axios": "^2.6.0"
},
"devDependencies": {
"@iobroker/testing": "^4.1.1",
"@types/node": "^20.11.28",
"@iobroker/testing": "^4.1.3",
"@types/node": "^20.12.8",
"axios": "^1.6.8",
"eslint": "^8.57.0",
"typescript": "^5.4.2"
"typescript": "^5.4.5"
},
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit ddfe246

Please sign in to comment.