[RELEASE] Dimmer Button Controller (configure Pico to emulate Hue Dimmer or any button device to easily control lights)

Ah, that makes sense. My only real reason for wanting a scene is that I want to restore the state of the light on the first press but maybe there's a better way?
What I'd been thinking was a scene that activates on button 1 press 1 and save the scene state when button 5 is pressed. When button 1 was pressed a second time I intended to activate a scene that just sets the light to 100%. This could be done differently if there were another way to save the light state (when button 5 is pressed prior to turning them off) or if there was a way to use a scene (first press) and setting the dimmer (press 2) but I didn't see a way to do either of those without a lot more work (than just using scenes).

Hmm. I think that's almost possible as-is if you just use "Turn on" and don't specify anything else. Unfortunately, it doesn't save which lights were on/off when you press whatever button (say, 5) you have set for "Turn off," so it will turn on all of the select lights back on again--but it will turn them on to whatever they were before, since all it does is send an on(). Maybe I could add a "Turn off and save states" and "Turn on and restore saved states" action? (Incidentally, that's about what I do with my Lights on Motion Plus app, albeit with motion-sensor triggers and not button-device triggers; I was thinking about merging some aspects of the two, however, e.g., allowing a button to restore instead of new motion.)

interesting, I confess I didn't try just sending "turn on". I actually don't have multiple lights (these are recessed lights all behind the same switch) so that's not an issue for me. If I can set it up to "turn on" for press 1 and "set to 100%" for press 2 and "turn on" restores the last state then I think it'll work as I want. I'll give that a shot tonight.
If it works and WAF with any delay (compared to Lutron native connection) is ok then I think I'll be set.

I tried leaving the first press for "turn on" empty (no level) but that just made press 1 do nothing. Here's what it looks like and the logs.


Changing to sc.on() did the trick for the scene but I haven't quite figured out how to store the scene state when button 5 is pushed (since I can't combine two actions; turn off + push another button or switch). Turning off the scenes (including a capture for "scene 1") doesn't seem to work as I'd hoped.

BTW, I think I found a bug on line 422; I think def sc = settings["btn${btnNum}Held_SceneOff"] should read def sc = settings["btn${btnNum}_SceneOff"].

Any thoughts on either getting "on" to work or how to store the scene state?

1 Like

@bertabcd1234 Hi,
how about this (with a hue dimmer in mind):
hold button 1 to shift to blueish, hold button 4 to shift to redish light?

otherwise, it's already great.

You can already (sort of) do that: if the button device supports "held," you'll see it as a configurable action. You'll then just need to set the hue, saturation, and level values to match your desired colors.

However (this is the "sort of"), I don't think you can do that with a Hue Dimmer because I don't think it supports "held" on buttons 1 and 4. This is how the device works, nothing Hubitat or this app can do about it. (But you can check for sure by seeing what events get logged as you try the various buttons. It's common for this type of device to only support "held" or both "push" and "release" on buttons that are intended to be used for dimming: Pico remote, Eria Dimmer, and, I think, this.)

1 Like

You're right. The Hue dimmer doesn't support it on 1 and 4. But it does on 2 and 3. unfortunately it doesn't work with your app. the log says it doesn't support "start level change" and "stop level change". I played yesterday with the build in button controller and there it seams to work.
Something I can do to help solve this issue?

Verify that your dimmers/lights support startLevelChange and stopLevelChange, which you can see by looking at their device page. If those buttons aren't there or you try them and they don't work that is the problem. (That being said, I'm not sure why BC would work and this wouldn't if yu mean the same lights/dimmers. Are you using stock or custom drivers?)

The functionality is given. It works perfectly fine on the device page.
It states clearly when held and released.
I'm using the stock driver (couldn't fine costom drivers for testing).

The same with all 4 of my dimmers.
And also, the built in button controller app supports it. But I need your app for the "swich configuration on multiple button presses" functionality.

