2 name: "Lutron Group Control",
4 author: "sgibson18@gmail.com",
5 description: "Add bulbs to a Lutron Remote without using the remote's join process",
7 iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
8 iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience%402x.png"
12 page(name: "inputPage")
16 dynamicPage(name: "inputPage", title: "", install: true, uninstall: true) {
18 section("Remote Setup") {
19 paragraph "To get the Group Id of your remote, you must open Live Logging then fill in the inputs from this section. The code for the connected bulb selected must have a debug statement in its parse section, so you can see the response containing the group id.",
20 title: "First let's get the Group Id from your Remote by checking an already connected bulb", required: true
21 input (name: "remote", type: "capability.button", title: "Lutron Remote", multiple: false, required: true, submitOnChange: true)
22 input (name: "cBulb", type: "capability.switch", title: "Select a bulb connected to the remote", multiple: false, required: true, submitOnChange: true)
23 input (name: "endpoint", type: "text", title: "Zigbee Endpoint of selected bulb", required: true, submitOnChange: true)
26 if (remote && cBulb && endpoint) {
28 remote.getGroup(cBulb.deviceNetworkId, endpoint)
30 section("Enter the Group Id") {
31 input (name: "grpId", type: "text", title: "Group Id for Remote", required: true)
33 section("Now let's pick some new bulbs"){
34 input (name: "nBulbs", type: "capability.switch", title: "Select bulbs to add to the remote (all must use same endpoint)", multiple: true, required: true)
35 input (name: "nBulbEp", type: "text", title: "Zigbee Endpoint of selected bulbs", required: true)
55 def zigId = it.deviceNetworkId
56 def endpoint = nBulbEp
57 remote.assignGroup(zigId, endpoint, grpId)
64 def zigId = it.deviceNetworkId
65 def endpoint = nBulbEp
66 remote.removeGroup(zigId, endpoint, grpId)
72 remote.updateGroup(grpId)