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

I'm trying to use this with a Pico to activate a scene and am not having any luck. I can't see anything wrong with my setup so am hoping someone spots something obvious.

Here's the controller. test pico is a fast pico switch if it matters. test1 scene just sets a dimmer to 30% and it works fine when activated directly (or via a switch).

Here are my logs (with debug logging for dimmer button controller enabled) and it's definitely seeing the button press and it looks like it's trying to activate the scene but nothing actually happens.

Nope, I think it's a problem with my code, and it could be me just not understanding how scene devices in Hubitat work. Thanks for catching this! The short answer is that around line 400 in the code, there's a command sc.push(), which should work if you change it to sc.on().

If anyone knows why, I'd appreciate some insight. I thought either one should work. The device appears to expose both, and it works if I click it in the device's "Edit" page in the UI, but only "on" works if I use it in my code. The effect should be the same unless you care about not tracking the on/off state of the scene device itself (e.g., I think some people with dashboards do).

I'll try to address this in the next update, either changing it to "on" or figuring out why "push" doesn't work. In the meantime, if you feel comfortable, hopefully anyone with this problem can try the minor change themselves. I mostly use it for manual "scene" creation myself and confess that I didn't do much testing with Hubitat scenes.

Thanks for the pointer. I don't know enough to say why sc.push() would fail and sc.on() would work but am happy changing it as I don't care about the state for this use case. I'll give it a shot later when I'm back home.
I'm curious what you mean that you're using it for manual creation?

I use the "Turn on" option, not the "Turn on scene" option. The "Turn on" option lets me manually (that's what I meant) specify level, color temperature, and/or hue and saturation, rather than choosing a "real" Hubitat scene to activate. I guess I shouldn't have said "creation" since they don't make scenes that are accessible outside the app, but the effect within the app is the same--just manually specifying the "scene" settings you want.

This was in no way inspired by me trying to use the Hue app to make scenes and having to just guess where the heck 4000K was on a visual color-temperature slider... :slight_smile:

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: