Skip to content

Commit

Permalink
add gateway index
Browse files Browse the repository at this point in the history
  • Loading branch information
TA2k committed Sep 12, 2023
1 parent 0919177 commit 293b886
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
13 changes: 12 additions & 1 deletion admin/index_m.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@
<!-- For example columns with settings: -->
<div class="row">
<div class="col s6 input-field">
Visit <a href="https://app.developer.viessmann.com" target="_blank">https://app.developer.viessmann.com</a> and create a new client. <br /><br />
Visit
<a href="https://app.developer.viessmann.com" target="_blank"
>https://app.developer.viessmann.com</a
>
and create a new client. <br /><br />
Name: iobroker<br />
Google reCAPTCHA deaktivieren<br />
Redirect URI: http://localhost:4200/<br />
Expand Down Expand Up @@ -111,6 +115,13 @@
<label for="eventInterval" class="translate">Update gateway events in minutes</label>
</div>
</div>

<div class="row">
<div class="col s6 input-field">
<input type="number" class="value" id="gatewayIndex" />
<label for="gatewayIndex" class="translate">Index of Which Gateway shall be use.</label>
</div>
</div>
</div>
</body>
</html>
7 changes: 4 additions & 3 deletions io-package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"common": {
"name": "viessmannapi",
"version": "2.1.0",
"version": "2.1.1",
"news": {
"2.1.0": {
"2.1.1": {
"en": "update to new api endpoint",
"de": "Update auf neue API Endpunkte"
},
Expand Down Expand Up @@ -105,7 +105,8 @@
"password": "",
"client_id": "",
"interval": 5,
"eventInterval": 300
"eventInterval": 300,
"gatewayIndex": 1
},
"objects": [],
"instanceObjects": [
Expand Down
11 changes: 9 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,16 @@ class Viessmannapi extends utils.Adapter {
installation.gateways = installation.gateways.filter((gateway) => {
return gateway.aggregatedStatus !== "Offline";
});
this.log.info("Found " + installation.gateways.length + " online gateways select first gateway.");
this.log.warn(
"Found " +
installation.gateways.length +
" online gateways select " +
this.config.gatewayIndex +
" gateway.",
);
}
for (const device of installation.gateways[0].devices) {
const gateway = installation.gateways[this.config.gatewayIndex - 1];
for (const device of gateway.devices) {
await this.setObjectNotExistsAsync(installationId + "." + device.id, {
type: "device",
common: {
Expand Down

0 comments on commit 293b886

Please sign in to comment.