Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- input_select:
- light_armadio_color:
- name: Colori strip armadio
- icon: mdi:palette
- options:
- - "[255, 0, 0]"
- - "[255, 255, 0]"
- - "[0, 255, 0]"
- - "[0, 255, 255]"
- - "[0, 0, 255]"
- - "[255, 0, 255]"
- - "[255, 255, 255]"
- light_strip_cameretta_erica_color:
- name: Colori strip cameretta Erica
- icon: mdi:palette
- options:
- - "[128, 0, 255, 0]"
- - "[255, 0, 0, 0]"
- - "[255, 255, 0, 0]"
- - "[0, 255, 0, 0]"
- - "[0, 255, 255, 0]"
- - "[0, 0, 255, 0]"
- - "[255, 0, 255, 0]"
- - "[0, 0, 0, 255]"
- automation:
- # Telecomando cameretta Erica
- - id: a2f50e8a-09bd-42bc-9533-59a0ec315e05
- alias: 'Luci - Azione - Telecomando cameretta Erica'
- trigger:
- - platform: event
- event_type: zha_event
- event_data:
- device_ieee: "xx:xx:xx:xx:xx:xx:xx:xx"
- action:
- - variables:
- command: "{{ trigger.event.data.command }}"
- args: "{{ trigger.event.data.args }}"
- light_dest: switch.abat_jour_mansarda
- input_color: input_select.light_strip_cameretta_erica_color
- rgbw: "{{state_attr(light_dest, 'rgbw_color')}}"
- - alias: "A seconda del tasto premuto"
- choose:
- # Click su ON quando abat jour e strip sono accese (cambio colore)
- - conditions: "{{ command == 'on' and is_state('light.strip_cameretta_erica', 'on') }}"
- sequence:
- - service: input_select.select_next
- target:
- entity_id: "{{ input_color }}"
- - service: light.turn_on
- target:
- entity_id: light.strip_cameretta_erica
- data:
- rgbw_color: "{{ states(input_color) }}"
- # Se tenuto premuto l'ON oppure click su ON con abat jour accesa da oltre 1 secondo
- - conditions: "{{ command == 'move_with_on_off' or (command == 'on' and is_state('switch.abat_jour_mansarda', 'on') and (now() - states.switch.abat_jour_mansarda.last_changed).total_seconds() > 0.5)}}"
- sequence:
- - alias: "Accende strip cameretta Erica"
- service: light.turn_on
- target:
- entity_id: light.strip_cameretta_erica
- # Se tenuto premuto l'OFF oppure click su OFF con abat jour spenta da oltre 1 secondo
- - conditions: "{{ command == 'move' or (command == 'off' and is_state('switch.abat_jour_mansarda', 'off') and (now() - states.switch.abat_jour_mansarda.last_changed).total_seconds() > 0.5)}}"
- sequence:
- - alias: "Spegne strip cameretta Erica"
- service: light.turn_off
- target:
- entity_id: light.strip_cameretta_erica
- - alias: "Spegne Abat Jour (serve su pressione prolungata)"
- service: switch.turn_off
- target:
- entity_id: switch.abat_jour_mansarda
- # Telecomando RGB armadio camera
- - id: 12c75001-291f-41db-8b56-978143118402
- alias: 'Gestione telecomando luce RGB camera'
- mode: restart
- trigger:
- - platform: event
- event_type: zha_event
- event_data:
- device_ieee: 'xx:xx:xx:xx:xx:xx:xx:xx'
- action:
- - variables:
- command: "{{ trigger.event.data.command }}"
- args: "{{ trigger.event.data.args }}"
- light_dest: light.luce_armadio
- input_color: input_select.light_armadio_color
- rgbw: "{{state_attr(light_dest, 'rgbw_color')}}"
- - choose:
- # ON/OFF
- - conditions: "{{ command == 'toggle' }}"
- sequence:
- # Determino se la luce è accesa
- - choose:
- - conditions: "{{ is_state(light_dest, 'on') }}"
- sequence:
- # Se la luce è accesa la spengo
- - service: light.turn_off
- target:
- entity_id: "{{ light_dest }}"
- default:
- # La luce è spenta, quindi la devo accendere ma lo faccio diversamente se fuori è buio o no
- - choose:
- - conditions: "{{ state_attr('sun.sun', 'elevation') < -6 }}"
- sequence:
- # Fuori è buio: accendo la luce tenue
- - service: input_select.select_option
- target:
- entity_id: "{{ input_color }}"
- data:
- option: "[0, 0, 255]"
- - service: light.turn_on
- target:
- entity_id: "{{ light_dest }}"
- data:
- color_name: blue
- white_value: 0
- brightness: 10
- default:
- # Fuori è chiaro: accendo la luce più forte
- - service: input_select.select_option
- target:
- entity_id: "{{ input_color }}"
- data:
- option: "[0, 255, 0]"
- - service: light.turn_on
- target:
- entity_id: "{{ light_dest }}"
- data:
- color_name: green
- white_value: 255
- brightness: 255
- # Luminosità up hold (aumenta luminosità RGB)
- - conditions: "{{ command == 'move_with_on_off' }}"
- sequence:
- repeat:
- while: "{{ repeat.index <= 10 }}"
- sequence:
- - service: light.turn_on
- target:
- entity_id: "{{ light_dest }}"
- data:
- brightness_step_pct: 10
- - delay: 1
- # Luminosità down hold (diminuisce luminosità RGB)
- - conditions: "{{ command == 'move' }}"
- sequence:
- repeat:
- while: "{{ repeat.index <= 10 }}"
- sequence:
- - service: light.turn_on
- target:
- entity_id: "{{ light_dest }}"
- data:
- brightness_step_pct: -10
- - delay: 1
- # Luminosità up click (white on)
- - conditions:
- - "{{ command == 'step_with_on_off' }}"
- - "{{ args == [0, 43, 5] }}"
- sequence:
- - service: light.turn_on
- target:
- entity_id: "{{ light_dest }}"
- data:
- rgbw_color: ["{{rgbw[0]}}", "{{rgbw[1]}}", "{{rgbw[2]}}", 255]
- # Luminosità down click (white off)
- - conditions:
- - "{{ command == 'step' }}"
- - "{{ args == [1, 43, 5] }}"
- sequence:
- - service: light.turn_on
- target:
- entity_id: "{{ light_dest }}"
- data:
- rgbw_color: ["{{rgbw[0]}}", "{{rgbw[1]}}", "{{rgbw[2]}}", 0]
- # Rilascio luminosità up/down
- - conditions: "{{ command == 'stop' }}"
- sequence:
- - service: light.turn_on
- target:
- entity_id: "{{ light_dest }}"
- # right
- - conditions:
- - "{{ command == 'press' }}"
- - "{{ args == [256, 13, 0] }}"
- sequence:
- - service: input_select.select_next
- target:
- entity_id: "{{ input_color }}"
- - service: light.turn_on
- target:
- entity_id: "{{ light_dest }}"
- data:
- rgb_color: "{{ states(input_color) }}"
- # left
- - conditions:
- - "{{ command == 'press' }}"
- - "{{ args == [257, 13, 0] }}"
- sequence:
- - service: input_select.select_previous
- target:
- entity_id: "{{ input_color }}"
- - service: light.turn_on
- target:
- entity_id: "{{ light_dest }}"
- data:
- rgb_color: "{{ states(input_color) }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement