Using a MiniMote with Hue bulbs programming issue

I’m having a bit of trouble accomplishing getting my Hue bulbs/scenes to work with the MiniMote.

Here’s the scenario and how I would want it to work:

Button 1 Press: My nightstand light turns on to a set color temp/scene or turns off if on
Button 1 Held: My nightstand light turns on to a nightlight/dim mode

Button 2 Press: My wife’s nightstand light turns on to a set color temp/scene or turns off if on
Button 2 Held: My wife’s nightstand light turns on to a nightlight/dim mode

Button 3 Press: Both nightstand lights turn on to a set color temp/scene or both turn off if on
Button 3 Held: Both lights turn on to a nightlight/dim mode

That’s the goal. The problem:

Initially, I had button presses 1, 2 and 3 simply toggle turning on and off the actual lights. This worked. To get the nightlight mode to work, I created a scene in the Hue App, then am using the HLGS SmartApp to bring the scenes into smartthings as a momentary button.

Using the minimote, it will turn the scene on without issue! The problem is 2 fold:

  1. The lights will turn on, stay on for 5 seconds, then turn right off using the native “Button Controller app”. I’m assuming this is because I’m using a toggle/turn on function with a momentary button?

  2. Even if this worked properly, Hue remembers it’s state. Therefore, any time I use the other buttons to turn on the individual lights, they turn on in a dimmed state.

I then tried moving to “Button controller+” since I can trigger and action for on, off or momentary. I thought that would be the solution since I could create scenes for turning on each light so the color is correct, and use “Off” to turn off the device itself. However, this smartapp did not perform any action when mapping a momentary button. Nothing happened on either of the scenarios.

Therefore, I’m stuck. I’m not sure how I can get this to work. Again, I’m looking to turn on the lights to a specific scene but do a standard “Off” command on all three.

Anyone have any ideas?

John -

You are correct in that the problem lies with using the stock Button Controller app to control a momentary device. The Button Controller app uses toggle logic to turn switches on / off:

Lines 190-191:

def lights = find(‘lights’, buttonNumber, value)
if (lights != null) toggle(lights)

Then in Lines 237-245:

def toggle(devices) {
log.debug “toggle: $devices = ${devices*.currentValue(‘switch’)}”

if (devices*.currentValue(‘switch’).contains(‘on’)) {
devices.off()
}
else if (devices*.currentValue(‘switch’).contains(‘off’)) {
devices.on()
}

A momentary device will automatically go from “on” to “off”, so this is what is causing your issue.

I haven’t looked at code for Button Controller + yet. Have you tried using Rule Machine instead? You can call a scene from either a button pressed or button held trigger event. Its what I have been using, and it works great.

-Tony

Hmmm, I may look into that then. So you aren’t programming a button controller app, instead, you are using a rule that states if button 1 is pressed, then do X, if button 2 is pressed then do Y, etc?

How are you handling an Off action in this case? Do you have to dedicate a button to Off? Is there any way to do a “Press button to turn on scene” and press again to turn off device? Kind of like a hybrid toggle? I’m wondering if a conditional trigger could do this? Hit the button, evaluate on/off event and if on, turn off; if off, turn on scene?

Sure. Use a RM conditional trigger: the trigger event is the button press. The condition / rule is the private boolean. So if event triggers and boolean is true, then actions would be set scene switch to on and set boolean to false. And if event triggers and boolean is false, then actions would be set light (or group) to off and set boolean to true.

Tony,

Thanks for the walkthrough! This seems to be working on the first test button I used. However, this would mean I would essentially need a total of 8 rules, an individual one per press and per hold, correct?

Yes. Until I alter the Button Controller app to toggle scene ON / light (or group) OFF.

Ooooooo, tell me more! :smile:

It was pretty simple. Just added a HLGS section to allow for button press to toggle between (1) scene ON and (2) Lights and/or Groups OFF.

Here is link.

Let me know how it works for you.

1 Like

That’s so awesome! Thanks for that!

Could I possibly make a request/suggestion? Could you allow for picking the number of buttons? I’m thinking this could be very useful for my Enerwave 7 button controller as well!

I will definitely be trying this later on and will report back. Thanks man!!

7-button version here

1 Like

Wow, Tony, I don’t know what to say! I thought it was a long shot asking for that but man did you come through! I have installed both SmartApps. I didn’t get a chance to try them tonight as we were celebrating the Wife’s birthday. However, I plan to hit the ground running with this tomorrow.

Thank you so much! These + HLGS may be the ultimate Hue setup!

My pleasure, John. It was actually something that I had put on a to-do list, so you just gave me the motivation to get it done.

1 Like

Tony,

So far, the minimote app is working great! I’m no longer having the issues with the lights automatically turning off. However, is there a way to add a similar configuration for buttons “held”?

For example:

Button 1 Press: Turn on HLGS Scene1
Button 1 Press again: Turn Off device
Button 1 Held: Turn on HLGS Scene2
Button 1 Held again: Turn off device

Is that possible?

Also, if I have multiple minimotes, is there a way to give the SA a name to distinguish the different versions of the SA?