Compare commits

...

2 Commits

Author SHA1 Message Date
Admin
1c7260600a Minor update for HAL decode issue
Fixes #428
2017-02-01 11:31:04 -06:00
Admin
f1592a1998 Issue with not checking for null 2017-01-30 15:57:35 -06:00
3 changed files with 15 additions and 8 deletions

View File

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

View File

@@ -220,19 +220,22 @@ public class DeviceDescriptor{
} }
public boolean containsType(String aType) { public boolean containsType(String aType) {
if(this.mapType.contains(aType)) if(aType == null)
return false;
if(this.mapType != null && this.mapType.contains(aType))
return true; return true;
if(this.deviceType.contains(aType)) if(this.deviceType != null && this.deviceType.contains(aType))
return true; return true;
if(this.onUrl.contains(aType)) if(this.onUrl != null && this.onUrl.contains(aType))
return true; return true;
if(this.dimUrl.contains(aType)) if(this.dimUrl != null && this.dimUrl.contains(aType))
return true; return true;
if(this.offUrl.contains(aType)) if(this.offUrl != null && this.offUrl.contains(aType))
return true; return true;
return false; return false;

View File

@@ -149,8 +149,12 @@ public class HalInfo {
theData = httpClient.doHttpRequest(theUrl, null, null, null, null); theData = httpClient.doHttpRequest(theUrl, null, null, null, null);
if (theData != null) { if (theData != null) {
log.debug("GET IrData for IR Device " + theHalDevice.getHaldevicename() + " HalApiResponse - data: " + theData); log.debug("GET IrData for IR Device " + theHalDevice.getHaldevicename() + " HalApiResponse - data: " + theData);
theHalApiResponse = new Gson().fromJson(theData, DeviceElements.class); try {
if (theHalApiResponse.getDeviceElements() == null) { theHalApiResponse = new Gson().fromJson(theData, DeviceElements.class);
} catch (Exception e) {
theHalApiResponse = null;
}
if (theHalApiResponse == null || theHalApiResponse.getDeviceElements() == null) {
StatusDescription theStatus = new Gson().fromJson(theData, StatusDescription.class); StatusDescription theStatus = new Gson().fromJson(theData, StatusDescription.class);
if (theStatus.getStatus() == null) { if (theStatus.getStatus() == null) {
log.warn("Cannot get buttons for IR Device " + theHalDevice.getHaldevicename() + " for hal " log.warn("Cannot get buttons for IR Device " + theHalDevice.getHaldevicename() + " for hal "