Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- blueprint:
- name: deCONZ - IKEA remote All-In-One
- description: |
- This blueprint utilize a IKEA five button (puck) remote to control a group of lights individually.
- REQUIREMENTS:
- ------------------------------------------------------------------------------------------------------------------------------------------------------
- Due to limitations in Blueprints and Home Assistant, you will need the following:
- + A Group combining the lights (https://www.home-assistant.io/integrations/group/)
- + A input_select with a single element with af value of "null", "void" or "empty".
- HOW THE REMOTE WORKS:
- ------------------------------------------------------------------------------------------------------------------------------------------------------
- LEFT AND RIGHT:
- With a short press on either the left/right arrow, you will be able to switch between the light in the group. The current selected light give a short flash indicating your selection.
- DIM UP OR DOWN:
- Short press will in/decrease brightness with the specified step in percent and short transition time.
- Long pres will in/decrease brightness continuesly using a specified long transition time.
- POWER:
- Short press toggles the selected light
- Long press turns on ALL lights in the group at 100%
- HOW THE AUTOMATION WORKS:
- ------------------------------------------------------------------------------------------------------------------------------------------------------
- We listen on "deconz_event" and extract the numeric representation of the pressed button and duration.
- At the very first run, the input_select is populated with the entities stored in the group. We are using a input_select to ease the swithing between light entities.
- Secondly we choose the appropriate action from the given event.
- source_url: https://github.com/J-Lindvig/HomeAssistant/blob/master/blueprints/automation/J-Lindvig/all_in_remote.yaml
- domain: automation
- input:
- remote:
- name: Remote
- description: IKEA five button remote to use
- selector:
- device:
- integration: deconz
- manufacturer: IKEA of Sweden
- model: TRADFRI remote control
- light:
- name: Light(s)
- description: The group (not light group) containing the lights
- selector:
- entity:
- domain: group
- group:
- name: Control list
- description: "The input_select to store lights. MUST HAVE A SINGLE ELEMENT WITH VALUE 'null', 'void' or 'empty'"
- selector:
- entity:
- domain: input_select
- dim_step_pct:
- name: Step
- description: Step, in percent, to de- or increase brightness
- default: 20
- selector:
- number:
- min: 5.0
- max: 100.0
- mode: slider
- step: 5.0
- unit_of_measurement: "%"
- short_press_transition:
- name: Transition short
- description: Transtion time used when doing a short press
- default: 0.5
- selector:
- number:
- min: 0.0
- max: 2.0
- mode: slider
- step: 0.1
- unit_of_measurement: "seconds"
- long_press_transition:
- name: Transition long
- description: Transtion time used when doing a long press (0 - 100%)
- default: 30
- selector:
- number:
- min: 5.0
- max: 50.0
- mode: slider
- step: 1.0
- unit_of_measurement: "seconds"
- mode: restart
- max_exceeded: silent
- variables:
- light_group: !input light
- group: !input group
- dim_step_pct: !input dim_step_pct
- short_press_transition: !input short_press_transition
- long_press_transition: !input long_press_transition
- deconz_data_str: "{'on': True, 'bri_inc': 254, 'transitiontime': 12345}"
- trigger:
- - platform: event
- event_type: deconz_event
- event_data:
- device_id: !input remote
- action:
- - variables:
- event: "{{ trigger.event.data.event }}"
- list: "{{ state_attr(light_group, 'entity_id') }}"
- light: "{{ states(group) }}"
- - choose:
- # INIT
- # This is the initial run - fill the input_select with the entities from the group
- - conditions: "{{ light | lower in ('null', 'void', 'empty') }}"
- sequence:
- - service: input_select.set_options
- data:
- entity_id: "{{ group }}"
- options: "{{ list | tojson }}"
- - choose:
- # LEFT OR RIGHT
- # Find the previous or next light and give it a short flash
- - conditions: "{{ event in (4002, 5002) }}"
- sequence:
- - service: "input_select.select_{{ 'previous' if event == 4002 else 'next' }}"
- data:
- entity_id: "{{ group }}"
- - variables:
- light: "{{ states(group) }}"
- - repeat:
- count: 2
- sequence:
- - delay:
- milliseconds: 500
- - service: light.turn_off
- data:
- entity_id: "{{ light }}"
- - delay:
- milliseconds: 500
- - service: light.turn_on
- data:
- entity_id: "{{ light }}"
- brightness_pct: 100
- # SHORT PRESS POWER
- # Toggle the choosen light
- - conditions: "{{ event == 1002 }}"
- sequence:
- - service: light.toggle
- data:
- entity_id: "{{ light }}"
- # LONG PRESS POWER
- # Turn on all lights
- - conditions: "{{ event == 1001 }}"
- sequence:
- - service: light.turn_on
- data:
- entity_id: "{{ light_group }}"
- transition: "{{ short_press_transition }}"
- # SHORT PRESS UP OG DOWN (DIMMING IN STEPS)
- # Dim the choosen light up or down
- - conditions: "{{ event in (2002, 3002) }}"
- sequence:
- - service: light.turn_on
- data:
- entity_id: "{{ light }}"
- brightness_step_pct: "{{ ( dim_step_pct | int ) if event == 2002 else (0 - ( dim_step_pct | int )) }}"
- transition: "{{ short_press_transition }}"
- # LONG PRESS UP (FLOW DIMMING)
- - conditions: "{{ event in (2001, 3001) }}"
- sequence:
- - service: light.turn_on
- data:
- entity_id: "{{ light }}"
- - repeat:
- while: []
- sequence:
- - service: light.turn_on
- data:
- entity_id: "{{ light }}"
- brightness: >-
- {%- set brightness = state_attr(light, 'brightness') | int %}
- {%- set step = (254 / (long_press_transition | int)) | round(0, 'floor') %}
- {% if event == 3001 %}
- {% set step = 0 - step %}
- {% endif %}
- {{ state_attr(light, 'brightness') | int + step }}
- - delay: 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement