Hey everyone, I’ve been diving into customizing my smart home setup lately, and I thought I’d share a fun project I’ve been working on. I’ve been experimenting with calendar templates in Home Assistant, specifically trying to change icons based on the event name. It’s been a bit of a learning curve, but I’m really enjoying the process!
So, here’s what I’ve done so far. I set up a template sensor to display calendar events with a custom icon based on the event type. For example, if the event is about trash collection, I want it to show a recycling icon. I’ve got the basic setup working, but the icon change isn’t quite there yet. I’m hoping someone with more template sensor experience can help me spot where I might be going wrong.
Here’s my current configuration:
yaml
- platform: template
sensors:
template_calendar_home_assist:
value_template: >
{{ strptime(states.calendar.home_assist.attributes.start_time, “%Y-%m-%d %H:%M:%S”).strftime(“%A, %d de %B, at %H:%M”) }}: {{ states.calendar.home_assist.attributes.message }}
icon_template: >
{% if is_state(“states.calendar.home_assist.attributes.message”, “Collecte Selective”) %}
mdi:recycle
{% elif is_state(“states.calendar.home_assist.attributes.message”, “Dechets Verts”) %}
mdi:leaf
{% elif is_state(“states.calendar.home_assist.attributes.message”, “Ordures Menageres”) %}
mdi:delete
{% elif is_state(“states.calendar.home_assist.attributes.message”, “Encombrants”) %}
mdi:bed
{% else %}
mdi:cancel
{% endif %}
friendly_name: Trash Type
unit_of_measurement: ‘’
I’m pretty sure the logic is sound, but maybe there’s a syntax issue or something I’m missing. It would be awesome to get this working because it would make my calendar much more visually intuitive!
On a lighter note, I’ve also been exploring some cool new devices, like the Govee RGBIC lights. They’ve been a blast to work with, especially since I can customize their colors to match different themes or occasions. It’s little touches like these that really make a smart home feel personalized.
I’d love to hear if anyone else has tackled similar projects or has tips for troubleshooting template sensors. Let’s keep the ideas flowing!
Cheers,
[Your Name]