From 90f2bce28273253dfcd60704dbd8dcc3926e85ff Mon Sep 17 00:00:00 2001 From: Admin Date: Mon, 14 Nov 2016 16:43:33 -0600 Subject: [PATCH] Fixed requester filter for multiple echos. Started MQTT MEssage screen. --- pom.xml | 2 +- .../HABridge/dao/DeviceRepository.java | 16 +- .../java/com/bwssystems/mqtt/MQTTHome.java | 2 +- .../resources/public/views/mqttpublish.html | 151 ++++++++++++++++++ 4 files changed, 162 insertions(+), 9 deletions(-) create mode 100644 src/main/resources/public/views/mqttpublish.html diff --git a/pom.xml b/pom.xml index 6066ff5..94937bd 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.bwssystems.HABridge ha-bridge - 3.2.2b + 3.2.2c jar HA Bridge diff --git a/src/main/java/com/bwssystems/HABridge/dao/DeviceRepository.java b/src/main/java/com/bwssystems/HABridge/dao/DeviceRepository.java index 3b3e688..8a8ed87 100644 --- a/src/main/java/com/bwssystems/HABridge/dao/DeviceRepository.java +++ b/src/main/java/com/bwssystems/HABridge/dao/DeviceRepository.java @@ -101,13 +101,15 @@ public class DeviceRepository extends BackupHandler { theDevice = anIterator.next(); theRequesterAddress = theDevice.getRequesterAddress(); addressMap = new HashMap(); - if (theRequesterAddress.contains(",")) { - String[] theArray = theRequesterAddress.split(","); - for (String v : theArray) { - addressMap.put(v, v); - } - } else - addressMap.put(theRequesterAddress, theRequesterAddress); + if(theRequesterAddress != null) { + if (theRequesterAddress.contains(",")) { + String[] theArray = theRequesterAddress.split(","); + for (String v : theArray) { + addressMap.put(v.trim(), v.trim()); + } + } else + addressMap.put(theRequesterAddress, theRequesterAddress); + } if (theRequesterAddress == null || theRequesterAddress.length() == 0 || addressMap.containsKey(anAddress)) theReturnList.add(theDevice); } diff --git a/src/main/java/com/bwssystems/mqtt/MQTTHome.java b/src/main/java/com/bwssystems/mqtt/MQTTHome.java index a2794a2..85df1fb 100644 --- a/src/main/java/com/bwssystems/mqtt/MQTTHome.java +++ b/src/main/java/com/bwssystems/mqtt/MQTTHome.java @@ -31,7 +31,7 @@ public class MQTTHome { public void shutdownMQTTClients() { log.debug("Shutting down MQTT handlers."); - if(!handlers.isEmpty()) { + if(handlers != null && !handlers.isEmpty()) { Iterator keys = handlers.keySet().iterator(); while(keys.hasNext()) { String key = keys.next(); diff --git a/src/main/resources/public/views/mqttpublish.html b/src/main/resources/public/views/mqttpublish.html new file mode 100644 index 0000000..8729723 --- /dev/null +++ b/src/main/resources/public/views/mqttpublish.html @@ -0,0 +1,151 @@ + + +
+
+

MQTT Messages

+
+
+

For any MQTT Broker, use the + build button to generate the configuration for the publish generation. + You can add topic and content in the text areas provided + then selecting the publish generation. Then you can modify the name + to anything you want that will be the keyword for Alexa. Click the + 'Add Bridge Device' to finish that selection setup. The 'Already + Configured MQTT Publish messages' list below will show what is already + setup for your MQTT Brokers.

+
+ + + + + + + + + + + + + + + + + + + + + +
RowClientIDIPTopicContentActions
{{$index+1}}{{mqtt.broker.name}}{{mqtt.broker.ip}} + + < + + + +
+
+ + +
+
+
+

+ Already Configured MQTT Messages +

+
+ + + + + + + + + + + + + + + + + + +
RowNameClientIDMQTT Message IDActions
{{$index+1}}{{device.name}}{{device.targetDevice}}{{device.mapId}} + +
+
+
+
+
+

Add a Bridge Device for MQTT Messages

+
+
+
+
+ + +
+ +
+ +
+
+
+ + +
+ +
+ +
+
+
+
+ + +
+ +
+
+
+
+
+
+ \ No newline at end of file