Skip to content

Commit

Permalink
Merge pull request SmartThingsCommunity#39021 from SmartThingsCommuni…
Browse files Browse the repository at this point in the history
…ty/production

Rolling down production commits to acceptance
  • Loading branch information
greens authored Jul 30, 2020
2 parents d636b2f + ec0d756 commit e22ecd6
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,7 @@ private Map getTemperatureResult(value) {
def linkText = getLinkText(device)

if (tempOffset) {
def offset = tempOffset as int
def v = value as int
value = v + offset
value = new BigDecimal((value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
def descriptionText = "${linkText} is ${value}°${temperatureScale}"
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def parse(String description) {
} else if (map.name == "temperature") {
freezeStatus(map.value)
if (tempOffset) {
map.value = map.value + tempOffset
map.value = new BigDecimal((map.value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
map.descriptionText = temperatureScale == 'C' ? "${device.displayName} was ${map.value}°C" : "${device.displayName} was ${map.value}°F"
map.translatable = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def parse(String description) {
}
} else if (map.name == "temperature") {
if (tempOffset) {
map.value = map.value + tempOffset
map.value = new BigDecimal((map.value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
map.descriptionText = temperatureScale == 'C' ? '{{ device.displayName }} was {{ value }}°C' : '{{ device.displayName }} was {{ value }}°F'
map.translatable = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def parse(String description) {
map = parseAttrMessage(description)
} else if (map.name == "temperature") {
if (tempOffset) {
map.value = map.value + tempOffset
map.value = new BigDecimal((map.value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
map.descriptionText = temperatureScale == 'C' ? "${device.displayName} was ${map.value}°C" : "${device.displayName} was ${map.value}°F"
map.translatable = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def parse(String description) {
}
} else if (map.name == "temperature") {
if (tempOffset) {
map.value = map.value + tempOffset
map.value = new BigDecimal((map.value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
map.unit = getTemperatureScale()
}
map.descriptionText = getTemperatureScale() == 'C' ? "${ device.displayName } was ${ map.value }°C" : "${ device.displayName } was ${ map.value }°F"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,7 @@ private getTempResult(part, description) {
def temperatureScale = getTemperatureScale()
def value = zigbee.parseSmartThingsTemperatureValue(part, "temp: ", temperatureScale)
if (tempOffset) {
def offset = tempOffset as int
def v = value as int
value = v + offset
value = new BigDecimal((value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
def linkText = getLinkText(device)
def descriptionText = "$linkText was $value°$temperatureScale"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,7 @@ private getTempResult(part, description) {
def temperatureScale = getTemperatureScale()
def value = zigbee.parseSmartThingsTemperatureValue(part, "temp: ", temperatureScale)
if (tempOffset) {
def offset = tempOffset as int
def v = value as int
value = v + offset
value = new BigDecimal((value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
def linkText = getLinkText(device)
def descriptionText = "$linkText was $value°$temperatureScale"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def parse(String description) {
}
} else if (map.name == "temperature") {
if (tempOffset) {
map.value = map.value + tempOffset
map.value = new BigDecimal((map.value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
map.descriptionText = temperatureScale == 'C' ? '{{ device.displayName }} was {{ value }}°C' : '{{ device.displayName }} was {{ value }}°F'
map.translatable = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def parse(String description) {
}
} else if (map.name == "temperature") {
if (tempOffset) {
map.value = map.value + tempOffset
map.value = new BigDecimal((map.value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
map.descriptionText = temperatureScale == 'C' ? '{{ device.displayName }} was {{ value }}°C' : '{{ device.displayName }} was {{ value }}°F'
map.translatable = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def parse(String description) {
} else if (maps[0].name == "temperature") {
def map = maps[0]
if (tempOffset) {
map.value = map.value + tempOffset
map.value = new BigDecimal((map.value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
map.descriptionText = temperatureScale == 'C' ? '{{ device.displayName }} was {{ value }}°C' : '{{ device.displayName }} was {{ value }}°F'
map.translatable = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,7 @@ private Map getTempResult(part, description) {
def temperatureScale = getTemperatureScale()
def value = zigbee.parseSmartThingsTemperatureValue(part, "temp: ", temperatureScale)
if (tempOffset) {
def offset = tempOffset as int
def v = value as int
value = v + offset
value = new BigDecimal((value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
def linkText = getLinkText(device)
def descriptionText = "$linkText was $value°$temperatureScale"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def parse(String description) {
}
} else if (map.name == "temperature") {
if (tempOffset) {
map.value = map.value + tempOffset
map.value = new BigDecimal((map.value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
map.descriptionText = temperatureScale == 'C' ? '{{ device.displayName }} was {{ value }}°C' : '{{ device.displayName }} was {{ value }}°F'
map.translatable = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def parse(String description) {
}
} else if (map.name == "temperature") {
if (tempOffset) {
map.value = map.value + tempOffset
map.value = new BigDecimal((map.value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
map.descriptionText = temperatureScale == 'C' ? '{{ device.displayName }} was {{ value }}°C' : '{{ device.displayName }} was {{ value }}°F'
map.translatable = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,7 @@ private getTempResult(part, description) {
def temperatureScale = getTemperatureScale()
def value = zigbee.parseSmartThingsTemperatureValue(part, "temp: ", temperatureScale)
if (tempOffset) {
def offset = tempOffset as int
def v = value as int
value = v + offset
value = new BigDecimal((value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
def linkText = getLinkText(device)
def descriptionText = "$linkText was $value°$temperatureScale"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,7 @@ private Map getTemperatureResult(value) {
log.debug 'TEMP'
def linkText = getLinkText(device)
if (tempOffset) {
def offset = tempOffset as int
def v = value as int
value = v + offset
value = new BigDecimal((value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
def descriptionText = "${linkText} was ${value}°${temperatureScale}"
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def parse(String description) {
}
} else if (map.name == "temperature") {
if (tempOffset) {
map.value = map.value + tempOffset
map.value = new BigDecimal((map.value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
map.descriptionText = temperatureScale == 'C' ? "${device.displayName} temperature was ${map.value}°C" : "${device.displayName} temperature was ${map.value}°F"
map.translatable = true
Expand Down Expand Up @@ -250,4 +250,4 @@ def configure() {
zigbee.configureReporting(zigbee.RELATIVE_HUMIDITY_CLUSTER, 0x0000, DataType.UINT16, 30, 3600, 100)

return refresh() + configCmds
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def parse(String description) {
}
} else if (map.name == "temperature") {
if (tempOffset) {
map.value = map.value + tempOffset
map.value = new BigDecimal((map.value as float) + (tempOffset as float)).setScale(1, BigDecimal.ROUND_HALF_UP)
}
map.descriptionText = temperatureScale == 'C' ? "${device.displayName} was ${map.value}°C" : "${device.displayName} was ${map.value}°F"
map.translatable = true
Expand Down Expand Up @@ -184,4 +184,4 @@ def configure() {

private boolean isZoneMessage(description) {
return (description?.startsWith('zone status') || description?.startsWith('zone report'))
}
}

0 comments on commit e22ecd6

Please sign in to comment.