To implement capability.doorControl, I recommend the following:
(you had indicated that on/off fails 10% of the time, activation takes about 1 sec, door open/close takes 21 sec)
Open:
- DTH open() method should sendEvent “openning”
- APP should subscribe to the event and then runIn 2-3 seconds to confirm that sensor indicates contact is “open”
- if not, the APP should re-run the open() and repeat (1-2 times)
- once the APP receives the “open” contact from sensor, it should runIn 22 sec and then relay door “open” to DTH
Close:
- DTH close() method should sendEvent “closing”
- APP should subscribe to the event and then runIn 23-24 seconds to confirm that sensor indicates contact is “closed”
- if not, the APP should re-run the close() and repeat (again, 1-2 times)
- once the APP receive the “closed” contact from sensor, it should relay “closed” to DTH
There’s a way for an app to spoof events, to look like they are coming from DTH:
But it’s controversial, so what I do is have the APP send it using:
yourDevice.eventCreator([name: attribName, value: attribValue]) //and any other params such as displayed or descriptionText
And in the DTH metadata command “eventCreator”
and method
def eventCreator(evt) {
sendEvent(evt)
}