mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-24 05:04:10 +00:00
Merge pull request #246 from tpmanley/feature/lock-battery-fix
Fix 'Low Battery Handler' exception caused by non-integer battery events
This commit is contained in:
@@ -139,8 +139,7 @@ private Map parseReportAttributeMessage(String description) {
|
|||||||
Map resultMap = [:]
|
Map resultMap = [:]
|
||||||
if (descMap.clusterInt == CLUSTER_POWER && descMap.attrInt == POWER_ATTR_BATTERY_PERCENTAGE_REMAINING) {
|
if (descMap.clusterInt == CLUSTER_POWER && descMap.attrInt == POWER_ATTR_BATTERY_PERCENTAGE_REMAINING) {
|
||||||
resultMap.name = "battery"
|
resultMap.name = "battery"
|
||||||
// BatteryPercentageRemaining is specified in .5% increments
|
resultMap.value = Math.round(Integer.parseInt(descMap.value, 16) / 2)
|
||||||
resultMap.value = Integer.parseInt(descMap.value, 16) / 2
|
|
||||||
log.info "parseReportAttributeMessage() --- battery: ${resultMap.value}"
|
log.info "parseReportAttributeMessage() --- battery: ${resultMap.value}"
|
||||||
}
|
}
|
||||||
else if (descMap.clusterInt == CLUSTER_DOORLOCK && descMap.attrInt == DOORLOCK_ATTR_LOCKSTATE) {
|
else if (descMap.clusterInt == CLUSTER_DOORLOCK && descMap.attrInt == DOORLOCK_ATTR_LOCKSTATE) {
|
||||||
|
|||||||
Reference in New Issue
Block a user