You’re more than welcome! Glad to help!
I modified Tim's code (Thanks Tim!!!!) so that a virtual trigger could control 1-2 sets of Hue lights (instead of just dimmers) along a set of switches:
definition(
name: "Virtual Switch Control HUE Lights and/or Switches",
namespace: "Pastorlicious",
author: "Anthony Pastor",
description: "Based in VERY large part on Virtual Switch Control Lights by cbd@deyoungproperties.com. With the press of a single 'virtual switch', this app sets 1 OR 2 groups of your HUE light switches to specific colors / levels, and/or turn sets of switches on or off.",
category: "My Apps",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/hue.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/hue@2x.png"
)
preferences {
section("Select Switch to monitor"){
input "theSwitch", "capability.switch"
}
section("Which HUE light(s) to put into Group 1:") {
input "group1", "capability.colorControl", multiple: true, required: false
}
section("Group 1's detailed light settings") {
input ("group1Lvl", "integer",title: "Level (Default is 10%)", required: false, multiple: false)
input ("group1Color", "enum", multiple: false, title: "Color (Default is Soft White)", required: false, metadata:[values:["Soft White","White","Daylight","Warm White","Red","Green","Blue","Yellow","Orange","Purple","Pink"]])
}
section("Which HUE light(s) to put into Group 2:") {
input "group2", "capability.colorControl", multiple: true, required: false
}
section("Group 2's detailed light settings") {
input ("group2Lvl", "integer",title: "Level (Default is 10%)", required: false, multiple: false)
input ("group2Color", "enum", multiple: false, title: "Color (Default is Soft White)", required: false, metadata:[values:["Soft White","White","Daylight","Warm White","Red","Green","Blue","Yellow","Orange","Purple","Pink"]])
}
section("Turn ON these lights..."){
input "switch1", "capability.switch", multiple: true, required: false
}
section("Turn OFF these lights..."){
input "switch2", "capability.switch", multiple: true, required: false
}
}
def installed()
{
subscribe(app, appTouch)
initialize()
}
def updated()
{
unsubscribe()
subscribe(app, appTouch)
initialize()
}
def appTouch(evt) {
log.info evt.value
if (group1){
def myLightLevel = state.lightLevel1 as Integer
def myhueColor = state.hueColor1 as Integer
def mySat = state.saturation1 as Integer
def newValue = [hue: myhueColor, saturation: mySat, level: myLightLevel]
group1.each {
it.setColor(newValue)
}
}
if (group2){
def myLightLevel = state.lightLevel2 as Integer
def myhueColor = state.hueColor2 as Integer
def mySat = state.saturation2 as Integer
def newValue = [hue: myhueColor, saturation: mySat, level: myLightLevel]
group2.each {
it.setColor(newValue)
}
}
if(switch1){
switch1.on()
}
if(switch2){
switch2.off()
}
theSwitch.off()
}
def onHandler(evt) {
log.info evt.value
if (group1){
def myLightLevel = state.lightLevel1 as Integer
def myhueColor = state.hueColor1 as Integer
def mySat = state.saturation1 as Integer
def newValue = [hue: myhueColor, saturation: mySat, level: myLightLevel]
group1.each {
it.setColor(newValue)
}
}
if (group2){
def myLightLevel = state.lightLevel2 as Integer
def myhueColor = state.hueColor2 as Integer
def mySat = state.saturation2 as Integer
def newValue = [hue: myhueColor, saturation: mySat, level: myLightLevel]
group2.each {
it.setColor(newValue)
}
}
if(switch1){
switch1.on()
}
if(switch2){
switch2.off()
}
theSwitch.off()
}
def offHandler(evt) {
log.debug "Received off from ${theSwitch}"
}
def initialize() {
subscribe(theSwitch, "switch.On", onHandler)
colorSelection1()
colorSelection2()
}
def colorSelection2() {
state.lightLevel2 = group2Lvl ?: 10
state.hueColor2 = 23
state.saturation2 = 56
switch(group2Color) {
case "White":
state.hueColor2 = 52
state.saturation2 = 19
break;
case "Daylight":
state.hueColor2 = 53
state.saturation2 = 91
break;
case "Soft White":
state.hueColor2 = 23
state.saturation2 = 56
break;
case "Warm White":
state.hueColor2 = 20
state.saturation2 = 80 //83
break;
case "Blue":
state.hueColor2 = 70
state.saturation2 = 100
break;
case "Green":
state.hueColor2 = 39
state.saturation2 = 100
break;
case "Yellow":
state.hueColor2 = 25
state.saturation2 = 100
break;
case "Orange":
state.hueColor2 = 10
state.saturation2 = 100
break;
case "Purple":
state.hueColor2 = 75
state.saturation2 = 100
break;
case "Pink":
state.hueColor2 = 83
state.saturation2 = 100
break;
case "Red":
state.hueColor2 = 100
state.saturation2 = 100
break;
}
}
def colorSelection1() {
state.lightLevel1 = group1Lvl ?: 10
state.hueColor1 = 23
state.saturation1 = 56
switch(group1Color) {
case "White":
state.hueColor1 = 52
state.saturation1 = 19
break;
case "Daylight":
state.hueColor1 = 53
state.saturation1 = 91
break;
case "Soft White":
state.hueColor1 = 23
state.saturation1 = 56
break;
case "Warm White":
state.hueColor1 = 20
state.saturation1 = 80 //83
break;
case "Blue":
state.hueColor1 = 70
state.saturation1 = 100
break;
case "Green":
state.hueColor1 = 39
state.saturation1 = 100
break;
case "Yellow":
state.hueColor1 = 25
state.saturation1 = 100
break;
case "Orange":
state.hueColor1 = 10
state.saturation1 = 100
break;
case "Purple":
state.hueColor1 = 75
state.saturation1 = 100
break;
case "Pink":
state.hueColor1 = 83
state.saturation1 = 100
break;
case "Red":
state.hueColor1 = 100
state.saturation1 = 100
break;
}
}
Cleanup on aisle 3
haha JK
Try and reformat the code if you don’t mind @infofiend
edit your original post and highlight all the code at once and then click the </> button
I have setup endpoints for tasker use via “https://labs smartthings.com/exampleOauth.php” in the past. However, that site has been taken down. I confirmed it with support today.
I am trying to do this Tasker and SmartThings (reposting of project from build site) which was really easy with the exampleoauth.php. Now that the site is no more. I have been trying to go off Tutorial: Creating a REST SmartApp Endpoint .
Everything seems to work but I don’t know how to get the URL that used to be generated on exampleoauth.php.
Can someone explain how to find the url? I’m not the best at coding so any help would be great.
Thanks!
@jwosi I highly recommend using the app SharpTools that was recently created to make the whole process a LOT easier…
Enjoy!
Thanks for the reply. However, the link you provided doesn’t seem to work.
Oops, I forgot that the dev probably still has it in Beta. You could probably email him and ask to join the group of us trying it out. Here is very response.
Thanks for the shout-out, @triggertact. For anyone looking for the details on SharpTools, you can find the installation instructions at the following link:
http://sharptools.boshdirect.com/installation-instructions
And the list of features here:
Hey @joshua_lyon, just curious about how long you plan to keep SharpTools in Beta? Working great for me still, btw. Thanks!
I’ve had people tell me everything works great and I should release it publicly, but there are a few items I’d like to button up… so I don’t have a definitive timeline.
Is there a particular reason you ask?
PS. You are welcome to share the link to SharpTools with other people - I’m approving everyone who is requesting at this point and will update the installation instructions on the SharpTools website when the app is fully released:
I am a homebuilder (we do a bout 100 homes a year), and we just rolled out an included SmartThings package with each of our homes. For those with Android phones, I was thinking it might be useful to let them know about the extra cool things they can do using Tasker in combination with SharpTools and SmartThings. Most homebuyers aren’t really tech-savy so unless it’s an official app they can download from the Play store I have a feeling they’d be hesitant to try it out.