Hi all,
Im new here and fairly new to Home Assistant.
I’m trying to add a new sensor based on my Picnic sensor.
Based on it’s status and eta it will give the moment of delivery.
sensor:
- platform: template
sensors:
tr_picnic_test:
value_template: >
{% set yesterdayE = as_timestamp(today_at('23:59') - timedelta(days = 1)) | int %}
{% set todayS = as_timestamp(today_at('00:00')) | int %}
{% set todayE = as_timestamp(today_at('23:59')) | int %}
{% set deliS = as_timestamp(states('sensor.picnic_last_order_eta_start')) | int %}
{% set deliE = as_timestamp(states('sensor.picnic_last_order_eta_end')) | int %}
{% set status = states('sensor.picnic_last_order_status') %}
{% set deliTime = as_timestamp(states('sensor.picnic_last_order_eta_start')) | timestamp_custom('%H:%M', true) + " en " + as_timestamp(states('sensor.picnic_last_order_eta_end')) | timestamp_custom('%H:%M', true) %}
{% set deliTimeExt = as_timestamp(states('sensor.picnic_last_order_eta_start')) | timestamp_custom('%D tussen %H:%M', true) + " en " + as_timestamp(states('sensor.picnic_last_order_eta_end')) | timestamp_custom('%H:%M', true) %}
{% if status == 'COMPLETED' and deliE < yesterdayE %}Gisteren geleverd
{% elif status == 'COMPLETED' and deliE < todayE %}Vandaag geleverd
{% elif status == 'CURRECT' and deliE > todayS %}Vandaag tussen {{deliTime}}
{% elif status == 'CURRENT' %} {{deliTime}}
{% else %}Geen actieve bestelling
{% endif %}
friendly_name: "Picnic TR status"
So far so good.
I however want to change the image of the sensor based on the status. How can I achieve that?