@bertabcd1234 In case you have no intention to investigate why the start/stop mechanic on my/the hue dimmer switch/bulb/bridge not works, HE has this function also intigrated. So with a combination of your app and the build in button controller app I can do what the dimmer should do.
(It's an inconvenience but it works)

thanks anyway

OK, so I looked at my code again, and it actually doesn't do any checking to see if your devices support startLevelChange (or stopLevelChange)--it simply calls that command and leaves it up to you to verify that it works. I assume the error you see is coming from the device/driver and not my app? I have no idea why Button Controller would work and this app wouldn't. My only guess is that if you have multiple bulbs/dimmers selected, some of them support it and some don't (my app calls it on the entire list of devices at once). In that case, I don't know what would happen, though I'd expect it to simply gracefully fail on those that don't support this.

If you're using scenes instead of "manually" specifying the configuration (level, color temperature, etc.) inside the app, you might give Advanced Button Controller a try. It's a different community-created app that I know has a "cycle through scenes" feature and supports "dim while holding," but I don't know if you can control the order in which the scenes cycle. (If his startLevelChange works and mine doesn't, maybe I can see what his code is doing differently from mine. :slight_smile: )

Hi @bertabcd1234 , I just wanted to give you a feed back. I gave it another try and now it's working. I turnd off the step up/down brightness per push stuff and useing only the held and released variant.
I guess the problem was on my side... still pretty new on HE.

thanks

Just uploaded version 1.7 to GitHub. Besides minor bugfixes (a typo a community member helpfully pointed out above plus some arithmetic to account for trying to raise a dimmer above 100 or below 1 if not using "hold to dim"--which I would recommend if you can), this includes two new features:

  • "Toggle" as an action you can choose besides "Turn on," "Dim," etc. This will turn off all lights/switches if any are on; otherwise, it will turn them all on.
  • "Additional lights for 'off'": the "Turn on," "Dim" and "Brighten" actions will not affect these lights/switches, but the "Turn off" action will turn them off (in addition to the "regular" ones)

In a future update, I'm thinking about the ability to choose more than one button device. That way, you could apply the same actions to more than one device (I'm thinking of something like two Pico Remotes you have mounted in two locations in the same room and want to behave the same). However, this got complicated when I thought about it since you could choose two button devices with different numbers of buttons or supported capabilities (pushed/held, etc.). If this feature would be useful to anyone, I'm open to ideas as to how to implement it (I'm thinking just show all features supported by any device, with perhaps a warning that some may never run for some devices if that specific device doesn't support those capabilities).

Hi

Thank you for making this awesome driver, I use it on all my dimmers in my house. I have a question though. I am trying to control two sengled bulbs with a 5 button pico remote. I have buttons 1 and 5 set to turn on with 5 presets for each. Button 3 turns them off. I want buttons 2 and 4 to dim up and down, but they don't respond. Is this because I have the brightness setting set at 50 on all presets for buttons 1 and 5. If I don't put in any brightness settings though I can't do 5 presets per button.

Am I doing something wrong or is the dimming not possible?

That should work--it sounds like you have a setup similar to mine. Here's one of mine showing what I have, with buttons 2 and 4 being the ones of interest here:

A few questions that might help:

  1. Are you using the "regular" or "fast" driver for your Pico? If you're not sure, open the "Logs" link on the left side of Hubitat, then see what happens when you press the buttons. The regular driver will register a "pushed" event when you release the button after a short press or a "held" event when you release the button after a long press, then a "released" when you let go. The "fast" driver will register a "pushed" event as soon as you press the button and a "released" event whenever you let go. I recommend the "fast" driver unless you need the second action per button because this lets you use buttons 2 and 4 to "dim while held," as I have set above, with minimal delay.
  2. On that note, are you using "dim while held"? Behind the scenes, this sends startLevelChange and stopLevelChange commands to the lights/devices when the button is pushed and released, respectively. If you are using this and your devices don't support these commands, leave this option disabled. It is disabled by default; the default is "step-up"/"step-down" dimming where it reads the current level for each device, increments or decrements it by a specific value, and then sets the level to that new value. This should work unless Hubitat doesn't know the correct current state of your devices.
  3. And on that note, do your Sengled bulbs show their correct state in the Hubitat admin UI? I'm not aware of any problems with these, but since the default step-up/step-down dimming depends on this, that's the only thing I can think of. I'm pretty sure the Sengleds support the start/stop-levelChange commands, however, so you might try enabling that option to work around this.

