Skip to content

Commit 92c0006

Browse files
ALamchaSgreens
authored andcommitted
[DEVC-588] Add support for Dome Z-Wave Siren DMS01 to generic Z-wave Siren DTH. (SmartThingsCommunity#2897)
* [DEVC-588] Initial commit - formatting. * [DEVC-588] Add support for Dome Z-Wave Siren DMS01 to generic Z-wave Siren DTH.
1 parent e81308f commit 92c0006

File tree

1 file changed

+45
-28
lines changed

1 file changed

+45
-28
lines changed

devicetypes/smartthings/zwave-siren.src/zwave-siren.groovy

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@
1616
* Date: 2014-07-15
1717
*/
1818
metadata {
19-
definition (name: "Z-Wave Siren", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.sensor.smoke", runLocally: true, minHubCoreVersion: '000.017.0012', executeCommandsLocally: false) {
19+
definition(name: "Z-Wave Siren", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.sensor.smoke", runLocally: true, minHubCoreVersion: '000.017.0012', executeCommandsLocally: false) {
2020
capability "Actuator"
21-
capability "Alarm"
22-
capability "Battery"
23-
capability "Polling"
24-
capability "Refresh"
25-
capability "Sensor"
21+
capability "Alarm"
22+
capability "Battery"
23+
capability "Polling"
24+
capability "Refresh"
25+
capability "Sensor"
2626
capability "Switch"
27-
27+
capability "Health Check"
2828

2929
fingerprint inClusters: "0x20,0x25,0x86,0x80,0x85,0x72,0x71"
30+
fingerprint mfr: "021F", prod: "0003", model: "0088", deviceJoinName: "Dome Siren"
3031
}
3132

3233
simulator {
@@ -40,26 +41,36 @@ metadata {
4041

4142
tiles {
4243
standardTile("alarm", "device.alarm", width: 2, height: 2) {
43-
state "off", label:'off', action:'alarm.strobe', icon:"st.alarm.alarm.alarm", backgroundColor:"#ffffff"
44-
state "both", label:'alarm!', action:'alarm.off', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13"
44+
state "off", label: 'off', action: 'alarm.strobe', icon: "st.alarm.alarm.alarm", backgroundColor: "#ffffff"
45+
state "both", label: 'alarm!', action: 'alarm.off', icon: "st.alarm.alarm.alarm", backgroundColor: "#e86d13"
4546
}
4647
standardTile("off", "device.alarm", inactiveLabel: false, decoration: "flat") {
47-
state "default", label:'', action:"alarm.off", icon:"st.secondary.off"
48+
state "default", label: '', action: "alarm.off", icon: "st.secondary.off"
4849
}
49-
valueTile("battery", "device.battery", inactiveLabel: false, decoration: "flat") {
50-
state "battery", label:'${currentValue}% battery', unit:""
50+
valueTile("battery", "device.battery", inactiveLabel: false, decoration: "flat") {
51+
state "battery", label: '${currentValue}% battery', unit: ""
5152
}
52-
standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat") {
53-
state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
53+
standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat") {
54+
state "default", label: '', action: "refresh.refresh", icon: "st.secondary.refresh"
5455
}
55-
56+
5657
main "alarm"
57-
details(["alarm","off","battery","refresh"])
58+
details(["alarm", "off", "battery", "refresh"])
5859
}
5960
}
6061

62+
def installed() {
63+
// Device-Watch simply pings if no device events received for 122min(checkInterval)
64+
sendEvent(name: "checkInterval", value: 0 * 60 * 60 + 17 * 60, isStateChanged: true, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
65+
}
66+
67+
def updated() {
68+
// Device-Watch simply pings if no device events received for 122min(checkInterval)
69+
sendEvent(name: "checkInterval", value: 0 * 60 * 60 + 17 * 60, isStateChanged: true, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
70+
}
71+
6172
def createEvents(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
62-
def map = [ name: "battery", unit: "%" ]
73+
def map = [name: "battery", unit: "%"]
6374
if (cmd.batteryLevel == 0xFF) {
6475
map.value = 1
6576
map.descriptionText = "$device.displayName has a low battery"
@@ -71,7 +82,7 @@ def createEvents(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
7182
}
7283

7384
def poll() {
74-
if (secondsPast(state.lastbatt, 36*60*60)) {
85+
if (secondsPast(state.lastbatt, 36 * 60 * 60)) {
7586
return zwave.batteryV1.batteryGet().format()
7687
} else {
7788
return null
@@ -119,9 +130,20 @@ def both() {
119130
on()
120131
}
121132

133+
/**
134+
* PING is used by Device-Watch in attempt to reach the Device
135+
* */
136+
def ping() {
137+
log.debug "ping() called"
138+
refresh()
139+
}
140+
122141
def refresh() {
123142
log.debug "sending battery refresh command"
124-
zwave.batteryV1.batteryGet().format()
143+
[
144+
zwave.basicV1.basicGet().format(),
145+
zwave.batteryV1.batteryGet().format()
146+
]
125147
}
126148

127149
def parse(String description) {
@@ -135,20 +157,16 @@ def parse(String description) {
135157
return result
136158
}
137159

138-
def createEvents(physicalgraph.zwave.commands.basicv1.BasicReport cmd)
139-
{
160+
def createEvents(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
140161
def switchValue = cmd.value ? "on" : "off"
141162
def alarmValue
142163
if (cmd.value == 0) {
143164
alarmValue = "off"
144-
}
145-
else if (cmd.value <= 33) {
165+
} else if (cmd.value <= 33) {
146166
alarmValue = "strobe"
147-
}
148-
else if (cmd.value <= 66) {
167+
} else if (cmd.value <= 66) {
149168
alarmValue = "siren"
150-
}
151-
else {
169+
} else {
152170
alarmValue = "both"
153171
}
154172
[
@@ -157,7 +175,6 @@ def createEvents(physicalgraph.zwave.commands.basicv1.BasicReport cmd)
157175
]
158176
}
159177

160-
161178
def createEvents(physicalgraph.zwave.Command cmd) {
162179
log.warn "UNEXPECTED COMMAND: $cmd"
163180
}

0 commit comments

Comments
 (0)