mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-04-16 14:23:08 +01:00
Wattvision updates from production
This commit is contained in:
@@ -346,18 +346,20 @@ private getSensorJSON(id, key) {
|
|||||||
|
|
||||||
def sensorUrl = "${wattvisionBaseURL()}/partners/smartthings/sensor_list?api_id=${id}&api_key=${key}"
|
def sensorUrl = "${wattvisionBaseURL()}/partners/smartthings/sensor_list?api_id=${id}&api_key=${key}"
|
||||||
|
|
||||||
httpGet(uri: sensorUrl) { response ->
|
httpGet(uri: sensorUrl) { response ->
|
||||||
|
|
||||||
def json = new org.json.JSONObject(response.data)
|
def sensors = [:]
|
||||||
|
|
||||||
state.sensors = json
|
response.data.each { sensorId, sensorName ->
|
||||||
|
sensors[sensorId] = sensorName
|
||||||
json.each { sensorId, sensorName ->
|
|
||||||
createChild(sensorId, sensorName)
|
createChild(sensorId, sensorName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.sensors = sensors
|
||||||
|
|
||||||
return "success"
|
return "success"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def createChild(sensorId, sensorName) {
|
def createChild(sensorId, sensorName) {
|
||||||
|
|||||||
Reference in New Issue
Block a user