diff --git a/automations.yaml b/automations.yaml new file mode 100644 index 0000000..079ccc3 --- /dev/null +++ b/automations.yaml @@ -0,0 +1,36 @@ +alias: "Terminal Bramy - Obsługa" +trigger: + - platform: event + event_type: tag_scanned + action: + - variables: + v_nazwa: "{{ trigger.event.data.name }}" + - choose: + - conditions: + - condition: template + value_template: "{{ v_nazwa is not none and 'Legitymacja' in v_nazwa }}" + sequence: + - action: input_text.set_value + target: { entity_id: **input_text.terminal_status** } + data: { value: "{{ v_nazwa | replace('Legitymacja ', '') | trim }}" } + - action: light.turn_on + target: { entity_id: light.terminal_brama_terminal_led_zielona } + - action: switch.turn_on + target: { entity_id: switch.terminal_brama_przekaznik_bramy } + - delay: 3 + - action: light.turn_off + target: { entity_id: light.terminal_brama_terminal_led_zielona } + - conditions: + - condition: template + value_template: "{{ v_nazwa is none or 'Legitymacja' not in v_nazwa }}" + sequence: + - action: input_text.set_value + target: { entity_id: **input_text.terminal_status** } + data: { value: "Brak Uprawnień" } + - action: light.turn_on + target: { entity_id: light.terminal_brama_terminal_led_czerwona } + - delay: 3 + - action: light.turn_off + target: { entity_id: light.terminal_brama_terminal_led_czerwona } + mode: restart + \ No newline at end of file