Skip to content

Commit

Permalink
Merge pull request #17 from maeb3/patch-1
Browse files Browse the repository at this point in the history
Update main.js
  • Loading branch information
disaster123 authored Oct 12, 2023
2 parents 5aaf9f8 + 3923d1f commit 3567ad8
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,23 +374,29 @@ class Signifylights extends utils.Adapter {
// Reset the connection indicator during startup
this.setState("info.connection", false, true);

if (this.config.bind_ip && this.config.bind_ip.length > 0 &&
this.config.udpmac && this.config.udpmac.length > 0 &&
this.config.udpip && this.config.udpip.length > 0) {
if (!(this.config.bind_ip && this.config.bind_ip.length > 0)) {
this.log.error("adapter is unconfigured, bind ip missing");
} else {
this.HOST = this.config.bind_ip;
this.MAC = this.config.udpmac.replace(/:/g, '').toUpperCase();
this.IP = this.config.udpip;
this.log.info("config bind_ip: " + this.config.bind_ip);
this.log.info("config udpmac: " + this.config.udpmac);
this.log.info("config udpip: " + this.config.udpip);

await this.open_udp_sockets();
this.log.info("config bind ip address: " + this.config.bind_ip);
if (this.config.register_devices === true &&

Check failure on line 382 in main.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Trailing spaces not allowed
!(this.config.udpip && this.config.udpip.length > 0 &&
this.config.udpmac && this.config.udpmac.length > 0)) {

Check failure on line 384 in main.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Trailing spaces not allowed
this.log.error("adapter is unconfigured, udp target ip and/or udp mac address for auto update missing");

Check failure on line 385 in main.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Trailing spaces not allowed
} else {
if (this.config.register_devices === true){
this.log.info("config register devices for auto update: enabled");
this.IP = this.config.udpip;
this.log.info("config udp target IP for auto update: " + this.config.udpip);
this.MAC = this.config.udpmac.replace(/:/g, '').toUpperCase();
this.log.info("config udp mac address for auto update: " + this.MAC);

Check failure on line 392 in main.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Trailing spaces not allowed
}
await this.open_udp_sockets();

await this.WIZ__INIT_ALL_DEVICES();
await this.WIZ__INIT_ALL_DEVICES();

this.setState('info.connection', true, true);
} else if (this.config.register_devices === true) {
this.log.error("adapter is unconfigured");
this.setState('info.connection', true, true);
}
}
}

Expand Down

0 comments on commit 3567ad8

Please sign in to comment.