Skip to content

Commit 3f8abbe

Browse files
ALamchaSgreens
authored andcommitted
[DEVC-597] Add fingerprint for Bosh Radion ZigBee Motion Detector RFDL-ZB-MS to generic Smart Sense Motion Detector DTH. (SmartThingsCommunity#2964)
[DEVC-597] Add fingerprint for Bosh Radion ZigBee Motion Detector RFDL-ZB-MS to generic Smart Sense Motion Detector DTH. Added battery report implementation for Bosch devices.
1 parent bb6e2a2 commit 3f8abbe

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

devicetypes/smartthings/smartsense-motion-sensor.src/smartsense-motion-sensor.groovy

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ metadata {
3737
fingerprint inClusters: "0000,0001,0003,0020,0402,0500,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3328-G", deviceJoinName: "Centralite Micro Motion Sensor"
3838
fingerprint inClusters: "0000,0001,0003,000F,0020,0402,0500", outClusters: "0019", manufacturer: "SmartThings", model: "motionv4", deviceJoinName: "Motion Sensor"
3939
fingerprint inClusters: "0000,0001,0003,000F,0020,0402,0500", outClusters: "0019", manufacturer: "SmartThings", model: "motionv5", deviceJoinName: "Motion Sensor"
40+
fingerprint inClusters: "0000,0001,0003,000F,0020,0402,0500", outClusters: "0019", manufacturer: "Bosch", model: "RFDL-ZB-MS", deviceJoinName: "Bosch Motion Sensor"
4041
}
4142

4243
simulator {
@@ -174,7 +175,13 @@ private Map getBatteryResult(rawValue) {
174175
volts = maxVolts
175176
def pct = batteryMap[volts]
176177
result.value = pct
177-
} else {
178+
} else if (device.getDataValue("manufacturer") == "Bosch") {
179+
def minValue = 21
180+
def maxValue = 30
181+
def pct = Math.round((rawValue - minValue) * 100 / (maxValue - minValue))
182+
pct = pct > 0 ? pct : 1
183+
result.value = Math.min(100, pct)
184+
} else { // Centralite
178185
def useOldBatt = shouldUseOldBatteryReporting()
179186
def minVolts = useOldBatt ? 2.1 : 2.4
180187
def maxVolts = useOldBatt ? 3.0 : 2.7
@@ -189,7 +196,7 @@ private Map getBatteryResult(rawValue) {
189196
// OR we don't currently have a battery reading
190197
// OR the value we just received is at least 2 steps off from the last reported value
191198
// OR the device's firmware is older than 1.15.7
192-
if(useOldBatt || state?.lastVolts == null || state?.lastVolts == volts || device.currentState("battery")?.value == null || Math.abs(curValVolts - volts) > 0.1) {
199+
if (useOldBatt || state?.lastVolts == null || state?.lastVolts == volts || device.currentState("battery")?.value == null || Math.abs(curValVolts - volts) > 0.1) {
193200
def pct = (volts - minVolts) / (maxVolts - minVolts)
194201
def roundedPct = Math.round(pct * 100)
195202
if (roundedPct <= 0)

0 commit comments

Comments
 (0)