Advertisement
xetrok

1 Gang DH

Jul 18th, 2018
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.86 KB | None | 0 0
  1. metadata {
  2. definition (name: "Nue ZigBee 1 Gang Switch", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.switch") {
  3. capability "Actuator"
  4. capability "Configuration"
  5. capability "Refresh"
  6. capability "Switch"
  7. capability "Health Check"
  8.  
  9. fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006"
  10. fingerprint profileId: "0104", inClusters: "0000, 0003, 0006", outClusters: "0003, 0006, 0019, 0406", manufacturer: "Leviton", model: "ZSS-10", deviceJoinName: "Leviton Switch"
  11. fingerprint profileId: "0104", inClusters: "0000, 0003, 0006", outClusters: "000A", manufacturer: "HAI", model: "65A21-1", deviceJoinName: "Leviton Wireless Load Control Module-30amp"
  12. fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006", outClusters: "0003, 0006, 0008, 0019, 0406", manufacturer: "Leviton", model: "DL15A", deviceJoinName: "Leviton Lumina RF Plug-In Appliance Module"
  13. fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006", outClusters: "0003, 0006, 0008, 0019, 0406", manufacturer: "Leviton", model: "DL15S", deviceJoinName: "Leviton Lumina RF Switch"
  14. fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006", outClusters: "0003, 0006, 0008, 0019, 0406", manufacturer: "Feibit Inc co.", model: "FB56+ZSW1GKJ1.7", deviceJoinName: "Nue ZigBee Switch"
  15. fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006", outClusters: "0003, 0006, 0008, 0019, 0406", manufacturer: "Feibit Inc co.", model: "FB56+ZSW05HG1.2", deviceJoinName: "Nue ZigBee Light Controller"
  16. }
  17.  
  18. // simulator metadata
  19. simulator {
  20. // status messages
  21. status "on": "on/off: 1"
  22. status "off": "on/off: 0"
  23.  
  24. // reply messages
  25. reply "zcl on-off on": "on/off: 1"
  26. reply "zcl on-off off": "on/off: 0"
  27. }
  28.  
  29. tiles(scale: 2) {
  30. multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
  31. tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
  32. attributeState "on", label:'${name}', action:"switch.off", icon:"st.switches.light.on", backgroundColor:"#00A0DC", nextState:"turningOff"
  33. attributeState "off", label:'${name}', action:"switch.on", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
  34. attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.light.on", backgroundColor:"#00A0DC", nextState:"turningOff"
  35. attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
  36. }
  37. }
  38. standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
  39. state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
  40. }
  41. main "switch"
  42. details(["switch", "refresh"])
  43. }
  44. }
  45.  
  46. // Parse incoming device messages to generate events
  47. def parse(String description) {
  48. log.debug "description is $description"
  49. def event = zigbee.getEvent(description)
  50. if (event) {
  51. sendEvent(event)
  52. }
  53. else {
  54. log.warn "DID NOT PARSE MESSAGE for description : $description"
  55. log.debug zigbee.parseDescriptionAsMap(description)
  56. }
  57. }
  58.  
  59. def off() {
  60. device.endpointId ="10"
  61. zigbee.off()
  62. }
  63.  
  64. def on() {
  65. device.endpointId ="10"
  66. zigbee.on()
  67. }
  68.  
  69. /**
  70.  
  71. PING is used by Device-Watch in attempt to reach the Device
  72. */
  73. def ping() {
  74. return refresh()
  75. }
  76. def refresh() {
  77. zigbee.onOffRefresh() + zigbee.onOffConfig()
  78. }
  79.  
  80. def configure() {
  81. // Device-Watch allows 2 check-in misses from device + ping (plus 2 min lag time)
  82. sendEvent(name: "checkInterval", value: 2 * 10 * 60 + 2 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
  83. log.debug "Configuring Reporting and Bindings."
  84. zigbee.onOffRefresh() + zigbee.onOffConfig()
  85. }
  86.  
  87. //Please cope the device handler end this line
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement