Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. /*
  2. Timed Session Example
  3.  
  4. Author: @josh (SharpTools.io)
  5.  
  6. Just a stubbed driver to test adding a switch attribute without the Switch capability.
  7. Doesn't actually full implement the Timed Session spec as it's just to test the sessionStatus and switch events.
  8. */
  9. metadata {
  10. definition (name: "Timed Session", namespace: "sharptools-io", author: "Josh Lyon") {
  11. capability "Actuator"
  12. capability "Sensor"
  13. capability "TimedSession"
  14. attribute "switch", "ENUM", ["on", "off"]
  15. }
  16.  
  17. preferences {}
  18. }
  19.  
  20. def parse(String description) {
  21. }
  22.  
  23. def cancel(){
  24. sendEvent(name: "sessionStatus", value: "canceled", isStateChange: true)
  25. sendEvent(name: "switch", value: "off", isStateChange: true)
  26. }
  27. def pause(){
  28. sendEvent(name: "sessionStatus", value: "paused", isStateChange: true)
  29. sendEvent(name: "switch", value: "off", isStateChange: true)
  30. }
  31. def setTimeRemaining(NUMBER){
  32. //TBD
  33. }
  34.  
  35. def start(){
  36. sendEvent(name: "sessionStatus", value: "running", isStateChange: true)
  37. sendEvent(name: "switch", value: "on", isStateChange: true)
  38. }
  39. def stop(){
  40. sendEvent(name: "sessionStatus", value: "stopped", isStateChange: true)
  41. sendEvent(name: "switch", value: "off", isStateChange: true)
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement