I just bought and connected a NodOn Soft Remote. ST registers all the button presses, but I can’t seem to find a way to link one of the buttons directly to a device. For instance, I’d like the open circle to toggle my bedroom light on or off, depending on which state it’s already in. Please tell me there’s a simple way to do this instead of having to create a separate scene to turn the light on, and another to turn it off, and another to set my ceiling fan to full, and another to set the ceiling fan to low, etc.
Also, when creating an automation, is it possible to set conditions? i.e. “If bedroom light is on and button 4 is pressed, turn it off, else if bedroom light is off and button 4 is pressed, turn it on.”
Welcome! That’s a very cool device. It’s finally available now in the US, it was released in Europe first, and I’m sure it’s going to be very popular.
First things first… You need to use a device type handler (DTH) which will report each press as a different button “number.” Once that is happening, any smartthings automation, including the official smartlighting feature, which can handle a “button controller” will let you assign different actions to the different button “numbers.”
You can find device type handlers that have been contributed by other community members by using the quickbrowse lists in the community – created wiki. In this case, look on the list for “remotes and buttons.” I know there’s at least one there for the octan device.
If you haven’t used custom code before, it’s pretty simple. Basically you’re going to copy the author’s code and paste it into your own account. The following FAQ discusses that general process.
Ok, that takes care of getting the button presses reported to the SmartThings Hub. Now you want to set up some conditional logic.
The official SmartThings features don’t really support much conditional logic. They’re more for the simple kind like “if button three is pressed, turn on that light.”
But as already mentioned, webcore is a very powerful community – created rules engine which can do everything you asked for and more. Setting it up is a little complicated, but there are many community members who will be glad to help:
All of that said, as @ogiewon mentioned, The official smart lighting feature does let you set up a button to toggle a light on and off. So if that’s all you need to, you can just do it with the official feature. Unfortunately at the present time the smart things mobile app is not navigable by voiceover, so I can’t show you a screenshot. But you should be able to find it if you just set up a new smart lighting automation.
I believe the problem with the built-in Smart Lighting app (and its ‘toggle’ feature) is that if any other ‘event’ can turn on/off the light being controlled by the ‘toggle’, things get out of sync. Eg - you touch the button and the light turns on; you touch the button again and the light turns off. Great. But lets say you have a motion-sensor that also turns on the light. The next time you touch the button, nothing happens because the button ‘thinks’ the light is off so it tries to turn it on, but it’s on already so the end-user thinks the button was ignored, and has to press again for the ‘off’ action. I found a post on Reddit that solves this. I’m actually really surprised that it worked (for reasons I’ll explain later). Here’s the post on Reddit for reference:
I followed the steps to the letter and it worked great.
What I don’t understand is, is it perfectly legal to define two separate Smart Lighting ‘automations’ that are tied to the same event (a button press)? I would have thought that could lead to problems. Are there any such limits or is it a case of ‘buyer beware’?
For those who don’t read the Reddit post, or just in case it disappears, the steps are:
Using the classic app, add or open the Smart Lighting SmartApp. You’ll need to have two separate automations, one for On and one for Off.
For the On status create a new automation:
Devices to control : [your light(s)]
What do you want to do: Turn on
Select trigger: Button -> [your button]
Button action: pushed
Toggle on and off : OFF
Only if switch: [light of choice] is Off
[leave the others untouched unless you want to set additional parameters]
Then create a second automated action which just replaces all the Offs to Ons and vice versa.
I can’t read code very well, but if I’m hearing right, I believe it’s the “only if“ which is saving you in this regard.
You can definitely have multiple automations trigger off of the same event without any problems. That would be the button press.
But if I’m understanding things correctly the “only if” is essentially the same as setting up one rule for a device if it’s Monday and a different rule for the same device under the same conditions but with a different outcome if it’sTuesday. Multiple rules applying to the same trigger event, but with different outcome filters.
Clearly the ‘Only If’ is what’s making this work. But my concern was related to how exactly ST invokes these routines. To explain further, let’s describe the two actions as
If button pressed, turn on lights but only if off
If button pressed, turn off lights but only if on
So, I could imagine a scenario / implementation as follows: light is off, and button is pressed. ST runs routine 1, which checks status; light is off, so it turns light on. Now the light is ON. Next, ST runs routine 2, which checks status; light is now ON, so it ‘should’ turn light off. So in this scenario, the light would only come on momentarily. Clearly that’s not the case (lights do in fact come on and stay on), so that tells me the timing between running actions 1 and 2 is very fast, and the check of status for action 2 is being done before the ‘turn light on’ action from action 1 is complete. But it seems inherently risky to rely on this!
It all comes down to how the ‘engine’ for ST does it’s work behind the scenes.
Sorry, I don’t quite follow what you are saying. Are you suggesting a different way to implement, or just speculating about how the ‘engine’ may be running things behind the scenes?
ETA - never mind, I see that you are speculating about how the engine works, and your interpretation makes sense.
ETA 2 - but … if I had two automations as follows - 1) turn light on if Monday and 2) turn light on if Dark, there will be times when both could be true, and so the engine would have to be smart enough to say ‘evaluate automation 1 and set it eligible’; ‘evaluate automation 2 and set it to eligible’; run automation 1; run automation 2. In other words it needs to stack up the various evaluations, then execute all eligible automations. Certainly do-able, but I could imagine rules / limitations about how this works!
Following on from this ‘desire’ to fix toggle actions, I found this thread with some custom ‘Smart App’ code.
The code as presented in that thread wouldn’t save but once I added ‘author’ and some icon url statements, I got it to save. But when I try to run (use, configure to a light) that SmartApp, it asks me for the ‘button’, and I choose my “Aeon Wallmote”, but it doesn’t ask me which button within the wallmote to use. Using a built-in SmartApp, I am asked to choose the button and when I select the WallMote, it then asks me for the specific button number. I would have thought that part would be outside of my responsibility (to realize this is a multi-button device and thus to ask for specific button).
Any thoughts on what I need to do to fix this? The code looks like this currently (borrowed heavily from the version in the referenced post):
(how do I paste in code? … I’m familiar with using tags in other forum tools but I don’t see an equivalent here) - GOT IT - just use the good old fashioned ‘code’ tags even though there’s no button at the top for it
Thinking about it again bringing in my rudimentary understanding of SmartApp programming, perhaps a more likely model is actually that each automation subscribes to the switch events and maintains an ongoing enabled/disabled status ready for when the button press event comes along.
Just to let everyone know, once I updated the firmware on my Leviton dimmer switch, the toggle action has been working perfectly. So now, I can press buttons on my ‘Aeon Wallmote’, press the on/off buttons on the device itself, and/or send on/off commands from the phone app, and they all work, and the buttons on the wallMote really do ‘toggle’ - a single press always flips the light to the opposite state, no matter how it got there. So I’d say this approach is very sound!