Advertisement
Guest User

Untitled

a guest
Jan 7th, 2018
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. /**
  2. * Copyright 2015 SmartThings
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  5. * in compliance with the License. You may obtain a copy of the License at:
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  10. * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  11. * for the specific language governing permissions and limitations under the License.
  12. *
  13. * Momentary Button Tile
  14. *
  15. * Author: SmartThings
  16. *
  17. * Date: 2013-05-01
  18. */
  19. metadata {
  20. definition (name: "Blink - Motion", namespace: "smartthings", author: "SmartThings") {
  21. capability "Actuator"
  22. capability "Switch"
  23. capability "Momentary"
  24. capability "Sensor"
  25. }
  26.  
  27. // simulator metadata
  28. simulator {
  29. }
  30.  
  31. // UI tile definitions
  32. tiles(scale: 2){
  33. multiAttributeTile(name:"switch", type: "generic", width: 6, height: 4, canChangeBackground: true){
  34. tileAttribute("device.switch", key: "PRIMARY_CONTROL") {
  35. attributeState("off", label: 'No Motion', action: "momentary.push", backgroundColor: "#ffffff", nextState: "on")
  36. attributeState("on", label: 'Motion', action: "momentary.push", backgroundColor: "#00a0dc")
  37. }
  38. }
  39. main "switch"
  40. details "switch"
  41. }
  42. }
  43.  
  44. def parse(String description) {
  45. }
  46.  
  47. def push() {
  48. sendEvent(name: "switch", value: "on", isStateChange: true, displayed: false)
  49. sendEvent(name: "switch", value: "off", isStateChange: true, displayed: false)
  50. sendEvent(name: "momentary", value: "pushed", isStateChange: true)
  51. }
  52.  
  53. def on() {
  54. push()
  55. }
  56.  
  57. def off() {
  58. push()
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement