Toggle with Smart Lighting

I have a GE Z-wave switch and an Xiaomi button both working. I would like to use the xiaomi button as a toggle for the switch. I’ve tried to set up a smart lighting automation for the button, but things go out of sync if I use the switch (whether manually or through the smarttings app). It seems to me that the smart lighting automation is maintaining some state information (ie, this button press, turn the switch on, next button press, turn the switch off) instead of doing a simple toggle.

For example:

  • I use the button: switch turns on
  • I turn off the switch using the app: switch turns off
  • I press the button, smart lighting tries to turn the switch off: nothing happens

Surely I’m missing something simple?

Does the device update on its page when you manually operate it?

Yes, it does. Same thing happens when I use the app itself to set the state of the switch, so the hub should definitely know the state of the switch!

Can you show us a screenshot of the smart lighting automation you have set up?

Screenshot (Dec 7, 2017 9_34_48 PM)

anyone have any ideas?

I believe I’m running into the same issue. I have a similar setup where I have a master light switch and a toggle button that I’m trying to make into a 3-way light switch (which seems like the common use case). However, if I turned on the light button, I can turned it off as expected. However, if I turned on the light at the master switch, I have to toggled the button twice to turn it off.

I noticed in the smart lighting app, it has an application state of “pushed => true/false” that gets inverse whenever I pushed the toggle button. This state doesn’t get updated when the master switch is used. I suspect that state is being used to determined whether to turn on or off, but would become out of sync when the light is toggled outside of the SmartLighting app.

I have the same setup and the same problem. Did you ever find a fix?

I’ve sent an email to SmartThings support and is waiting to hear back.
In the meantime I just created my own SmartApp that does what I wanted it to do.

could you share that SmartApp?

definition(
    name: "Toggle Light Button",
    namespace: "personal",
    description: "This app create a toggle button for light switch",  
    category: "Convenience"
)

preferences {
    section("The button that will toggle the light") {
        input "toggleButton", "capability.button", title: "Select", required: true
    }

    section("The switch to be controlled") {
        input "controlledSwitch", "capability.switch", title: "Select", required: true 
    }
}

def installed(){
    subscribe(toggleButton, "button", toggleHandler, [filterEvents: false])
}

def updated(){
    unsubscribe()
    subscribe(toggleButton, "button", toggleHandler, [filterEvents: false])
}

def toggleHandler(evt) {
    if (evt.name == 'button' && evt.value) {
        if (controlledSwitch.latestState("switch").value == "off") {
           controlledSwitch.on()
        } else {
           controlledSwitch.off()
        }
    }
}
1 Like

This is the response I got from SmartThings support. Sounds like they’ll only prioritize the bug fix if enough people contact them about it. I would ask people to reach out to get the issue fixed.

"
Donny L. (SmartThings)

Jan 2, 9:53 AM MST

Hello,

Thanks for reaching out – I’m happy to help!

Sorry for the trouble using the Toggle button in Smart Lighting.

Based on what I’m seeing on our side, it appears that you may be experiencing this problem using a custom virtual button (“Momentary Button Tile”). This type of custom virtual device is not supported by SmartThings and may not work properly. The Community is your best resource for troubleshooting and finding potential ways to improve behavior is Smart Lighting.

Unfortunately, we’re not able to offer any troubleshooting based on Community posts as we need to see the specific details in the logs on each User’s account. If you have each individual User contact us and we see a specific problem trending, then we can dig in deeper to see what may be going on.

If you are experiencing this problem with stock SmartThings options and devices, what I need from you for troubleshooting your particular issue is as follows:

The name of device(s) you are experiencing this problem with
A recent date and time (within the last day or two if possible, 7 days max) in which the device did not perform as expected (please include what you were attempting to do)
Let me know if you have any other questions or concerns!"

I figured out the toggle option thanks to @Ron only I’ve discovered the smart lighting smart app isn’t smart because it doesn’t toggle based on current state. I programmed button 1 to turn on three lights. I programmed the remaining three buttons (of four total for the aeotec wallmote) to turn on each of three lights individually. if I press button 1, all three lights come on as expected. pressing buttons 2, 3, or 4 does not turn off the lights individually but instead requires a second tap.i believe this because the default action in smart lighting is to “turn on” instead of read state and “toggle” or do the opposite.

I’m having this issue and wondering if anyone had a fix?

I just found this over on Reddit - https://www.reddit.com/r/SmartThings/comments/a3nqrt/how_to_get_button_to_toggle_based_on_the_target/
I intend to test this myself but I’m away from my SmartThings setup for several days so won’t be able to. As I commented over on Reddit, I’m surprised you are allowed to define two SmartApps for the same item / action (eg, button 1 / press) - you’d think they’d only allow one such association. But - it did allow me to do this. I’d be interested in seeing if you can test this now.