An action that, if a light is off, leave it off, otherwise dim it to a specific level


(Eric V) #1

I’d like to be able to tell the system to dim specific lights if they are already on, but leave them off if they are off. Is that a SmartApp? Ideally, it would be something that shows up in a Hello, Home action.


(Convinced ST will never be unbroken…) #2

Hello Home actions are pretty limited. You would need an app to walk the list of the inputted lights to see if they are already on, and dim if true. Don’t recall seeing any apps already created that do this.


(Eric V) #3

Thanks for the feedback. I guess it’s time to get my hands dirty. Any suggestions on an app to start modifying? Or your suggested SmartApps tutorial?


(Convinced ST will never be unbroken…) #4

What do you want to use as a trigger?


(Eric V) #5

Ideally, a Hello, Home action.


(Eric V) #6

So, I got to this point. When I activate it in the sim, it does what I expect. Skips over any lights that are off and sets any lights that are on to the brightness I specify. Any thoughts on what I subscribe to for Hello, Home changes?

preferences {
    section("Settings") {
        input "dimmers", "capability.switchLevel", multiple: true, title: "Which lights?",required: true
        input "level", "number", title: "How bright?, 0-99", required:true
    }
}

def installed()
{
    subscribe(app, appTouch)
}

def updated()
{
    unsubscribe()
    subscribe(app, appTouch)
}

def appTouch(evt) 
{
    if (dimmer.latestValue("switch").toString() == "on") {
        dimmer.setLevel(level)
    }
}

(Convinced ST will never be unbroken…) #7

Do all of your hello home actions change mode? If so you could use that.

If not, I am not aware of an event that can be handled for just a Hello Home action. You could set up a virtual switch, turn that on with the hello home action, and track that virtual switch’s status to trigger your app.


(Eric V) #8

Figured that’s where I’d end up. So I create a virtual tile called “TV Time” and watch for that to turn on. When that happens, I can trigger my app as if I’d pushed the button? Alternately I can just leave the app as is and push it to activate?


(Convinced ST will never be unbroken…) #9

Note that the virtual switch does nothing other than changing on/off state. Use “The Big Switch” as the starting point for your app.


(Aaron) #10

My thought is to make Hello Home flip the virtual switch. Add that as a trigger for your smartapp and then you’re set. So Hello Home toggles V-switch, which then triggers your app. Then it’ll be automated.


(Alex) #11

I have an idea! I will test it first…


(Eric V) #12

For the moment I just left it as a touch. So I set it up in convenience as “TV Dim” pick all a the nearby lights and set it to 20%. Then I tap it when it’s time to watch TV. Then I created a second convenience one set to 80% for “Standard Dim” to set them all back. However, if I could find a way to make it react to a Hello Home action, that would be awesome.