📛 Shelly i4 Button Controller by LTek ... with Single Button Dim & Multi-Press Functions

:name_badge: Shelly i4 Button Controller by Ltek

:rocket: Version 2025.10.16.01

✅ Features:
  - Set any HA Action for Button presses (Single, Double, Triple, Down, Up, Long)
  - Single Button Dim any or all buttons (optional)
  - Dim Direction Start Boundary - sets dim direction at start of dim; upward if below, downward if above
  - When Dim Function is Enabled
         - if the Light is OFF, Long press turns on the Light then Dims
         - Basic Actions for Button Up and Long Press are disabled
  - Dim Fine Tuning - Dim % per Step and Step Interval (time delay between steps) allows for you to tune dimming as you'd like

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Tested in my home with a 4-button Legrand low voltage momentary buttons.

3 Likes

Thanks, for sharing your project. Works fine with multiple click usage too.

1 Like

You have impeccable timing. Just installed my i4 + wall plate after weeks of putting it off and this made it far easier to set up than even Shelly’s own solution for controlling shelly lights from an i4. Thanks

1 Like

Hi @Ltek I’ll describe my issue or what I want to see if it can be achieved.

See the image:

I will have several push buttons (normal) connected to a zigbee relay. The relay is also connected to the power supply.

We will have several zigbee lights creating a group and connected to the power suply all time so they are always on zigbee mesh.

What I want is to use the push buttons to toggle the status of the lights and if HA is down been able to switch the lights. I would also be able to toggle lights from HA. Ideally it would be great to change dimming from push buttons but not mandatory. what I want is a fallback in case HA fails, and for my wife and kids for been able to use push buttons.

Thanks!

this blueprint has been tested with Shelly i4 (both DC and gen3) which do not control a load directly, aka ‘detached’. Since Shelly uses the same base code / command set, this BP should work fine for all normal Shelly relays (zigbee, wifi, bluetooth) which have a switch input (I think they all do). I do not have any other Shelly relays to test with so cant verify it.

But this communicates directly with HA, what happens is HA is down @Ltek

I’ve redone the image

If not this blueprint, do you know how can i accomplish this?

as I explained, you need to use a normal Shelly relay, the blueprint will handle syncing with HA, and a normal relay has physical switch inputs. You literally have a diagram that shows exactly that. If your puck lights themselves are ONLY Zigbee, not connected directly to a switch (which is what a relay is) then of course you cant control them when zigbee is not running.

This is very nice, and one small improvement would be the addition of transition time on dimming
e.g.

variables:
...
  button4_dim_transition: !input button4_dim_transition
...
                      data: 
                        brightness_step: "{{ button4_dim_direction }}{{ brightness_step_value }}"
                        transition: "{{ button4_dim_transition }}"

Question: should there be 4 x dimming_active variables? So that multiple inputs can be held at once?
e.g. a button1_dimming_active, button2_dimming_active, etc.

I haven’t tested what happens when multiple inputs are long held yet! :smiling_imp:

(also commented on the gist directly: Home Assistant Blueprint : Shelly i4 Button Controller by Ltek · GitHub)

Hi @ps-jay, not sure what adding a transition variable would accomplish. Shelly i4 devices are not dimmers themselves, thus do not natively support Transition Time. Using the variables Dim % per Step and Step Interval together will control how much light change occurs, over what period of time… thus it somewhat mimics transition time. If you want a button press (not a hold) to do dimming then you can create that in the Action however you want.

I dont know if the i4 is designed to detect simultaneous presses or holds (meaning two or more buttons pressed at exactly the same time can trigger a different events in the device (and be sent to HA). I have not seen mention in the documentation of “simultaneous-press detection” as a separate event.

I can see if anyone on the dedicated Shelly forums/groups know. LMK if you modify the code and get it working.

hope that helps

Hi @Ltek,

Agreed - i4 doesn’t dim by itself - I’d be sending the transition time command to the light bulb (Lifx brand in my case), along with the brightness %

I’ll fork the code, test, and report back :crossed_fingers:

That has nothing to do with the blueprint.
Transition Time is set directly on the Light Entity. Add the Entity to the ‘Basic Actions’ on any button then set the entity properties/values as you’d like…

Nice work! I have a request. Could you elaborate a bit? If I don’t want to use buttons 3 and 4, it won’t work. I’ve modified your blueprint to only show buttons 1 and 2, but could you also add a toggle switch so I can choose which buttons to use? And finally, is there a way to have the lights turn off when I press a single button while the lights are on?

The blueprint works fine no matter how many buttons you want, or not want, to use. For example, you can use Buttons 2,3,4 but not Button 1.

Light Toggle does exactly what you describe…

I did a couple of modifications, and this has been good for me since November: shelly-i4-blueprint · GitHub