script:
notify_train_status:
sequence:
- service: notify.notify
data:
title: "Tåg till jobb"
message: >
Tåg till jobb är {{ '' }}
{%- if is_state('sensor.to_work', 'delayed') -%}
försenat med
{{ states.sensor.to_work.attributes.number_of_minutes_delayed }}
minuter
{%- elif is_state('sensor.to_work', 'canceled') -%}
inställt
{%- else -%}
i tid
{%- endif -%}
{%- if states.sensor.to_work.attributes.other_information -%}
, övrig information: {{ states.sensor.to_work.attributes.other_information }}
{%- endif -%}
{%- if states.sensor.to_work.attributes.deviations -%}
, avvikelser: {{ states.sensor.to_work.attributes.deviations }}
{%- endif -%}
.
data:
icon: "https://materialdesignicons.com/api/download/B6E1232A-3A43-4200-BE34-1BC436B34BF1/FFFFFF/1/FFFFFF/0/128"
I need to replace all references of sensor.to_work
with a variable how would the syntax for that look?