PS - You can do five "presets" without specifying brightness, sort of. If you don't specify any brightness/level, it will just turn them on. You do need to specify at least a brightness/level, color temperature, or hue, saturation, and level combination for it to allow you to specify a subsequent preset, however. If you don't want to change any of these attributes (not sure of the use for that but I was just trying to prevent people from configuring button presses that won't do anything), you could use the "turn on scene" feature instead that will allow you to choose real Hubitat scenes instead of manually configuring these attributes for each press.

Hi

Thank you for your reply. I pretty much have the same set up as you, I checked everything and still had no luck. Then I realized the only difference was my bulbs were part of a group, I changed that and they started dimming.

:v:

New to Hubitat here, this looks pretty nice. A question and a suggestion.

Question: Do Hue groups in Hubitat not support startLevelChange/stopLevelChange? I have this working for dimming when held when I select the individual Hue bulbs, but not a Hue group. I'd like this because if I use the individual bulbs instead of the group, when I just do on/off they turn on and off staggered, not all at the same time. If I use the group, they all do it simultaneously. I can workaround this by having a separate dimmer controller for on/off and dimming, but that seems like it shouldn't be necessary.

Suggestion: It'd be nice to have an option to turn the lights on with the dimmer buttons. If the light is off, and I hold "brighten" I'd like it to set it to on at the lowest level and go from there. Is this possible and I just missed it in there somewhere? (Similarly, it might be good to have them turn off if I continue holding the dim button. I realize this might be tricky with the issue of the status immediately setting to off.)

I don't have any Hue groups to test with, so it's possible they don't support those commands. (I know the individual bulbs work because that's how I have mine set up.) I can do some more testing to figure this out since someone above mentioned something similar with groups. If you don't see these commands listed on the device's page in the admin UI, I wouldn't expect it to work, but I don't use them and can't say for sure.

For dimming, the behavior with startLevelChange and stopLevelChange isn't anything special to this app--it's just what Hubitat does with the device when it receives those commands, which is apparently not to change any that aren't currently on. I think the Hue Dimmer, which I'm trying to emulate, works the same way. It would be a bit tricky to implement with the current start/stopLevelChange bugs, but it might be possible with the step-up/down style of dimming; I'm just not sure if it makes sense given the intention of the app. (I could create a special fork with minor modifications that would do this, but if I update the app in the future I wouldn't be inclined to keep them in sync.)

I'm contemplating replacing my Hue Bridge with an additional Hubitat hub just for Zigbee lightings so I can try to take advantage of groups (and Zigbee group messaging), so if I do that, I'm sure I'll discover some ways I might want to change things around in the app. We'll see. :slight_smile:

Oh, and Button Controller 3.0 (new in the last Hubitat firmware update) is pretty nice now. It still takes a bit more effort to configure than this app (my goal was to let you choose the lights once here then the action for each button; there you have to choose the lights/devices for all buttons each time), but I'm pretty sure it could handle what you want as-is.

Thanks. I've worked around the group situation with a separate on/off and dimmer controller, with the on/off using the group and the dimming using the individual bulbs.

Maybe I'll look into Button Controller 3.0. I hadn't seen it yet.

Well, with Button Controller and Rule Machine I was able to make it work. It just seems kinda silly there's no app that's just "use this pico remote with these lights in the straightforward way you'd expect it to work," Maybe I'll write one. Setting all of this up for each Pico seems excessive.

chrome_2019-05-31_14-36-24