diff --git a/devicetypes/smartthings/cree-bulb.src/cree-bulb.groovy b/devicetypes/smartthings/cree-bulb.src/cree-bulb.groovy index ed5e751..f956800 100644 --- a/devicetypes/smartthings/cree-bulb.src/cree-bulb.groovy +++ b/devicetypes/smartthings/cree-bulb.src/cree-bulb.groovy @@ -67,12 +67,6 @@ def parse(String description) { def resultMap = zigbee.getEvent(description) if (resultMap) { sendEvent(resultMap) - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() } else { log.debug "DID NOT PARSE MESSAGE for description : $description" @@ -96,15 +90,7 @@ def setLevel(value) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.levelRefresh() - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.levelRefresh() } def refresh() { @@ -117,6 +103,8 @@ def poll() { def configure() { log.debug "Configuring Reporting and Bindings." - sendEvent(name: "checkInterval", value: 1200, displayed: false, data: [protocol: "zigbee"]) - zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) + // minReportTime 0 seconds, maxReportTime 5 min. Reporting interval if no activity + zigbee.onOffConfig(0, 300) + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() } diff --git a/devicetypes/smartthings/ecobee-thermostat.src/ecobee-thermostat.groovy b/devicetypes/smartthings/ecobee-thermostat.src/ecobee-thermostat.groovy index 7b08b14..a16d28c 100644 --- a/devicetypes/smartthings/ecobee-thermostat.src/ecobee-thermostat.groovy +++ b/devicetypes/smartthings/ecobee-thermostat.src/ecobee-thermostat.groovy @@ -152,11 +152,11 @@ def generateEvent(Map results) { sendValue = location.temperatureScale == "C"? roundC(sendValue) : sendValue isChange = isTemperatureStateChange(device, name, value.toString()) isDisplayed = isChange - event << [value: sendValue, isStateChange: isChange, displayed: isDisplayed] + event << [value: sendValue, unit: temperatureScale, isStateChange: isChange, displayed: isDisplayed] } else if (name=="maxCoolingSetpoint" || name=="minCoolingSetpoint" || name=="maxHeatingSetpoint" || name=="minHeatingSetpoint") { def sendValue = convertTemperatureIfNeeded(value.toDouble(), "F", 1) //API return temperature value in F sendValue = location.temperatureScale == "C"? roundC(sendValue) : sendValue - event << [value: sendValue, displayed: false] + event << [value: sendValue, unit: temperatureScale, displayed: false] } else if (name=="heatMode" || name=="coolMode" || name=="autoMode" || name=="auxHeatMode"){ isChange = isStateChange(device, name, value.toString()) event << [value: value.toString(), isStateChange: isChange, displayed: false] @@ -234,9 +234,9 @@ void setHeatingSetpoint(setpoint) { def heatingValue = location.temperatureScale == "C"? convertCtoF(heatingSetpoint) : heatingSetpoint def sendHoldType = holdType ? (holdType=="Temporary")? "nextTransition" : (holdType=="Permanent")? "indefinite" : "indefinite" : "indefinite" - if (parent.setHold(this, heatingValue, coolingValue, deviceId, sendHoldType)) { - sendEvent("name":"heatingSetpoint", "value":heatingSetpoint) - sendEvent("name":"coolingSetpoint", "value":coolingSetpoint) + if (parent.setHold(heatingValue, coolingValue, deviceId, sendHoldType)) { + sendEvent("name":"heatingSetpoint", "value":heatingSetpoint, "unit":location.temperatureScale) + sendEvent("name":"coolingSetpoint", "value":coolingSetpoint, "unit":location.temperatureScale) log.debug "Done setHeatingSetpoint> coolingSetpoint: ${coolingSetpoint}, heatingSetpoint: ${heatingSetpoint}" generateSetpointEvent() generateStatusEvent() @@ -271,9 +271,9 @@ void setCoolingSetpoint(setpoint) { def heatingValue = location.temperatureScale == "C"? convertCtoF(heatingSetpoint) : heatingSetpoint def sendHoldType = holdType ? (holdType=="Temporary")? "nextTransition" : (holdType=="Permanent")? "indefinite" : "indefinite" : "indefinite" - if (parent.setHold(this, heatingValue, coolingValue, deviceId, sendHoldType)) { - sendEvent("name":"heatingSetpoint", "value":heatingSetpoint) - sendEvent("name":"coolingSetpoint", "value":coolingSetpoint) + if (parent.setHold(heatingValue, coolingValue, deviceId, sendHoldType)) { + sendEvent("name":"heatingSetpoint", "value":heatingSetpoint, "unit":location.temperatureScale) + sendEvent("name":"coolingSetpoint", "value":coolingSetpoint, "unit":location.temperatureScale) log.debug "Done setCoolingSetpoint>> coolingSetpoint = ${coolingSetpoint}, heatingSetpoint = ${heatingSetpoint}" generateSetpointEvent() generateStatusEvent() @@ -287,14 +287,14 @@ void resumeProgram() { log.debug "resumeProgram() is called" sendEvent("name":"thermostatStatus", "value":"resuming schedule", "description":statusText, displayed: false) def deviceId = device.deviceNetworkId.split(/\./).last() - if (parent.resumeProgram(this, deviceId)) { + if (parent.resumeProgram(deviceId)) { sendEvent("name":"thermostatStatus", "value":"setpoint is updating", "description":statusText, displayed: false) runIn(5, "poll") log.debug "resumeProgram() is done" sendEvent("name":"resumeProgram", "value":"resume", descriptionText: "resumeProgram is done", displayed: false, isStateChange: true) } else { sendEvent("name":"thermostatStatus", "value":"failed resume click refresh", "description":statusText, displayed: false) - log.error "Error resumeProgram() check parent.resumeProgram(this, deviceId)" + log.error "Error resumeProgram() check parent.resumeProgram(deviceId)" } } @@ -406,7 +406,7 @@ def generateOperatingStateEvent(operatingState) { def off() { log.debug "off" def deviceId = device.deviceNetworkId.split(/\./).last() - if (parent.setMode (this,"off", deviceId)) + if (parent.setMode ("off", deviceId)) generateModeEvent("off") else { log.debug "Error setting new mode." @@ -420,7 +420,7 @@ def off() { def heat() { log.debug "heat" def deviceId = device.deviceNetworkId.split(/\./).last() - if (parent.setMode (this,"heat", deviceId)) + if (parent.setMode ("heat", deviceId)) generateModeEvent("heat") else { log.debug "Error setting new mode." @@ -438,7 +438,7 @@ def emergencyHeat() { def auxHeatOnly() { log.debug "auxHeatOnly" def deviceId = device.deviceNetworkId.split(/\./).last() - if (parent.setMode (this,"auxHeatOnly", deviceId)) + if (parent.setMode ("auxHeatOnly", deviceId)) generateModeEvent("auxHeatOnly") else { log.debug "Error setting new mode." @@ -452,7 +452,7 @@ def auxHeatOnly() { def cool() { log.debug "cool" def deviceId = device.deviceNetworkId.split(/\./).last() - if (parent.setMode (this,"cool", deviceId)) + if (parent.setMode ("cool", deviceId)) generateModeEvent("cool") else { log.debug "Error setting new mode." @@ -466,7 +466,7 @@ def cool() { def auto() { log.debug "auto" def deviceId = device.deviceNetworkId.split(/\./).last() - if (parent.setMode (this,"auto", deviceId)) + if (parent.setMode ("auto", deviceId)) generateModeEvent("auto") else { log.debug "Error setting new mode." @@ -489,7 +489,7 @@ def fanOn() { def coolingValue = location.temperatureScale == "C"? convertCtoF(coolingSetpoint) : coolingSetpoint def heatingValue = location.temperatureScale == "C"? convertCtoF(heatingSetpoint) : heatingSetpoint - if (parent.setFanMode(this, heatingValue, coolingValue, deviceId, sendHoldType, fanMode)) { + if (parent.setFanMode(heatingValue, coolingValue, deviceId, sendHoldType, fanMode)) { generateFanModeEvent(fanMode) } else { log.debug "Error setting new mode." @@ -510,7 +510,7 @@ def fanAuto() { def coolingValue = location.temperatureScale == "C"? convertCtoF(coolingSetpoint) : coolingSetpoint def heatingValue = location.temperatureScale == "C"? convertCtoF(heatingSetpoint) : heatingSetpoint - if (parent.setFanMode(this, heatingValue, coolingValue, deviceId, sendHoldType, fanMode)) { + if (parent.setFanMode(heatingValue, coolingValue, deviceId, sendHoldType, fanMode)) { generateFanModeEvent(fanMode) } else { log.debug "Error setting new mode." @@ -556,12 +556,12 @@ def generateSetpointEvent() { if (mode == "heat") { - sendEvent("name":"thermostatSetpoint", "value":heatingSetpoint ) + sendEvent("name":"thermostatSetpoint", "value":heatingSetpoint, "unit":location.temperatureScale) } else if (mode == "cool") { - sendEvent("name":"thermostatSetpoint", "value":coolingSetpoint) + sendEvent("name":"thermostatSetpoint", "value":coolingSetpoint, "unit":location.temperatureScale) } else if (mode == "auto") { @@ -573,7 +573,7 @@ def generateSetpointEvent() { } else if (mode == "auxHeatOnly") { - sendEvent("name":"thermostatSetpoint", "value":heatingSetpoint) + sendEvent("name":"thermostatSetpoint", "value":heatingSetpoint, "unit":location.temperatureScale) } @@ -608,7 +608,7 @@ void raiseSetpoint() { targetvalue = maxCoolingSetpoint } - sendEvent("name":"thermostatSetpoint", "value":targetvalue, displayed: false) + sendEvent("name":"thermostatSetpoint", "value":targetvalue, "unit":location.temperatureScale, displayed: false) log.info "In mode $mode raiseSetpoint() to $targetvalue" runIn(3, "alterSetpoint", [data: [value:targetvalue], overwrite: true]) //when user click button this runIn will be overwrite @@ -644,7 +644,7 @@ void lowerSetpoint() { targetvalue = minCoolingSetpoint } - sendEvent("name":"thermostatSetpoint", "value":targetvalue, displayed: false) + sendEvent("name":"thermostatSetpoint", "value":targetvalue, "unit":location.temperatureScale, displayed: false) log.info "In mode $mode lowerSetpoint() to $targetvalue" runIn(3, "alterSetpoint", [data: [value:targetvalue], overwrite: true]) //when user click button this runIn will be overwrite @@ -690,10 +690,10 @@ void alterSetpoint(temp) { def coolingValue = location.temperatureScale == "C"? convertCtoF(targetCoolingSetpoint) : targetCoolingSetpoint def heatingValue = location.temperatureScale == "C"? convertCtoF(targetHeatingSetpoint) : targetHeatingSetpoint - if (parent.setHold(this, heatingValue, coolingValue, deviceId, sendHoldType)) { + if (parent.setHold(heatingValue, coolingValue, deviceId, sendHoldType)) { sendEvent("name": "thermostatSetpoint", "value": temp.value, displayed: false) - sendEvent("name": "heatingSetpoint", "value": targetHeatingSetpoint) - sendEvent("name": "coolingSetpoint", "value": targetCoolingSetpoint) + sendEvent("name": "heatingSetpoint", "value": targetHeatingSetpoint, "unit": location.temperatureScale) + sendEvent("name": "coolingSetpoint", "value": targetCoolingSetpoint, "unit": location.temperatureScale) log.debug "alterSetpoint in mode $mode succeed change setpoint to= ${temp.value}" } else { log.error "Error alterSetpoint()" diff --git a/devicetypes/smartthings/hue-bloom.src/hue-bloom.groovy b/devicetypes/smartthings/hue-bloom.src/hue-bloom.groovy index f99f436..ff4405a 100644 --- a/devicetypes/smartthings/hue-bloom.src/hue-bloom.groovy +++ b/devicetypes/smartthings/hue-bloom.src/hue-bloom.groovy @@ -16,6 +16,7 @@ metadata { capability "Switch" capability "Refresh" capability "Sensor" + capability "Health Check" command "setAdjustedColor" command "reset" @@ -55,6 +56,10 @@ metadata { } } +void installed() { + sendEvent(name: "checkInterval", value: 60 * 15, data: [protocol: "lan"], displayed: false) +} + // parse events into attributes def parse(description) { log.debug "parse() - $description" @@ -166,3 +171,7 @@ def verifyPercent(percent) { return false } } + +def ping() { + log.debug "${parent.ping(this)}" +} diff --git a/devicetypes/smartthings/hue-bulb.src/hue-bulb.groovy b/devicetypes/smartthings/hue-bulb.src/hue-bulb.groovy index 0c3d917..6642672 100644 --- a/devicetypes/smartthings/hue-bulb.src/hue-bulb.groovy +++ b/devicetypes/smartthings/hue-bulb.src/hue-bulb.groovy @@ -17,6 +17,7 @@ metadata { capability "Switch" capability "Refresh" capability "Sensor" + capability "Health Check" command "setAdjustedColor" command "reset" @@ -64,6 +65,10 @@ metadata { } } +void installed() { + sendEvent(name: "checkInterval", value: 60 * 15, data: [protocol: "lan"], displayed: false) +} + // parse events into attributes def parse(description) { log.debug "parse() - $description" @@ -182,3 +187,7 @@ def verifyPercent(percent) { return false } } + +def ping() { + log.trace "${parent.ping(this)}" +} diff --git a/devicetypes/smartthings/hue-lux-bulb.src/hue-lux-bulb.groovy b/devicetypes/smartthings/hue-lux-bulb.src/hue-lux-bulb.groovy index 728b265..4d8bfbb 100644 --- a/devicetypes/smartthings/hue-lux-bulb.src/hue-lux-bulb.groovy +++ b/devicetypes/smartthings/hue-lux-bulb.src/hue-lux-bulb.groovy @@ -14,6 +14,7 @@ metadata { capability "Switch" capability "Refresh" capability "Sensor" + capability "Health Check" command "refresh" } @@ -48,6 +49,10 @@ metadata { } } +void installed() { + sendEvent(name: "checkInterval", value: 60 * 15, data: [protocol: "lan"], displayed: false) +} + // parse events into attributes def parse(description) { log.debug "parse() - $description" @@ -87,3 +92,7 @@ void refresh() { log.debug "Executing 'refresh'" parent.manualRefresh() } + +def ping() { + log.debug "${parent.ping(this)}" +} diff --git a/devicetypes/smartthings/hue-white-ambiance-bulb.src/hue-white-ambiance-bulb.groovy b/devicetypes/smartthings/hue-white-ambiance-bulb.src/hue-white-ambiance-bulb.groovy index 0a25741..b24b1dd 100644 --- a/devicetypes/smartthings/hue-white-ambiance-bulb.src/hue-white-ambiance-bulb.groovy +++ b/devicetypes/smartthings/hue-white-ambiance-bulb.src/hue-white-ambiance-bulb.groovy @@ -15,6 +15,7 @@ metadata { capability "Color Temperature" capability "Switch" capability "Refresh" + capability "Health Check" command "refresh" } @@ -53,6 +54,10 @@ metadata { } } +void installed() { + sendEvent(name: "checkInterval", value: 60 * 15, data: [protocol: "lan"], displayed: false) +} + // parse events into attributes def parse(description) { log.debug "parse() - $description" @@ -101,3 +106,7 @@ void refresh() { log.debug "Executing 'refresh'" parent.manualRefresh() } + +def ping() { + log.debug "${parent.ping(this)}" +} diff --git a/devicetypes/smartthings/osram-lightify-gardenspot-mini-rgb.src/osram-lightify-gardenspot-mini-rgb.groovy b/devicetypes/smartthings/osram-lightify-gardenspot-mini-rgb.src/osram-lightify-gardenspot-mini-rgb.groovy index bc2d7ba..2dc1bf6 100644 --- a/devicetypes/smartthings/osram-lightify-gardenspot-mini-rgb.src/osram-lightify-gardenspot-mini-rgb.groovy +++ b/devicetypes/smartthings/osram-lightify-gardenspot-mini-rgb.src/osram-lightify-gardenspot-mini-rgb.groovy @@ -91,7 +91,7 @@ def parse(String description) { if (descMap.cluster == "0300") { if(descMap.attrId == "0000"){ //Hue Attribute - def hueValue = Math.round(convertHexToInt(descMap.value) / 255 * 360) + def hueValue = Math.round(convertHexToInt(descMap.value) / 255 * 100) log.debug "Hue value returned is $hueValue" sendEvent(name: "hue", value: hueValue, displayed:false) } @@ -203,7 +203,7 @@ def setLevel(value) { //input Hue Integer values; returns color name for saturation 100% private getColorName(hueValue){ - if(hueValue>360 || hueValue<0) + if(hueValue>100 || hueValue<0) return hueValue = Math.round(hueValue / 100 * 360) diff --git a/devicetypes/smartthings/osram-lightify-led-flexible-strip-rgbw.src/osram-lightify-led-flexible-strip-rgbw.groovy b/devicetypes/smartthings/osram-lightify-led-flexible-strip-rgbw.src/osram-lightify-led-flexible-strip-rgbw.groovy index e3d15d1..ef1ff1c 100644 --- a/devicetypes/smartthings/osram-lightify-led-flexible-strip-rgbw.src/osram-lightify-led-flexible-strip-rgbw.groovy +++ b/devicetypes/smartthings/osram-lightify-led-flexible-strip-rgbw.src/osram-lightify-led-flexible-strip-rgbw.groovy @@ -1,4 +1,4 @@ -/* +/* Osram Flex RGBW Light Strip Osram bulbs have a firmware issue causing it to forget its dimming level when turned off (via commands). Handling @@ -8,7 +8,7 @@ metadata { definition (name: "OSRAM LIGHTIFY LED Flexible Strip RGBW", namespace: "smartthings", author: "SmartThings") { - + capability "Color Temperature" capability "Actuator" capability "Switch" @@ -18,7 +18,7 @@ metadata { capability "Refresh" capability "Sensor" capability "Color Control" - + attribute "colorName", "string" command "setAdjustedColor" @@ -49,7 +49,7 @@ metadata { standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") { state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh" } - + controlTile("colorTempSliderControl", "device.colorTemperature", "slider", height: 1, width: 2, inactiveLabel: false, range:"(2700..6500)") { state "colorTemperature", action:"color temperature.setColorTemperature" } @@ -118,7 +118,7 @@ def parse(String description) { } } else if(descMap.attrId == "0000"){ //Hue Attribute - def hueValue = Math.round(convertHexToInt(descMap.value) / 255 * 360) + def hueValue = Math.round(convertHexToInt(descMap.value) / 255 * 100) log.debug "Hue value returned is $hueValue" sendEvent(name: "hue", value: hueValue, displayed:false) } @@ -274,7 +274,7 @@ private getGenericName(value){ //input Hue Integer values; returns color name for saturation 100% private getColorName(hueValue){ - if(hueValue>360 || hueValue<0) + if(hueValue>100 || hueValue<0) return hueValue = Math.round(hueValue / 100 * 360) @@ -449,7 +449,7 @@ def setColor(value){ def level = hex(value.level * 255 / 100) cmd << zigbeeSetLevel(level) } - + if (value.switch == "off") { cmd << "delay 150" cmd << off() diff --git a/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy b/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy index b978cc0..f4e6e0d 100644 --- a/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy +++ b/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy @@ -101,12 +101,6 @@ def parse(String description) { else { def descriptionText = finalResult.value == "on" ? '{{ device.displayName }} is On' : '{{ device.displayName }} is Off' sendEvent(name: finalResult.type, value: finalResult.value, descriptionText: descriptionText, translatable: true) - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() } } else { @@ -126,15 +120,7 @@ def on() { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.onOffRefresh() - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.onOffRefresh() } def refresh() { @@ -142,8 +128,10 @@ def refresh() { } def configure() { - sendEvent(name: "checkInterval", value: 1200, displayed: false, data: [protocol: "zigbee"]) - zigbee.onOffConfig() + powerConfig() + refresh() + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) + // OnOff minReportTime 0 seconds, maxReportTime 5 min. Reporting interval if no activity + zigbee.onOffConfig(0, 300) + powerConfig() + refresh() } //power config for devices with min reporting interval as 1 seconds and reporting interval if no activity as 10min (600s) diff --git a/devicetypes/smartthings/smartsense-moisture-sensor.src/smartsense-moisture-sensor.groovy b/devicetypes/smartthings/smartsense-moisture-sensor.src/smartsense-moisture-sensor.groovy index 2e9745d..415fd73 100644 --- a/devicetypes/smartthings/smartsense-moisture-sensor.src/smartsense-moisture-sensor.groovy +++ b/devicetypes/smartthings/smartsense-moisture-sensor.src/smartsense-moisture-sensor.groovy @@ -101,13 +101,6 @@ def parse(String description) { map = parseIasMessage(description) } - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() - log.debug "Parse returned $map" def result = map ? createEvent(map) : null @@ -285,15 +278,7 @@ private Map getMoistureResult(value) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level } def refresh() { @@ -307,23 +292,19 @@ def refresh() { } def configure() { - sendEvent(name: "checkInterval", value: 14400, displayed: false, data: [protocol: "zigbee"]) + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) log.debug "Configuring Reporting, IAS CIE, and Bindings." - def configCmds = [ + def enrollCmds = [ "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 1", "delay 500", - - "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 1 {${device.zigbeeId}} {}", "delay 500", - "zcl global send-me-a-report 1 0x20 0x20 30 21600 {01}", //checkin time 6 hrs - "send 0x${device.deviceNetworkId} 1 1", "delay 500", - - "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0x402 {${device.zigbeeId}} {}", "delay 500", - "zcl global send-me-a-report 0x402 0 0x29 30 3600 {6400}", - "send 0x${device.deviceNetworkId} 1 1", "delay 500" ] - return configCmds + refresh() // send refresh cmds as part of config + + // temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity + // battery minReport 30 seconds, maxReportTime 6 hrs by default + return enrollCmds + zigbee.batteryConfig() + zigbee.temperatureConfig(30, 300) + refresh() // send refresh cmds as part of config } def enrollResponse() { diff --git a/devicetypes/smartthings/smartsense-motion-sensor.src/smartsense-motion-sensor.groovy b/devicetypes/smartthings/smartsense-motion-sensor.src/smartsense-motion-sensor.groovy index c5128b1..1a7ecec 100644 --- a/devicetypes/smartthings/smartsense-motion-sensor.src/smartsense-motion-sensor.groovy +++ b/devicetypes/smartthings/smartsense-motion-sensor.src/smartsense-motion-sensor.groovy @@ -105,13 +105,6 @@ def parse(String description) { map = parseIasMessage(description) } - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() - log.debug "Parse returned $map" def result = map ? createEvent(map) : null @@ -296,15 +289,7 @@ private Map getMotionResult(value) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level } def refresh() { @@ -318,24 +303,19 @@ def refresh() { } def configure() { - sendEvent(name: "checkInterval", value: 14400, displayed: false, data: [protocol: "zigbee"]) + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) log.debug "Configuring Reporting, IAS CIE, and Bindings." - def configCmds = [ + def enrollCmds = [ "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - - "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 1 {${device.zigbeeId}} {}", "delay 200", - "zcl global send-me-a-report 1 0x20 0x20 30 21600 {01}", //checkin time 6 hrs - "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - - "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0x402 {${device.zigbeeId}} {}", "delay 200", - "zcl global send-me-a-report 0x402 0 0x29 300 3600 {6400}", - "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500" ] - return configCmds + refresh() // send refresh cmds as part of config + // temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity + // battery minReport 30 seconds, maxReportTime 6 hrs by default + return enrollCmds + zigbee.batteryConfig() + zigbee.temperatureConfig(30, 300) + refresh() // send refresh cmds as part of config } def enrollResponse() { diff --git a/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy b/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy index 94575bd..6ce4044 100644 --- a/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy +++ b/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy @@ -127,13 +127,6 @@ def parse(String description) { map = parseIasMessage(description) } - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() - def result = map ? createEvent(map) : null if (description?.startsWith('enroll request')) { @@ -378,15 +371,7 @@ private getAccelerationResult(numValue) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level } def refresh() { @@ -416,13 +401,16 @@ def refresh() { } def configure() { - sendEvent(name: "checkInterval", value: 14400, displayed: false, data: [protocol: "zigbee"]) + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) log.debug "Configuring Reporting" + // temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity + // battery minReport 30 seconds, maxReportTime 6 hrs by default def configCmds = enrollResponse() + zigbee.batteryConfig() + - zigbee.temperatureConfig() + + zigbee.temperatureConfig(30, 300) + zigbee.configureReporting(0xFC02, 0x0010, 0x18, 10, 3600, 0x01, [mfgCode: manufacturerCode]) + zigbee.configureReporting(0xFC02, 0x0012, 0x29, 1, 3600, 0x0001, [mfgCode: manufacturerCode]) + zigbee.configureReporting(0xFC02, 0x0013, 0x29, 1, 3600, 0x0001, [mfgCode: manufacturerCode]) + diff --git a/devicetypes/smartthings/smartsense-open-closed-sensor.src/smartsense-open-closed-sensor.groovy b/devicetypes/smartthings/smartsense-open-closed-sensor.src/smartsense-open-closed-sensor.groovy index 7fbd099..7d9c4c9 100644 --- a/devicetypes/smartthings/smartsense-open-closed-sensor.src/smartsense-open-closed-sensor.groovy +++ b/devicetypes/smartthings/smartsense-open-closed-sensor.src/smartsense-open-closed-sensor.groovy @@ -92,13 +92,6 @@ def parse(String description) { map = parseIasMessage(description) } - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() - log.debug "Parse returned $map" def result = map ? createEvent(map) : null @@ -248,15 +241,7 @@ private Map getContactResult(value) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level } def refresh() { @@ -270,23 +255,19 @@ def refresh() { } def configure() { - sendEvent(name: "checkInterval", value: 14400, displayed: false, data: [protocol: "zigbee"]) + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) log.debug "Configuring Reporting, IAS CIE, and Bindings." - def configCmds = [ + def enrollCmds = [ "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 1", "delay 500", - - "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 1 {${device.zigbeeId}} {}", "delay 500", - "zcl global send-me-a-report 1 0x20 0x20 30 21600 {01}", //checkin time 6 hrs - "send 0x${device.deviceNetworkId} 1 1", "delay 500", - - "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0x402 {${device.zigbeeId}} {}", "delay 500", - "zcl global send-me-a-report 0x402 0 0x29 30 3600 {6400}", - "send 0x${device.deviceNetworkId} 1 1", "delay 500" ] - return configCmds + refresh() // send refresh cmds as part of config + + // temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity + // battery minReport 30 seconds, maxReportTime 6 hrs by default + return enrollCmds + zigbee.batteryConfig() + zigbee.temperatureConfig(30, 300) + refresh() // send refresh cmds as part of config } def enrollResponse() { diff --git a/devicetypes/smartthings/smartsense-temp-humidity-sensor.src/smartsense-temp-humidity-sensor.groovy b/devicetypes/smartthings/smartsense-temp-humidity-sensor.src/smartsense-temp-humidity-sensor.groovy index b320853..96b56e5 100644 --- a/devicetypes/smartthings/smartsense-temp-humidity-sensor.src/smartsense-temp-humidity-sensor.groovy +++ b/devicetypes/smartthings/smartsense-temp-humidity-sensor.src/smartsense-temp-humidity-sensor.groovy @@ -83,13 +83,6 @@ def parse(String description) { map = parseCustomMessage(description) } - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() - log.debug "Parse returned $map" return map ? createEvent(map) : null } @@ -253,14 +246,7 @@ private Map getHumidityResult(value) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level } def refresh() @@ -278,23 +264,19 @@ def refresh() } def configure() { - sendEvent(name: "checkInterval", value: 14400, displayed: false, data: [protocol: "zigbee"]) + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) log.debug "Configuring Reporting and Bindings." - def configCmds = [ - "zdo bind 0x${device.deviceNetworkId} 1 1 1 {${device.zigbeeId}} {}", "delay 500", - "zcl global send-me-a-report 1 0x20 0x20 30 21600 {01}", //checkin time 6 hrs - "send 0x${device.deviceNetworkId} 1 1", "delay 500", - - "zdo bind 0x${device.deviceNetworkId} 1 1 0x402 {${device.zigbeeId}} {}", "delay 500", - "zcl global send-me-a-report 0x402 0 0x29 30 3600 {6400}", - "send 0x${device.deviceNetworkId} 1 1", "delay 500", - + def humidityConfigCmds = [ "zdo bind 0x${device.deviceNetworkId} 1 1 0xFC45 {${device.zigbeeId}} {}", "delay 500", "zcl global send-me-a-report 0xFC45 0 0x29 30 3600 {6400}", "send 0x${device.deviceNetworkId} 1 1", "delay 500" ] - return configCmds + refresh() // send refresh cmds as part of config + + // temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity + // battery minReport 30 seconds, maxReportTime 6 hrs by default + return humidityConfigCmds + zigbee.batteryConfig() + zigbee.temperatureConfig(30, 300) + refresh() // send refresh cmds as part of config } private hex(value) { diff --git a/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy b/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy index 1326496..b977c8b 100644 --- a/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy +++ b/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy @@ -54,12 +54,6 @@ def parse(String description) { def event = zigbee.getEvent(description) if (event) { - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() if (event.name=="level" && event.value==0) {} else { sendEvent(event) @@ -86,15 +80,7 @@ def setLevel(value) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.onOffRefresh() - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.onOffRefresh() } def refresh() { @@ -103,7 +89,8 @@ def refresh() { def configure() { log.debug "Configuring Reporting and Bindings." - // Enrolls device to Device-Watch with 3 x Reporting interval 30min - sendEvent(name: "checkInterval", value: 1800, displayed: false, data: [protocol: "zigbee"]) - zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) + // OnOff minReportTime 0 seconds, maxReportTime 5 min. Reporting interval if no activity + zigbee.onOffConfig(0, 300) + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() } diff --git a/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy b/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy index e7137b6..367e480 100644 --- a/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy +++ b/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy @@ -85,12 +85,6 @@ def parse(String description) { def event = zigbee.getEvent(description) if (event) { log.debug event - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() if (event.name=="level" && event.value==0) {} else { if (event.name=="colorTemperature") { @@ -105,7 +99,7 @@ def parse(String description) { if (zigbeeMap?.clusterInt == COLOR_CONTROL_CLUSTER) { if(zigbeeMap.attrInt == ATTRIBUTE_HUE){ //Hue Attribute - def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 255 * 360) + def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 255 * 100) sendEvent(name: "hue", value: hueValue, descriptionText: "Color has changed") } else if(zigbeeMap.attrInt == ATTRIBUTE_SATURATION){ //Saturation Attribute @@ -130,15 +124,7 @@ def off() { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.onOffRefresh() - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.onOffRefresh() } def refresh() { @@ -147,9 +133,10 @@ def refresh() { def configure() { log.debug "Configuring Reporting and Bindings." - // Enrolls device to Device-Watch with 3 x Reporting interval 30min - sendEvent(name: "checkInterval", value: 1800, displayed: false, data: [protocol: "zigbee"]) - zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.colorTemperatureConfig() + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE, 0x20, 1, 3600, 0x01) + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION, 0x20, 1, 3600, 0x01) + zigbee.readAttribute(0x0006, 0x00) + zigbee.readAttribute(0x0008, 0x00) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, 0x00) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_COLOR_TEMPERATURE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) + // OnOff minReportTime 0 seconds, maxReportTime 5 min. Reporting interval if no activity + zigbee.onOffConfig(0, 300) + zigbee.levelConfig() + zigbee.colorTemperatureConfig() + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE, 0x20, 1, 3600, 0x01) + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION, 0x20, 1, 3600, 0x01) + zigbee.readAttribute(0x0006, 0x00) + zigbee.readAttribute(0x0008, 0x00) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, 0x00) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_COLOR_TEMPERATURE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) } def setColorTemperature(value) { diff --git a/devicetypes/smartthings/zigbee-white-color-temperature-bulb.src/zigbee-white-color-temperature-bulb.groovy b/devicetypes/smartthings/zigbee-white-color-temperature-bulb.src/zigbee-white-color-temperature-bulb.groovy index de8424d..5a37fab 100644 --- a/devicetypes/smartthings/zigbee-white-color-temperature-bulb.src/zigbee-white-color-temperature-bulb.groovy +++ b/devicetypes/smartthings/zigbee-white-color-temperature-bulb.src/zigbee-white-color-temperature-bulb.groovy @@ -74,12 +74,6 @@ def parse(String description) { log.debug "description is $description" def event = zigbee.getEvent(description) if (event) { - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() if (event.name=="level" && event.value==0) {} else { if (event.name=="colorTemperature") { @@ -110,15 +104,7 @@ def setLevel(value) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.onOffRefresh() - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.onOffRefresh() } def refresh() { @@ -127,9 +113,10 @@ def refresh() { def configure() { log.debug "Configuring Reporting and Bindings." - // Enrolls device to Device-Watch with 3 x Reporting interval 30min - sendEvent(name: "checkInterval", value: 1800, displayed: false, data: [protocol: "zigbee"]) - zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.colorTemperatureConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.colorTemperatureRefresh() + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) + // OnOff minReportTime 0 seconds, maxReportTime 5 min. Reporting interval if no activity + zigbee.onOffConfig(0, 300) + zigbee.levelConfig() + zigbee.colorTemperatureConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.colorTemperatureRefresh() } def setColorTemperature(value) { diff --git a/smartapps/resteele/monitor-on-sense.src/monitor-on-sense.groovy b/smartapps/resteele/monitor-on-sense.src/monitor-on-sense.groovy index d1f3c1f..b547214 100644 --- a/smartapps/resteele/monitor-on-sense.src/monitor-on-sense.groovy +++ b/smartapps/resteele/monitor-on-sense.src/monitor-on-sense.groovy @@ -17,7 +17,7 @@ definition( name: "Monitor on Sense", namespace: "resteele", author: "Rachel Steele", - description: "Turn on Monitor when vibration is sensed", + description: "Turn on switch when vibration is sensed", category: "My Apps", iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png", iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png", @@ -25,10 +25,10 @@ definition( preferences { - section("When the keyboard is used...") { + section("When vibration is sensed...") { input "accelerationSensor", "capability.accelerationSensor", title: "Which Sensor?" } -section("Turn on/off a light...") { +section("Turn on switch...") { input "switch1", "capability.switch" } } @@ -47,5 +47,3 @@ def updated() { def accelerationActiveHandler(evt) { switch1.on() } - - diff --git a/smartapps/smartthings/ecobee-connect.src/ecobee-connect.groovy b/smartapps/smartthings/ecobee-connect.src/ecobee-connect.groovy index 848b7b7..d8c2179 100644 --- a/smartapps/smartthings/ecobee-connect.src/ecobee-connect.groovy +++ b/smartapps/smartthings/ecobee-connect.src/ecobee-connect.groovy @@ -66,7 +66,7 @@ def authPage() { // get rid of next button until the user is actually auth'd if (!oauthTokenProvided) { return dynamicPage(name: "auth", title: "Login", nextPage: "", uninstall:uninstallAllowed) { - section(){ + section() { paragraph "Tap below to log in to the ecobee service and authorize SmartThings access. Be sure to scroll down on page 2 and press the 'Allow' button." href url:redirectUrl, style:"embedded", required:true, title:"ecobee", description:description } @@ -76,7 +76,7 @@ def authPage() { log.debug "thermostat list: $stats" log.debug "sensor list: ${sensorsDiscovered()}" return dynamicPage(name: "auth", title: "Select Your Thermostats", uninstall: true) { - section(""){ + section("") { paragraph "Tap below to see the list of ecobee thermostats available in your ecobee account and select the ones you want to connect to SmartThings." input(name: "thermostats", title:"", type: "enum", required:true, multiple:true, description: "Tap to choose", metadata:[values:stats]) } @@ -84,7 +84,7 @@ def authPage() { def options = sensorsDiscovered() ?: [] def numFound = options.size() ?: 0 if (numFound > 0) { - section(""){ + section("") { paragraph "Tap below to see the list of ecobee sensors available in your ecobee account and select the ones you want to connect to SmartThings." input(name: "ecobeesensors", title:"Select Ecobee Sensors (${numFound} found)", type: "enum", required:false, description: "Tap to choose", multiple:true, options:options) } @@ -115,13 +115,12 @@ def callback() { def code = params.code def oauthState = params.state - if (oauthState == atomicState.oauthInitState){ - + if (oauthState == atomicState.oauthInitState) { def tokenParams = [ - grant_type: "authorization_code", - code : code, - client_id : smartThingsClientId, - redirect_uri: callbackUrl + grant_type: "authorization_code", + code : code, + client_id : smartThingsClientId, + redirect_uri: callbackUrl ] def tokenUrl = "https://www.ecobee.com/home/token?${toQueryString(tokenParams)}" @@ -129,9 +128,6 @@ def callback() { httpPost(uri: tokenUrl) { resp -> atomicState.refreshToken = resp.data.refresh_token atomicState.authToken = resp.data.access_token - log.debug "swapped token: $resp.data" - log.debug "atomicState.refreshToken: ${atomicState.refreshToken}" - log.debug "atomicState.authToken: ${atomicState.authToken}" } if (atomicState.authToken) { @@ -148,8 +144,8 @@ def callback() { def success() { def message = """ -
Your ecobee Account is now connected to SmartThings!
-Click 'Done' to finish setup.
+Your ecobee Account is now connected to SmartThings!
+Click 'Done' to finish setup.
""" connectionStatus(message) } @@ -171,64 +167,63 @@ def connectionStatus(message, redirectUrl = null) { } def html = """ - - - - -