Guest User

Untitled

a guest
Sep 21st, 2025
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. blueprint:
  2. name: TS004F Button with Rotation (ZHA)
  3. description: Control single light and room via TS004F button and rotation events.
  4. domain: automation
  5. input:
  6. remote:
  7. name: ZHA Device
  8. description: TS004F device to use
  9. selector:
  10. device:
  11. integration: zha
  12. model: TS004F
  13. multiple: false
  14. lamp:
  15. name: Luz objetivo
  16. description: Luz controlada por pulsaciones y rotación
  17. selector:
  18. entity:
  19. domain: light
  20. room:
  21. name: Luces de la sala
  22. description: Grupo o lista para doble y larga pulsación
  23. selector:
  24. target:
  25. entity:
  26. domain: light
  27.  
  28. mode: restart
  29.  
  30. triggers:
  31. - trigger: event
  32. event_type: zha_event
  33. event_data:
  34. device_id: !input remote
  35.  
  36. variables:
  37. single_light: !input lamp
  38. room_lights: !input room
  39.  
  40. actions:
  41. - choose:
  42. # Pulsación corta
  43. - conditions:
  44. - condition: template
  45. value_template: "{{ trigger.event.data.command == 'remote_button_short_press' }}"
  46. sequence:
  47. - action: light.turn_on
  48. target: !input lamp
  49. # Doble pulsación
  50. - conditions:
  51. - condition: template
  52. value_template: "{{ trigger.event.data.command == 'remote_button_double_press' }}"
  53. sequence:
  54. - action: light.turn_on
  55. target: !input room
  56. # Pulsación larga
  57. - conditions:
  58. - condition: template
  59. value_template: "{{ trigger.event.data.command == 'remote_button_long_press' }}"
  60. sequence:
  61. - action: light.turn_off
  62. target: !input room
  63. # Rotación derecha (right) solo si luz encendida
  64. - conditions:
  65. - condition: template
  66. value_template: >
  67. {{ trigger.event.data.command == 'right' and is_state(single_light, 'on') }}
  68. sequence:
  69. - action: light.turn_on
  70. target:
  71. entity_id: !input lamp
  72. data:
  73. brightness_step: 15
  74. # Rotación izquierda (left) solo si luz encendida
  75. - conditions:
  76. - condition: template
  77. value_template: >
  78. {{ trigger.event.data.command == 'left' and is_state(single_light, 'on') }}
  79. sequence:
  80. - action: light.turn_on
  81. target:
  82. entity_id: !input lamp
  83. data:
  84. brightness_step: -15
Advertisement
Add Comment
Please, Sign In to add comment