Update broadlinnk to dump clients when discovered in debug and to drop

clients when re-init.
This commit is contained in:
bsamuels
2018-01-29 16:44:12 -06:00
parent c843e8d1ac
commit e6db6e11e5
2 changed files with 8 additions and 2 deletions

View File

@@ -5,7 +5,7 @@
<groupId>com.bwssystems.HABridge</groupId>
<artifactId>ha-bridge</artifactId>
<version>5.2.0RC9</version>
<version>5.2.0RC10</version>
<packaging>jar</packaging>
<name>HA Bridge</name>

View File

@@ -76,8 +76,12 @@ public class BroadlinkHome implements Home {
return this;
}
for(int i = 0; i < clients.length; i++) {
if(clients[i].getDeviceType() != BLDevice.DEV_A1)
if(clients[i].getDeviceType() != BLDevice.DEV_A1) {
broadlinkMap.put(clients[i].getHost() + "-" + String.format("%04x", clients[i].getDeviceType()), clients[i]);
log.debug("Adding Device to Map - host: " + clients[i].getHost() + ", device Type: " + clients[i].getDeviceDescription() + ", mac: " + (clients[i].getMac() == null ? "no Mac in client" : clients[i].getMac().getMacString()));
} else {
log.debug("Ignoring A1 Device - host: " + clients[i].getHost() + ", device Type: " + clients[i].getDeviceDescription() + ", mac: " + (clients[i].getMac() == null ? "no Mac in client" : clients[i].getMac().getMacString()));
}
}
} catch (IOException e) {
log.warn("Could not discover Broadlinks, with IO Exception", e);
@@ -300,6 +304,8 @@ public class BroadlinkHome implements Home {
if(!validBroadlink)
return;
log.debug("Closing Home.");
broadlinkMap.clear();
broadlinkMap = null;
if(closed) {
log.debug("Home is already closed....");
return;