#button hold to start dim until release - how?

1 messages · Page 1 of 1 (latest)

narrow eagle
#

I got this blueprint for my 4-button switch (https://gist.github.com/vandalon/d2a327297d579b304549e96c66765992) and i already configured it to turn on and off 2 different lights. There are also options for holding a button for which i want the lights to dim and i got it working with one of the lights, but only because that light is zigbee and communicates using MQTT, so i can send a 'move' MQTT message that makes it start dimming.
The other light is connected to a shelly dimmer 2 (wifi). The shelly is dimmable, the light is dimmable and i can command it to dim to say 40% or 80%. But what if i just want to make it start dimming at a specific pace, either up or down, until i release the button again. How do i do that in automations? I don't have much experience (or success) with coding in raw yaml, i only use the GUI.

Gist

z2m EnOcean PTM 215Z (Friends of Hue) switch.yaml. GitHub Gist: instantly share code, notes, and snippets.

obtuse wyvern
#

You can do basically the same thing with templates

action: light.turn_on
entity_id: light.my_shelly_dimmer_2
data:
  brightness: "{{ min(state_attr('light.my_shelly_dimmer_2', 'brightness') | int + 5, 255) }}"
  brightness: "{{ max(state_attr('light.my_shelly_dimmer_2', 'brightness') | int - 5, 0) }}"

Top value is for brightening, bottom is for darkening, the min and max prevent you from setting the brightness outside of the range 0-255

narrow eagle
#

Thanks! How do i use that in my blueprint?

#

oh, i need to make a template!

#

Can ou tell me which one?

obtuse wyvern
#

i've never used that blueprint but it looks like you can just define arbitrary actions for button_X_held?

#

you don't need to make a template

narrow eagle
#

how? what am i looking for?

obtuse wyvern
#

click on add action

#

action: light.turn_on

#

point it at your shelly dimmer

#

and add the brightness to the data

narrow eagle
#

alright

#

naah wait, that just gives it a set percentage of brightness

#

what i want is to hold down the button and then it seamlessly increases the brightness until i release and then it stays on that brightness. Same with other button and then decrease

obtuse wyvern
#

Edit the yaml and put that template in instead

#

Change the name to be whatever your shelly is called

#

Then it makes the hold message be "set the new brightness to be X more than the current brightness"

narrow eagle
#

doesnt work

#

for some reason

obtuse wyvern
#

Read up a little bit: change the name in the template to be whatever your shelly is actually called

narrow eagle
#

that is what it is actually called

obtuse wyvern
#

OK. So change it to that

narrow eagle
#

Like shown in the previous screenshot i sent you, it already is that

obtuse wyvern
#

In the brightness template it is not

narrow eagle
#

oh