Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Timed Session Example
- Author: @josh (SharpTools.io)
- Just a stubbed driver to test adding a switch attribute without the Switch capability.
- Doesn't actually full implement the Timed Session spec as it's just to test the sessionStatus and switch events.
- */
- metadata {
- definition (name: "Timed Session", namespace: "sharptools-io", author: "Josh Lyon") {
- capability "Actuator"
- capability "Sensor"
- capability "TimedSession"
- attribute "switch", "ENUM", ["on", "off"]
- }
- preferences {}
- }
- def parse(String description) {
- }
- def cancel(){
- sendEvent(name: "sessionStatus", value: "canceled", isStateChange: true)
- sendEvent(name: "switch", value: "off", isStateChange: true)
- }
- def pause(){
- sendEvent(name: "sessionStatus", value: "paused", isStateChange: true)
- sendEvent(name: "switch", value: "off", isStateChange: true)
- }
- def setTimeRemaining(NUMBER){
- //TBD
- }
- def start(){
- sendEvent(name: "sessionStatus", value: "running", isStateChange: true)
- sendEvent(name: "switch", value: "on", isStateChange: true)
- }
- def stop(){
- sendEvent(name: "sessionStatus", value: "stopped", isStateChange: true)
- sendEvent(name: "switch", value: "off", isStateChange: true)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement