From 6a9540f69ca09047c6b4f65e49e710840dba81c0 Mon Sep 17 00:00:00 2001 From: Seyed Amir Hossein Aqajari Date: Wed, 22 Jan 2020 12:39:33 -0800 Subject: [PATCH] Fixing bugs in infra --- Extractor/Extractor.groovy | 52 ++++++++++++------------ Lock/Locks.groovy | 4 +- MobilePresence/MobilePresence.groovy | 1 - eventSimulator/beaconLeftEvent.groovy | 2 +- eventSimulator/beaconPresentEvent.groovy | 2 +- 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/Extractor/Extractor.groovy b/Extractor/Extractor.groovy index 15edc66..ebef89e 100644 --- a/Extractor/Extractor.groovy +++ b/Extractor/Extractor.groovy @@ -506,22 +506,22 @@ def input(LinkedHashMap metaData) { } if (contains == 0) - globalObjects.append("@Field def buttonObject = new Buttons(sendEvent, init)\n") + globalObjects.append("@Field def buttonObject = new Buttons(sendEvent)\n") if (buttonObjects == 0) { buttonObject0 = metaData['name'] - this[buttonObject0] = new Buttons({}, true) + this[buttonObject0] = new Buttons({}) } else if (buttonObjects == 1) { buttonObject1 = metaData['name'] - this[buttonObject1] = new Buttons({}, true) + this[buttonObject1] = new Buttons({}) } else if (buttonObjects == 2) { buttonObject2 = metaData['name'] - this[buttonObject2] = new Buttons({}, true) + this[buttonObject2] = new Buttons({}) } buttonObjects=buttonObjects+1 - settings.put(metaData['name'], new Buttons({}, true)) + settings.put(metaData['name'], new Buttons({})) if (App == "App1") { extractedObjectsApp1.append("//Object for class Button!\n") @@ -926,22 +926,22 @@ def input(LinkedHashMap metaData) { } if (contains == 0) - globalObjects.append("@Field def momentaryObject = new Momentaries(sendEvent, 1)\n") + globalObjects.append("@Field def momentaryObject = new Momentaries(sendEvent)\n") if (momentaryObjects == 0) { momentaryObject0 = metaData['name'] - this[momentaryObject0] = new Momentaries({}, 1) + this[momentaryObject0] = new Momentaries({}) } else if (momentaryObjects == 1) { momentaryObject1 = metaData['name'] - this[momentaryObject1] = new Momentaries({}, 1) + this[momentaryObject1] = new Momentaries({}) } else if (momentaryObjects == 2) { momentaryObject2 = metaData['name'] - this[momentaryObject2] = new Momentaries({}, 1) + this[momentaryObject2] = new Momentaries({}) } momentaryObjects=momentaryObjects+1 - settings.put(metaData['name'], new Momentaries({}, 1)) + settings.put(metaData['name'], new Momentaries({})) if (App == "App1") { extractedObjectsApp1.append("//Object for class momentory switch class!\n") @@ -1521,22 +1521,22 @@ def input(LinkedHashMap metaData) { } if (contains == 0) - globalObjects.append("@Field def touchSensorObject = new NfcTouch(sendEvent, 1)\n") + globalObjects.append("@Field def touchSensorObject = new NfcTouch(sendEvent)\n") if (touchSensorObjects == 0) { touchSensorObject0 = metaData['name'] - this[touchSensorObject0] = new NfcTouch({}, 1) + this[touchSensorObject0] = new NfcTouch({}) } else if (touchSensorObjects == 1) { touchSensorObject1 = metaData['name'] - this[touchSensorObject1] = new NfcTouch({}, 1) + this[touchSensorObject1] = new NfcTouch({}) } else if (touchSensorObjects == 2) { touchSensorObject2 = metaData['name'] - this[touchSensorObject2] = new NfcTouch({}, 1) + this[touchSensorObject2] = new NfcTouch({}) } touchSensorObjects=touchSensorObjects+1 - settings.put(metaData['name'], new NfcTouch({}, 1)) + settings.put(metaData['name'], new NfcTouch({})) if (App == "App1") { extractedObjectsApp1.append("//Object for class Touch Sensor!\n") @@ -1591,22 +1591,22 @@ def input(LinkedHashMap metaData) { } if (contains == 0) - globalObjects.append("@Field def mobilePresenceObject = new MobilePresences(sendEvent, 1)\n") + globalObjects.append("@Field def mobilePresenceObject = new MobilePresences(sendEvent)\n") if (mobilePresenceObjects == 0) { mobilePresenceObject0 = metaData['name'] - this[mobilePresenceObject0] = new MobilePresences({}, 1) + this[mobilePresenceObject0] = new MobilePresences({}) } else if (mobilePresenceObjects == 1) { mobilePresenceObject1 = metaData['name'] - this[mobilePresenceObject1] = new MobilePresences({}, 1) + this[mobilePresenceObject1] = new MobilePresences({}) } else if (mobilePresenceObjects == 2) { mobilePresenceObject2 = metaData['name'] - this[mobilePresenceObject2] = new MobilePresences({}, 1) + this[mobilePresenceObject2] = new MobilePresences({}) } mobilePresenceObjects=mobilePresenceObjects+1 - settings.put(metaData['name'], new MobilePresences({}, 1)) + settings.put(metaData['name'], new MobilePresences({})) if (App == "App1") { extractedObjectsApp1.append("//Object for class mobile presence!\n") @@ -1625,22 +1625,22 @@ def input(LinkedHashMap metaData) { } } if (contains == 0) - globalObjects.append("@Field def aeonKeyFobObject = new AeonKeyFobs(sendEvent, 1)\n") + globalObjects.append("@Field def aeonKeyFobObject = new AeonKeyFobs(sendEvent)\n") if (aeonKeyFobObjects == 0) { aeonKeyFobObject0 = metaData['name'] - this[aeonKeyFobObject0] = new AeonKeyFobs({}, 1) + this[aeonKeyFobObject0] = new AeonKeyFobs({}) } else if (aeonKeyFobObjects == 1) { aeonKeyFobObject1 = metaData['name'] - this[aeonKeyFobObject1] = new AeonKeyFobs({}, 1) + this[aeonKeyFobObject1] = new AeonKeyFobs({}) } else if (aeonKeyFobObjects == 2) { aeonKeyFobObject2 = metaData['name'] - this[aeonKeyFobObject2] = new AeonKeyFobs({}, 1) + this[aeonKeyFobObject2] = new AeonKeyFobs({}) } aeonKeyFobObjects=aeonKeyFobObjects+1 - settings.put(metaData['name'], new AeonKeyFobs({}, 1)) + settings.put(metaData['name'], new AeonKeyFobs({})) if (App == "App1") { extractedObjectsApp1.append("//Object for class aeon key fob!\n") @@ -2155,7 +2155,7 @@ def preferences(Closure inputData) { GlobalVariablesBothApps.append("//Creating Global variables for both apps\n") GlobalVariablesBothApps.append("@Field def sendEvent = {eventDataMap -> eventHandler(eventDataMap)}\n") GlobalVariablesBothApps.append("@Field def locationObject = new LocationVar(sendEvent, init)\n") - GlobalVariablesBothApps.append("@Field def appObject = new Touched(sendEvent, 0)\n") + GlobalVariablesBothApps.append("@Field def appObject = new Touched(sendEvent)\n") globalObjects.withReader { reader -> while ((line = reader.readLine()) != null) { diff --git a/Lock/Locks.groovy b/Lock/Locks.groovy index d65e3f6..381bf2a 100644 --- a/Lock/Locks.groovy +++ b/Lock/Locks.groovy @@ -2,12 +2,12 @@ package Lock import SmartThing.SmartThings -public class Locks extends SmartThing { +public class Locks extends SmartThings { List locks = new ArrayList() Locks(Closure sendEvent, boolean init) { // Only initialize one time since we only have one device for each capability - thermostats = smartThings + locks = smartThings // Initialization StringBuilder id = new StringBuilder("lockID0") diff --git a/MobilePresence/MobilePresence.groovy b/MobilePresence/MobilePresence.groovy index 4f9e4a9..7e6ff0a 100644 --- a/MobilePresence/MobilePresence.groovy +++ b/MobilePresence/MobilePresence.groovy @@ -15,7 +15,6 @@ public class MobilePresence extends SmartThing { MobilePresence(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder deviceNetworkId) { deviceValuesMap = deviceValueSmartThing - deviceIntValuesMap = deviceIntValueSmartThing idSmartThing = id labelSmartThing = label displayNameSmartThing = displayName diff --git a/eventSimulator/beaconLeftEvent.groovy b/eventSimulator/beaconLeftEvent.groovy index 445e51f..21a077c 100644 --- a/eventSimulator/beaconLeftEvent.groovy +++ b/eventSimulator/beaconLeftEvent.groovy @@ -1,2 +1,2 @@ - beaconSensorObject.setValue([name: "presence", value: "not present", deviceId: "beaconSensorID0", descriptionText: "", + beaconSensorObject[0].setValue([name: "presence", value: "not present", deviceId: "beaconSensorID0", descriptionText: "", displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"presence":"0","dni":"mobile0"}']) diff --git a/eventSimulator/beaconPresentEvent.groovy b/eventSimulator/beaconPresentEvent.groovy index 91739cc..c09776d 100644 --- a/eventSimulator/beaconPresentEvent.groovy +++ b/eventSimulator/beaconPresentEvent.groovy @@ -1,2 +1,2 @@ - beaconSensorObject.setValue([name: "presence", value: "present", deviceId: "beaconSensorID0", descriptionText: "", + beaconSensorObject[0].setValue([name: "presence", value: "present", deviceId: "beaconSensorID0", descriptionText: "", displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"presence":"1","dni":"mobile0"}']) -- 2.34.1