22/**
33 * domoticzBlinds
44 *
5- * Copyright 2018 Martin Verbeek
5+ * Copyright 2019 Martin Verbeek
66 *
77 * 4.0 2018-02-12 Add windowShade capability, fix eodDone
88 * 4.1 2018-04-05 Introduce configure for all non standard attributes and commands
99 * 4.2 2018-06-02 Moved EOD processing to SM
1010 * 4.3 2018-06-21 Removed calibrate, moved it to timed session capability
11+ * 4.4 2019-03-16 presetPosition gone as a command for windowshades???? named it in commands
1112 */
1213import groovy.time.TimeCategory
1314import groovy.time.TimeDuration
@@ -16,7 +17,7 @@ preferences {
1617 input(name :" stopSupported" , type :" bool" , title : " Stop command supported?" , description :" Does your blind use the STOP command to halt the blind. NOT to be confused with the Somfy Stop/My command!" , defaultValue :false )
1718}
1819metadata {
19- definition (name : " domoticzBlinds" , namespace : " verbem" , author : " Martin Verbeek" , vid : " generic-shade" , ocfdevicetype : " oic.d.blind " ) {
20+ definition (name : " domoticzBlinds" , namespace : " verbem" , author : " Martin Verbeek" , vid : " generic-shade" ) {
2021
2122 capability " Actuator"
2223 capability " Switch"
@@ -28,6 +29,8 @@ metadata {
2829 capability " Window Shade"
2930 capability " Configuration"
3031 capability " Timed Session"
32+
33+ command " presetPosition"
3134
3235 }
3336
@@ -46,17 +49,15 @@ metadata {
4649 }
4750 }
4851
49- standardTile(" Up" , " device.switch " , width : 2 , height : 2 , inactiveLabel :false , decoration :" flat" ) {
52+ standardTile(" Up" , " device.windowShade " , width : 2 , height : 2 , inactiveLabel :false , decoration :" flat" ) {
5053 state " default" , label :' Up' , icon :" st.doors.garage.garage-opening" ,
5154 action :" open"
5255 }
5356
54- standardTile(" Preset" , " device.switch" , width : 2 , height : 2 , inactiveLabel :false , decoration :" flat" ) {
55- state " default" , label :' Preset' , icon :" st.doors.garage.garage-open" ,
56- action :" presetPosition"
57- }
57+ standardTile(" PP" , " device.windowShade" , width : 2 , height : 2 , inactiveLabel :false , decoration :" flat" ) {
58+ state " default" , label :' Preset' , icon :" st.doors.garage.garage-open" , action : " presetPosition" }
5859
59- standardTile(" Down" , " device.switch " , width : 2 , height : 2 , inactiveLabel :false , decoration :" flat" ) {
60+ standardTile(" Down" , " device.windowShade " , width : 2 , height : 2 , inactiveLabel :false , decoration :" flat" ) {
6061 state " default" , label :' Down' , icon :" st.doors.garage.garage-closing" ,
6162 action :" close"
6263 }
@@ -83,7 +84,7 @@ metadata {
8384 childDeviceTile(" cloudCover" , " SmartScreens" , decoration : " flat" , width : 2 , height : 2 , childTileName : " cloudCover" )
8485
8586 main([" richDomoticzBlind" ])
86- details([" richDomoticzBlind" , " Up" , " Preset " , " Down" , " Cal" , " rssi " , " Refresh " , " windBearing" , " windSpeed" , " sunBearing" , " cloudCover" ])
87+ details([" richDomoticzBlind" , " Up" , " PP " , " Down" , " Cal" , " Refresh " , " rssi " , " windBearing" , " windSpeed" , " sunBearing" , " cloudCover" ])
8788
8889 }
8990}
@@ -136,6 +137,15 @@ def close() {
136137 }
137138}
138139
140+ void presetPosition () {
141+ log. debug " presetPosition()"
142+ if (parent) {
143+ sendEvent(name :' windowShade' , value :" partially open" as String )
144+ parent. domoticz_stop(getIDXAddress())
145+ }
146+
147+ }
148+
139149def refresh () {
140150 log. debug " refresh()"
141151
@@ -158,15 +168,6 @@ def open() {
158168 }
159169}
160170
161- def presetPosition () {
162- log. debug " presetPosition()"
163- if (parent) {
164- sendEvent(name :' windowShade' , value :" partially open" as String )
165- parent. domoticz_stop(getIDXAddress())
166- }
167-
168- }
169-
170171def setLevel (level ) {
171172 log. debug " setLevel() level ${ level} "
172173 state. level = level
@@ -333,7 +334,7 @@ def initialize() {
333334
334335 if (parent) {
335336 sendEvent(name : " DeviceWatch-Enroll" , value : groovy.json.JsonOutput . toJson([protocol : " LAN" , scheme :" untracked" ]), displayed : false )
336- createComponent()
337+ // createComponent()
337338 }
338339 else {
339340 log. error " You cannot use this DTH without the related SmartAPP Domoticz Server, the device needs to be a child of this App"
0 commit comments