Hi there,
I’ve set up a template sensor which uses the temperature in our baby’s nursery and tells us what she should wear to bed (e.g. if it’s under 19% then she should wear a 1 tog sleeping bag, a sleep suit and a short sleeve vest).
At the moment, I then have an entity card which lists the items that she should wear dependent on the temperature. Works great, although, I’d rather have images displaying to make it easier to view on my wall dashboard.
I have added attributes to the bottom of the template sensor with images for each combination of clothes, but I’m not sure if I’ve done it right as I cannot get it to display.
Can anyone help?
Here is my current template sensor:
template:
- sensor:
- name: "What Should Josie Wear to Bed?"
unique_id: sensor_josie_pjs
icon: mdi:tshirt-crew
state: >-
{% set temp = states('sensor.bedroom_temperature_sensor_temperature') | float %}
{% if temp <= 16 %}
2 tog bag, Sleep suit, Long sleeve, Socks, Mittens, Hat
{% elif temp <= 17 %}
2 tog bag, Sleep suit, Long sleeve, Socks
{% elif temp <= 19 %}
1 tog bag, Sleep suit, Long sleeve
{% elif temp <= 21 %}
1 tog bag, Sleep suit, Short sleeve
{% elif temp <= 23 %}
0.5 tog bag, Sleep suit
{% elif temp <= 25 %}
0.5 tog bag, Short sleeve
{% else %}
Short sleeve
{% endif %}
attributes:
image: >-
{% if temp <= 16 %}
/local/www/josie/2-tog-bag,-Sleep-suit,-Long-sleeve,-Socks,-Mittens,-Hat.png
{% elif temp <= 17 %}
/local/www/josie/2-tog-bag,-Sleep-suit,-Long-sleeve,-Socks.png
{% elif temp <= 19 %}
/local/www/josie/1-tog-bag,-Sleep-suit,-Long-sleeve.png
{% elif temp <= 21 %}
/local/www/josie/1-tog-bag,-Sleep-suit,-Short-sleeve.png
{% elif temp <= 23 %}
/local/www/josie/0.5-tog-bag,-Sleep-suit.png
{% elif temp <= 25 %}
/local/www/josie/0.5-tog-bag,-Short-sleeve.png
{% else %}
/local/www/josie/Short-sleeve1.png
{% endif %}
availability: "{{ 'sensor.bedroom_temperature_sensor_temperature' | has_value }}"