Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- blueprint:
- name: TS004F Button with Rotation (ZHA)
- description: Control single light and room via TS004F button and rotation events.
- domain: automation
- input:
- remote:
- name: ZHA Device
- description: TS004F device to use
- selector:
- device:
- integration: zha
- model: TS004F
- multiple: false
- lamp:
- name: Luz objetivo
- description: Luz controlada por pulsaciones y rotación
- selector:
- entity:
- domain: light
- room:
- name: Luces de la sala
- description: Grupo o lista para doble y larga pulsación
- selector:
- target:
- entity:
- domain: light
- mode: restart
- triggers:
- - trigger: event
- event_type: zha_event
- event_data:
- device_id: !input remote
- variables:
- single_light: !input lamp
- room_lights: !input room
- actions:
- - choose:
- # Pulsación corta
- - conditions:
- - condition: template
- value_template: "{{ trigger.event.data.command == 'remote_button_short_press' }}"
- sequence:
- - action: light.turn_on
- target: !input lamp
- # Doble pulsación
- - conditions:
- - condition: template
- value_template: "{{ trigger.event.data.command == 'remote_button_double_press' }}"
- sequence:
- - action: light.turn_on
- target: !input room
- # Pulsación larga
- - conditions:
- - condition: template
- value_template: "{{ trigger.event.data.command == 'remote_button_long_press' }}"
- sequence:
- - action: light.turn_off
- target: !input room
- # Rotación derecha (right) solo si luz encendida
- - conditions:
- - condition: template
- value_template: >
- {{ trigger.event.data.command == 'right' and is_state(single_light, 'on') }}
- sequence:
- - action: light.turn_on
- target:
- entity_id: !input lamp
- data:
- brightness_step: 15
- # Rotación izquierda (left) solo si luz encendida
- - conditions:
- - condition: template
- value_template: >
- {{ trigger.event.data.command == 'left' and is_state(single_light, 'on') }}
- sequence:
- - action: light.turn_on
- target:
- entity_id: !input lamp
- data:
- brightness_step: -15
Advertisement
Add Comment
Please, Sign In to add comment