From 2d060bddfc31ec7da0a1e22a2f46c3b58e5c978c Mon Sep 17 00:00:00 2001 From: Vinay Rao Date: Tue, 1 Mar 2016 12:17:50 -0800 Subject: [PATCH] fixing issue with weird battery values --- .../smartsense-motion-temp-sensor.groovy | 2 +- .../smartsense-open-closed-accelerometer-sensor.groovy | 3 ++- .../smartsense-open-closed-sensor.groovy | 3 ++- .../smartsense-temp-humidity-sensor.groovy | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/devicetypes/smartthings/smartsense-motion-temp-sensor.src/smartsense-motion-temp-sensor.groovy b/devicetypes/smartthings/smartsense-motion-temp-sensor.src/smartsense-motion-temp-sensor.groovy index 1742821..4d2cddb 100644 --- a/devicetypes/smartthings/smartsense-motion-temp-sensor.src/smartsense-motion-temp-sensor.groovy +++ b/devicetypes/smartthings/smartsense-motion-temp-sensor.src/smartsense-motion-temp-sensor.groovy @@ -233,7 +233,7 @@ private Map getBatteryResult(rawValue) { def volts = rawValue / 10 def descriptionText - if (rawValue == 0) {} + if (rawValue == 0 || rawValue == 255) {} else { if (volts > 3.5) { result.descriptionText = "${linkText} battery has too much power (${volts} volts)." diff --git a/devicetypes/smartthings/smartsense-open-closed-accelerometer-sensor.src/smartsense-open-closed-accelerometer-sensor.groovy b/devicetypes/smartthings/smartsense-open-closed-accelerometer-sensor.src/smartsense-open-closed-accelerometer-sensor.groovy index 45dafe2..d9dcc26 100644 --- a/devicetypes/smartthings/smartsense-open-closed-accelerometer-sensor.src/smartsense-open-closed-accelerometer-sensor.groovy +++ b/devicetypes/smartthings/smartsense-open-closed-accelerometer-sensor.src/smartsense-open-closed-accelerometer-sensor.groovy @@ -225,7 +225,8 @@ def getTemperature(value) { def volts = rawValue / 10 def descriptionText - if (volts > 3.5) { + if (rawValue == 0 || rawValue == 255) {} + else if (volts > 3.5) { result.descriptionText = "${linkText} battery has too much power (${volts} volts)." } else { 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 8de222d..e879148 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 @@ -220,7 +220,8 @@ private Map getBatteryResult(rawValue) { def volts = rawValue / 10 def descriptionText - if (volts > 3.5) { + if (rawValue == 0 || rawValue == 255) {} + else if (volts > 3.5) { result.descriptionText = "${linkText} battery has too much power (${volts} volts)." } else { 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 26d0646..146df12 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 @@ -196,7 +196,8 @@ private Map getBatteryResult(rawValue) { def volts = rawValue / 10 def descriptionText - if (volts > 3.5) { + if (rawValue == 0 || rawValue == 255) {} + else if (volts > 3.5) { result.descriptionText = "${linkText} battery has too much power (${volts} volts)." } else {