Skip to content

Commit

Permalink
Optimized multicast debug option
Browse files Browse the repository at this point in the history
  • Loading branch information
EDelsman committed Apr 18, 2021
1 parent 25006be commit 8fbab2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"keyLocation3": "Een geldige sleutel heeft het volgende formaat: 74ae544c-d16e-4c",
"keyField": "Sleutel",
"options": "Opties",
"debugDescription": "De onderstaande instellingen alleen aanzetten als de ontwikkelaar hierom vraagt:",
"debugDescription": "De onderstaande instellingen alleen aanzetten als de ontwikkelaar hier om vraagt:",
"debug": "Alle meldingen loggen voor het debuggen",
"multicast": "Alleen multicast gebruiken",
"save": "Instellingen opslaan",
Expand Down
8 changes: 6 additions & 2 deletions motion/motion.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ class MotionDriver extends EventEmitter {
}

getGatewayAddress(message, info) {
if (message.mac != undefined && info != null && info != undefined && info.address != undefined &&
if (!this.multicast && message.mac != undefined && info != null && info != undefined && info.address != undefined &&
info.address != null && info.address != '0.0.0.0' && info.address != MULTICAST_ADDRESS) {
let gateway = this.getGateway(message.mac, message.deviceType);
if (gateway != undefined && gateway.setGatewayAddress(info.address))
Expand Down Expand Up @@ -426,8 +426,12 @@ class MotionDriver extends EventEmitter {
onHeartbeat(msg, info) {
let gateway = this.getGateway(msg.mac, msg.deviceType);
gateway.setToken(msg.token);
if (gateway.nrDevices != msg.data.numberOfDevices) // if device count changed, get new list
if (gateway.nrDevices != msg.data.numberOfDevices) { // if device count changed, get new list
this.log('Heartbeat found ' + (msg.data.numberOfDevices - gateway.nrDevices) + ' new devices');
if (this.verbose && !this.logHeartbeat)
this.log(msg); // do log heartbeat if device count unexpected
this.send({ "msgType": "GetDeviceList", "msgID": this.getMessageID() })
}
}

async connect() {
Expand Down

0 comments on commit 8fbab2b

Please sign in to comment.