Lovelace button where hold_action does a 0=>100% brightness & 2nd hold 100=>0%?

Hi

I think the title says it all but to be sure I explain myself: I have seen such a system where holding a physical button would increase brightness as long as you hold.
Tapping would switch off and toggle brings back the previous brightness level.
Holding again would inverse the increase, thus really dimming until released or 0%.

Is this possible, with a automation or a script or any other way?

TIA
Nick

While there is a tap action that you could use to toggle the light and a hold action to begin dimming or brightening there is no release action to stop dimming or brightening. So I can’t see how this could be done.

Hi tom :wink:

I have picked up ‘brightness_decrease’ some time ago from some thread here but that code did something else.
Now I was wondering if this could be used the way I explained.

Even if the light is off, doesn’t increasing the brightness turn it on anyway?
That’s what I experience with the bulbs (filament bulb w. Tasmota & RGB bulb w. Tuya) and the light card.

So some automation/scene/script/… ?could? be used to when holding to go from 0% to 100%.
I imagine that the 0% and 100% can be used as starting state to know whether the brightness should be increased or decreased.
If released in between and held again, for instance always decrease.
Toggling with a tap would go between off and on (with last used dimmed state), this is what happens anyway.

To much imagination? :innocent:

None of that is the issue.

The issue is you can’t tell when the button is released.

There is a tap action and a hold action but no release action.

Reading the original post they state holding a physical button. Now I am unaware of what that button is but it my very well send a release state.

I have done this in Esphome sending a hold event and a release event on a physical button, but through my attempts I have been unable to sort the dimming part.

That would be a different matter. I thought he was talking about a Lovelace button.

Not sure if you already have the dimmers, but if not, look for these QS-WiFi-D01/2 ( also available with 2 ch)

Changed the title to be more clear; I meant a Lovelace (soft) button/card.

@tom_l: you’re right, didn’t realize that the release action is necessary.
So that ‘Momentary button’ what’s needed. (at least for me :grin:)
Strange that this ability has not been implemented before…

I think a release action would be a great addition and hope the PR makes it into the master branch eventually.