Skip to content

Commit 454898d

Browse files
authored
Merge pull request #78286 from SmartThingsCommunity/master
Rolling up master to staging
2 parents f5663ad + a81d68d commit 454898d

File tree

3 files changed

+20
-40
lines changed

3 files changed

+20
-40
lines changed

devicetypes/shinasys/sihas-multipurpose-sensor.src/sihas-multipurpose-sensor.groovy

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -147,31 +147,13 @@ private Map getBatteryResult(rawValue) {
147147
def maxVolts = 3.2
148148

149149
if (isDSM300()) maxVolts = 3.1
150-
151-
// Get the current battery percentage as a multiplier 0 - 1
152-
def curValVolts = Integer.parseInt(device.currentState("battery")?.value ?: "100") / 100.0
153-
// Find the corresponding voltage from our range
154-
curValVolts = curValVolts * (maxVolts - minVolts) + minVolts
155-
// Round to the nearest 10th of a volt
156-
curValVolts = Math.round(10 * curValVolts) / 10.0
157-
158-
// Only update the battery reading if we don't have a last reading,
159-
// OR we have received the same reading twice in a row
160-
// OR we don't currently have a battery reading
161-
// OR the value we just received is at least 2 steps off from the last reported value
162-
if (state?.lastVolts == null || state?.lastVolts == volts || device.currentState("battery")?.value == null || Math.abs(curValVolts - volts) > 0.1) {
163-
def pct = (volts - minVolts) / (maxVolts - minVolts)
164-
def roundedPct = Math.round(pct * 100)
165-
if (roundedPct <= 0)
166-
roundedPct = 1
167-
result.value = Math.min(100, roundedPct)
168-
} else {
169-
// Don't update as we want to smooth the battery values, but do report the last battery state for record keeping purposes
170-
result.value = device.currentState("battery").value
171-
}
172-
173-
result.descriptionText = "${device.displayName} battery was ${result.value}%"
174-
state.lastVolts = volts
150+
151+
def pct = (volts - minVolts) / (maxVolts - minVolts)
152+
def roundedPct = Math.round(pct * 100)
153+
if (roundedPct <= 0)
154+
roundedPct = 1
155+
result.value = Math.min(100, roundedPct)
156+
result.descriptionText = "${device.displayName} battery was ${result.value}%"
175157
}
176158
return result
177159
}
@@ -254,7 +236,6 @@ def refresh() {
254236
}
255237

256238
if (isDSM300()) {
257-
refreshCmds += zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, POWER_CONFIGURATION_BATTERY_VOLTAGE_ATTRIBUTE)
258239
refreshCmds += zigbee.readAttribute(zigbee.IAS_ZONE_CLUSTER, zigbee.ATTRIBUTE_IAS_ZONE_STATUS)
259240
refreshCmds += zigbee.enrollResponse()
260241
}
@@ -325,4 +306,4 @@ private Boolean isDSM300() {
325306

326307
private Boolean isCSM300() {
327308
device.getDataValue("model") == "CSM-300Z"
328-
}
309+
}

devicetypes/smartthings/zigbee-multi-button.src/zigbee-multi-button.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ def getBatteryPercentageResult(rawValue) {
157157
def minVolts = 2.1
158158
def maxVolts = 3.0
159159
def pct = (volts - minVolts) / (maxVolts - minVolts)
160+
if(pct <= 0) {
161+
pct = 0.01
162+
}
160163
result.value = Math.min(100, (int)(pct * 100))
161164
def linkText = getLinkText(device)
162165
result.descriptionText = "${linkText} battery was ${result.value}%"

devicetypes/smartthings/zigbee-window-shade.src/zigbee-window-shade.groovy

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ metadata {
2727
capability "Switch Level"
2828

2929
command "pause"
30-
30+
3131
// NodOn
32-
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0102", outClusters: "0019", manufacturer: "NodOn", model: "SIN-4-RS-20", deviceJoinName: "NodOn Window Treatment"
32+
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0102", outClusters: "0019", manufacturer: "NodOn", model: "SIN-4-RS-20", deviceJoinName: "NodOn Window Treatment"
3333
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0102", outClusters: "0019", manufacturer: "NodOn", model: "SIN-4-RS-20_PRO", deviceJoinName: "NodOn Window Treatment"
34-
34+
3535
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0102", outClusters: "0019", model: "E2B0-KR000Z0-HA", deviceJoinName: "eZEX Window Treatment" // SY-IoT201-BD //SOMFY Blind Controller/eZEX
3636
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0102", outClusters: "000A", manufacturer: "Feibit Co.Ltd", model: "FTB56-ZT218AK1.6", deviceJoinName: "Wistar Window Treatment" //Wistar Curtain Motor(CMJ)
3737
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0102", outClusters: "000A", manufacturer: "Feibit Co.Ltd", model: "FTB56-ZT218AK1.8", deviceJoinName: "Wistar Window Treatment" //Wistar Curtain Motor(CMJ)
@@ -149,10 +149,10 @@ def levelEventHandler(currentLevel) {
149149
sendEvent(name: "level", value: currentLevel, unit: "%", displayed: false)
150150

151151
if (currentLevel == 0 || currentLevel == 100) {
152-
if (device.getDataValue("manufacturer") == "Third Reality, Inc"){
153-
sendEvent(name: "windowShade", value: currentLevel == 0 ? "open" : "closed")
152+
if (device.getDataValue("manufacturer") == "Third Reality, Inc"){
153+
sendEvent(name: "windowShade", value: currentLevel == 0 ? "open" : "closed")
154154
} else {
155-
sendEvent(name: "windowShade", value: currentLevel == 0 ? "closed" : "open")
155+
sendEvent(name: "windowShade", value: currentLevel == 0 ? "closed" : "open")
156156
}
157157
} else {
158158
if (priorLevel < currentLevel) {
@@ -222,14 +222,10 @@ def pause() {
222222
log.info "pause()"
223223
def currentShadeStatus = device.currentValue("windowShade")
224224

225-
if (device.getDataValue("manufacturer") == "Third Reality, Inc") {
226-
zigbee.command(CLUSTER_WINDOW_COVERING, COMMAND_PAUSE)
225+
if (isSomfy() && (currentShadeStatus == "open" || currentShadeStatus == "closed")) {
226+
sendEvent(name: "windowShade", value: currentShadeStatus)
227227
} else {
228-
if (currentShadeStatus == "open" || currentShadeStatus == "closed") {
229-
sendEvent(name: "windowShade", value: currentShadeStatus)
230-
} else {
231-
zigbee.command(CLUSTER_WINDOW_COVERING, COMMAND_PAUSE)
232-
}
228+
zigbee.command(CLUSTER_WINDOW_COVERING, COMMAND_PAUSE)
233229
}
234230
}
235231

0 commit comments

Comments
 (0)