Cycle through pre-set dimmer levels

Hi all, hopefully this is the right place for this.

Seems like it would be a semi-common scenario but I haven't found a way to do this yet.

I have a button, and I want a long press to cycle through a set of preset dimmer levels. For example, 30%, 60%, 90%. None of the built-in dimmer controls seemed to do this. I thought I might be able to "start lowering dimmer" and "stop changing dimmer level" on release, but mine don't support that and it's unclear that it would wrap back around once it hits 0 or 100.

Before I start figuring out code and variables is this problem already solved somewhere?


Hi @quid. I use a rule to do this for my blinds. You can do the same thing for your dimmer.
My blinds are automated but sometimes we want to change it manually.
My rule is:

trigger: button push
IF Dining room blinds is off THEN
Position Shades: Dining room blinds to 70
ELSE-IF Dimmer level of Dining room blinds >= 70 THEN
Position Shades: Dining room blinds to 50
Lower Shades: Dining room blinds

Are you familiar with how the Hue Dimmer works when paired and used natively with the Hue network? If not, it's a 4-button device, with the first button--the "On" button--being able to cycle through up to 5 scenes. Pressing it once activates the first scenes (or just turns them on to the last used setting), and you can configure the rest of the presses to do other scenes. After a few seconds (15, maybe?), the "press count" resets to 1. I wrote an app that emulates this behavior on Hubitat, which I intended to be used with a Hue Dimmer, Eria Dimmer, or Pico remote, but it would technically work with anything: [RELEASE] Dimmer Button Controller (configure Pico to emulate Hue Dimmer or any button device to easily control lights)

That being said, it only supports this with button "pushed" events, not "held" events (there you can only configure one action). If you wanted to make Hubitat scenes instead of manually specifying the brightness level for each time (Dimmer Button Controller supports either), you can use the "Cycle Scenes" feature in a different app, Advanced Button Controller: Advanced Button Controller (ABC)

Or if you always want to go in sequence, the above rule would work too--e..g, on a button hold trigger, you could have rule actions that check the current level and adjust it to your "next" desired level. If you care about resetting after a period of time, you'll have to add something else in (private boolean?), but otherwise it wouldn't be too bad.

1 Like

Thanks, I got it working!

I went for the simplest option so it seemed with a conditional rule like this:

IF (Dimmer level of Living Room All Lights(100) becomes < 30(F) [FALSE]) THEN
	Dim: Living Room All Lights: 100 --> fade: 1
ELSE-IF (Dimmer level of Living Room All Lights(100) becomes < 60(F) [FALSE]) THEN
	Dim: Living Room All Lights: 25 --> fade: 2
ELSE-IF (Dimmer level of Living Room All Lights(100) becomes >= 60(T) [TRUE]) THEN
	Dim: Living Room All Lights: 59 --> fade: 2

Mostly a proof of concept, I may fiddle with it later, and it's also nice to know there's a couple more full featured solutions to try as well.

I find that "ramping" dimmers is pretty tough if you want to get things very low or not quite high. I always end up missing them. So I have done something similar with a few button controllers in my house. You can do this quite easily in RM 4.0. Within the button control rule that you are defining you simply check for the currently level of the device to set it to the next one. So, the rule would look something like this:

Action for the butt pressed or held:

If Light is off Then
       Turn on light to 20
Else  If Light is On THEN
        If dimmer level of light is ≥0 and dimmer level   < 20 THEN
               Set dimmer to 20
       Else If dimmer level of light is ≥20 and dimmer level  < 40 THEN
               Set dimmer to 40
       Else If dimmer level of light is ≥40 and dimmer level  < 60 THEN
               Set dimmer to 60
       Else If dimmer level of light is ≥60 and dimmer level  < 80 THEN
               Set dimmer to 80
       Else If dimmer level of light is ≥80 and dimmer level  < 100 THEN
               Set dimmer to 100
       Else If dimmer level of light is = 100
               Set dimmer to 20

But you could do this with as many "bumps" as you wanted. The trick is to make sure that you dimmer is on a quick transition time so that it reads out on the hub at the new level as quickly as possible. Other wise you are waiting for the dimmer to report back to Hubitat what it's new level is so you can press the button again.

I've actually found myself creating more scenes and using voice control to get the levels exactly where I want them more and more recently. Button controllers just aren't cutting it for me lately.

1 Like

While I'm here, is there a way to enter the cascading IF statement directly (ie, in a text field), instead of the interface (ie, clicking "add condition" and all that) ? Would be 1000x times easier.

Nope...have to use the drop-downs.

Thanks for the code, this works well for me... I can't figure out how to tie "Start Level Change" to a button, it doesn't seem to be a choice in RM...

Also, can you provide some insight into how I can apply this to a group?? The above code works great for an individual light, but I can't seem to get it to work for a group... Any help greatly appreciated!!!

It is under the dimmer control. There is start raising dimmer level and start lowering dimmer level and stop changing dimmer level.

It would work the exact same way.