-
Notifications
You must be signed in to change notification settings - Fork 4
/
Device Type
285 lines (236 loc) · 14.7 KB
/
Device Type
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
/**
* Copyright 2015 SmartThings
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*
* UPDATED 17-02-17
* Parameter settings now available from DTH configuration page thanks to work of JangoBritt
*/
preferences {
input(name: "attr1", type: "enum", title: "(1)Activate/deactivate ALL ON/OFF functions", defaultValue: "255", options: [255: "ALL ON active, ALL OFF active",0:"ALL ON is not active ALL OFF is not active",1:" ALL ON is not active ALL OFF active",2:"ALL ON active ALL OFF is not active"])
input(name: "attr6", type: "enum", title: "(6)Sending commands to control devices assigned to 1-st association group", defaultValue: "0", options: [0: "commands are sent when device is turned on and off",1: "commands are sent when device is turned off. Enabling device does not send control commands. Double-clicking key sends 'turn on' command, dimmers memorize the last saved state (e.g. 50% brightness).",2: "commands are sent when device is turned off. Enabling device does not send control commands. Double-clicking key sends 'turn on' command and dimmers are set to 100% brightness."])
input title: "", description: "NOTE: Parameter 15 value must be set to 1 to work properly. This activates the double-click functionality - dimmer/roller shutter control. ", displayDuringSetup: false, type: "paragraph", element: "paragraph"
input(name: "attr7", type: "enum", title: "(7)Checking the device status before sending a control frame from key no.2", defaultValue: "1", options: [0: "Not checked",1: "Checked"])
input title: "", description: "Info: Key no. 2 is not represented by any physical device expect of devices on association list. This functionality prevents of lack of reaction on pressing key no. 2 through polling devices from association list one by one and checking thier actual states.", displayDuringSetup: false, type: "paragraph", element: "paragraph"
input(name: "attr8", type: "number", title: "(8)Percentage of a dimming step at automatic control", defaultValue: "1", range: "1..99")
input(name: "attr9", type: "number", title: "(9)Time of manually moving the Dimmer between the extreme dimming values (ms)", defaultValue: "5", range: "1..255")
input(name: "attr10", type: "number", title: "(10)Time of automatically moving the dimmer between extreme dimming values", defaultValue: "1", range: "0..255")
input title: "", description: "NOTE: value 0 is required for inductive and capacitive devices unsuitable for dimming (e.g. fluorescent lamps, motors, etc.)", displayDuringSetup: false, type: "paragraph", element: "paragraph"
input(name: "attr11", type: "number", title: "(11)percentage of a dimming step at manual control", defaultValue: "1", range: "1..99")
input(name: "attr12", type: "number", title: "(12)Maximum Dimmer level control", defaultValue: "99", range: "2..99")
input(name: "attr13", type: "number", title: "(13)Minimum Dimmer level control", defaultValue: "2", range: "1..98")
input(name: "attr14", type: "enum", title: "(14)Switch type connector", defaultValue: "0", options: [0: "mono-stable (retractive)",1: "bi-stable (toggle)"])
input(name: "attr15", type: "enum", title: "(15)Double click option (set lighting at 100%)", defaultValue: "1", options: [0: "Disabled",1: "Enabled"])
input(name: "attr16", type: "enum", title: "(16)Save Dimmer state after power failure", defaultValue: "1", options: [0:"Disabled (returns to Off)",1: "Enabled (returns to last state)"])
input(name: "attr17", type: "enum", title: "(17)Function of 3-way switch", defaultValue: "0", options: [0: "Disabled",1: "Enabled"])
input title: "", description: "provides the option to double key no. 1. The Dimmer may control two bi-stable push-buttons or an infinite number of mono-stable push-buttons. default value 0", displayDuringSetup: false, type: "paragraph", element: "paragraph"
input(name: "attr18", type: "enum", title: "(18)Synchronize Light level for associated devices", defaultValue: "0", options: [0: "Disabled",1: "Enabled"])
input(name: "attr19", type: "enum", title: "(19)Bi-Stable key function", defaultValue: "0", options: [0:"Toggle",1: "ON is ON, OFF is OFF"])
input title: "ADVANCED FUNCTION", displayDuringSetup: false, type: "paragraph", element: "paragraph"
input(name: "attr20", type: "number", title: "(20)Impulse Length", defaultValue: "110", range: "100..170")
input title: "", description: "default value 101 for 60Hz or 110 for 50Hz", displayDuringSetup: false, type: "paragraph", element: "paragraph"
input title: "", description: "This function will enable decreasing the minimum level of the Dimmer by extending the control impulse. By changing the minimum level, the user may completely dim LED bulbs. Not all LED bulbs available on the market have the dimming option.", displayDuringSetup: false, type: "paragraph", element: "paragraph"
input title: "WARNING!", displayDuringSetup: false, type: "paragraph", element: "paragraph"
input title: "", description: "Wrong setting of the function may cause incorrect operation of the Dimmer.", displayDuringSetup: false, type: "paragraph", element: "paragraph"
}
metadata {
definition (name: "Fibaro Dimmer 211 params UK", namespace: "inpier", author: "inpier") {
capability "Actuator"
capability "Switch"
capability "Polling"
capability "Refresh"
capability "Sensor"
capability "Configuration"
capability "Switch Level"
//command "reset"
command "configure"
fingerprint deviceId: "0x1101", inClusters: "0x72, 0x86, 0x70, 0x85, 0x8E, 0x26, 0x7A, 0x27, 0x73, 0xEF, 0x26, 0x2B"
}
// simulator metadata
simulator {
status "on": "command: 2003, payload: FF"
status "off": "command: 2003, payload: 00"
status "09%": "command: 2003, payload: 09"
status "10%": "command: 2003, payload: 0A"
status "33%": "command: 2003, payload: 21"
status "66%": "command: 2003, payload: 42"
status "99%": "command: 2003, payload: 63"
/*
for (int i = 0; i <= 10000; i += 1000) {
status "power ${i} W": new physicalgraph.zwave.Zwave().meterV3.meterReport(
scaledMeterValue: i, precision: 3, meterType: 4, scale: 2, size: 4).incomingMessage()
}
for (int i = 0; i <= 100; i += 10) {
status "energy ${i} kWh": new physicalgraph.zwave.Zwave().meterV3.meterReport(
scaledMeterValue: i, precision: 3, meterType: 0, scale: 0, size: 4).incomingMessage()
}
["FF", "00", "09", "0A", "21", "42", "63"].each { val ->
reply "2001$val,delay 100,2602": "command: 2603, payload: $val"
}
*/
}
// tile definitions
tiles(scale: 2) {
multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
attributeState "on", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#79b821", nextState:"turningOff"
attributeState "off", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#79b821", nextState:"turningOff"
attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
}
tileAttribute ("device.level", key: "SLIDER_CONTROL") {
attributeState "level", action:"switch level.setLevel"
}
}
standardTile("configure", "device.configure", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state "configure", label:'', action:"configure", icon:"st.secondary.configure"
}
main(["switch"])
details(["switch","configure"])
}
}
def updated() {
return response([
delayBetween([
zwave.configurationV1.configurationSet(configurationValue: [attr1], parameterNumber: 1, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr6], parameterNumber: 6, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr7], parameterNumber: 7, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr8], parameterNumber: 8, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr9], parameterNumber: 9, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr10], parameterNumber: 10, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr11], parameterNumber: 11, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr12], parameterNumber: 12, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr13], parameterNumber: 13, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr14], parameterNumber: 14, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr15], parameterNumber: 15, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr16], parameterNumber: 16, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr17], parameterNumber: 17, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr18], parameterNumber: 18, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr19], parameterNumber: 19, size: 1).format(),
zwave.configurationV1.configurationSet(configurationValue: [attr20], parameterNumber: 20, size: 1).format()
], 1000)
])
}
def parse(String description) {
//log.trace(description)
def result = null
if (description != "updated") {
def cmd = zwave.parse(description, [0x72: 1, 0x86: 1, 0x70: 1, 0x85: 1, 0x8E: 1, 0x26: 1, 0x7A: 1, 0x27: 1, 0x73: 1, 0xEF: 1, 0x26: 1, 0x2B: 1])
if (cmd) {
result = zwaveEvent(cmd)
}
}
//log.debug "Parsed '${description}' to ${result.inspect()}"
return result
}
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
log.trace(cmd)
dimmerEvents(cmd)
}
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd) {
log.trace(cmd)
dimmerEvents(cmd)
}
def zwaveEvent(physicalgraph.zwave.commands.switchmultilevelv1.SwitchMultilevelReport cmd) {
log.trace(cmd)
dimmerEvents(cmd)
}
def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd)
{
log.trace(cmd)
dimmerEvents(cmd)
}
def dimmerEvents(physicalgraph.zwave.Command cmd) {
log.trace(cmd)
def result = []
def value = (cmd.value ? "on" : "off")
def switchEvent = createEvent(name: "switch", value: value, descriptionText: "$device.displayName was turned $value")
result << switchEvent
if (cmd.value) {
result << createEvent(name: "level", value: cmd.value, unit: "%")
}
if (switchEvent.isStateChange) {
result << response(["delay 3000", zwave.meterV2.meterGet(scale: 2).format()])
}
return result
}
def zwaveEvent(physicalgraph.zwave.Command cmd) {
log.trace(cmd)
log.debug "No handler for $cmd"
// Handles all Z-Wave commands we aren't interested in
createEvent(descriptionText: cmd.toString(), isStateChange: false)
}
def zwaveEvent(physicalgraph.zwave.commands.configurationv1.ConfigurationReport cmd) {
def result = []
log.debug "${device.displayName} parameter '${cmd.parameterNumber}' with a byte size of '${cmd.size}' is set to '${cmd.configurationValue}'"
result
}
def createEvent(physicalgraph.zwave.Command cmd, Map map) {
// Handles any Z-Wave commands we aren't interested in
log.debug "UNHANDLED COMMAND $cmd"
}
def on() {
log.info "on"
delayBetween([zwave.basicV1.basicSet(value: 0xFF).format(), zwave.switchMultilevelV1.switchMultilevelGet().format()], 5000)
}
def off() {
log.info "off"
delayBetween ([zwave.basicV1.basicSet(value: 0x00).format(), zwave.switchMultilevelV1.switchMultilevelGet().format()], 5000)
}
/*
def poll() {
zwave.switchBinaryV1.switchBinaryGet().format()
}
def refresh() {
delayBetween([
zwave.switchBinaryV1.switchBinaryGet().format(),
zwave.manufacturerSpecificV1.manufacturerSpecificGet().format()
])
}
def reset() {
log.trace("reset")
return secureSequence([
zwave.switchMultilevelV1.switchMultilevelGet(),
])
}
*/
def setLevel(value) {
def valueaux = value as Integer
def level = Math.min(valueaux, 99)
delayBetween ([zwave.basicV1.basicSet(value: level).format(), zwave.switchMultilevelV1.switchMultilevelGet().format()], 5000)
}
def listCurrentParams() {
log.debug "Listing of current parameter settings of ${device.displayName}"
def cmds = []
cmds << zwave.configurationV1.configurationGet(parameterNumber: 1).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 6).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 7).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 8).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 9).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 10).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 11).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 12).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 13).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 14).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 15).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 16).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 17).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 18).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 19).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 20).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 30).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 39).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 40).format()
cmds << zwave.configurationV1.configurationGet(parameterNumber: 41).format()
delayBetween(cmds, 700)
}
def configure() {
log.debug "Reading Device Parameters of ${device.displayName}..."
listCurrentParams();
}