diff --git a/automations.yaml b/automations.yaml index 079ccc3..3abe39e 100644 --- a/automations.yaml +++ b/automations.yaml @@ -1,36 +1,57 @@ alias: "Terminal Bramy - Obsługa" +description: "Weryfikacja tagów i sterowanie diodami oraz ekranem" + 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 + 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