Advertisement
JLindvig

Long dimming HA-Style

Jan 12th, 2021
1,256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.75 KB | None | 0 0
  1.   # LONG PRESS UP (FLOW DIMMING)
  2.   - conditions: "{{ event in (2001, 3001) }}"
  3.     sequence:
  4.       - service: light.turn_on
  5.         data:
  6.           entity_id: "{{ light }}"
  7.  
  8.       - repeat:
  9.           while: []
  10.           sequence:
  11.             - service: light.turn_on
  12.               data:
  13.                 entity_id: "{{ light }}"
  14.                 brightness: >-
  15.                   {%- set brightness = state_attr(light, 'brightness') | int %}
  16.                   {%- set step = (254 / (long_press_transition | int)) | round(0, 'floor') %}
  17.                   {% if event == 3001 %}
  18.                     {% set step = 0 - step %}
  19.                   {% endif %}
  20.                   {{ state_attr(light, 'brightness') | int + step }}
  21.             - delay: 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement