mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-18 16:17:30 +00:00
Check broadlink map before finding device to call for null. Initialize
broadlink Map on discover.
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.bwssystems.HABridge</groupId>
|
<groupId>com.bwssystems.HABridge</groupId>
|
||||||
<artifactId>ha-bridge</artifactId>
|
<artifactId>ha-bridge</artifactId>
|
||||||
<version>5.2.0RC16</version>
|
<version>5.2.0RC17</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HA Bridge</name>
|
<name>HA Bridge</name>
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public class BroadlinkHome implements Home {
|
|||||||
+ "\",\"description\": \"Should not get here, no LifxDevices configured\", \"parameter\": \"/lights/"
|
+ "\",\"description\": \"Should not get here, no LifxDevices configured\", \"parameter\": \"/lights/"
|
||||||
+ lightId + "state\"}}]";
|
+ lightId + "state\"}}]";
|
||||||
|
|
||||||
} else {
|
} else if(broadlinkMap != null) {
|
||||||
BroadlinkEntry broadlinkCommand = null;
|
BroadlinkEntry broadlinkCommand = null;
|
||||||
broadlinkCommand = new Gson().fromJson(anItem.getItem().getAsString(), BroadlinkEntry.class);
|
broadlinkCommand = new Gson().fromJson(anItem.getItem().getAsString(), BroadlinkEntry.class);
|
||||||
BLDevice theDevice = broadlinkMap.get(broadlinkCommand.getId());
|
BLDevice theDevice = broadlinkMap.get(broadlinkCommand.getId());
|
||||||
@@ -255,6 +255,11 @@ public class BroadlinkHome implements Home {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.warn("Should not get here, no BroadlinkDevices available");
|
||||||
|
theReturn = "[{\"error\":{\"type\": 6, \"address\": \"/lights/" + lightId
|
||||||
|
+ "\",\"description\": \"Should not get here, no Broadlinks available\", \"parameter\": \"/lights/"
|
||||||
|
+ lightId + "state\"}}]";
|
||||||
}
|
}
|
||||||
return theReturn;
|
return theReturn;
|
||||||
}
|
}
|
||||||
@@ -311,6 +316,7 @@ public class BroadlinkHome implements Home {
|
|||||||
public BLDevice[] broadlinkDiscover () {
|
public BLDevice[] broadlinkDiscover () {
|
||||||
BLDevice[] clients = null;
|
BLDevice[] clients = null;
|
||||||
int aDiscoverPort = Configuration.BROADLINK_DISCOVER_PORT;
|
int aDiscoverPort = Configuration.BROADLINK_DISCOVER_PORT;
|
||||||
|
broadlinkMap = new HashMap<String, BLDevice>();
|
||||||
while(aDiscoverPort > 0) {
|
while(aDiscoverPort > 0) {
|
||||||
try {
|
try {
|
||||||
log.info("Broadlink discover....");
|
log.info("Broadlink discover....");
|
||||||
|
|||||||
Reference in New Issue
Block a user