I have got my local cal o show days until an event, but I would like to add some contextual information. So for Example, my Garbage is “Today” however, I am currently only getting 0 as the countdown.
|-
{{ (state_attr('calendar.bin_collection', 'start_time') | as_timestamp - today_at('00:00') | as_timestamp) / (60 * 60 * 24) }}
{% if days == 0 %}
Today
{% elif days == 1 %}
Tomorrow
{% else %}
{{ days }} days
{% endif %}
I would also like to pull the name out as well, instead of a static card title.
The example you posted relies on inspecting the attributes of calendar.bin_collection and assumes they contain information about the next scheduled event. However, it may not always report information about the next scheduled event.
If you have an All Day event, it will supercede all other scheduled events for that day. In other words, the calendar’s attributes will contain information about the All Day event and nothing else.
If you have two events scheduled at the same time, only one will be reported in the calendar’s attributes.
If you are certain that your calendar will never contain All Day events or concurrent events, then you can continue to use the technique you’re using. Otherwise you should consider using a Calendar Trigger or the new calendar.list_events service call.
So what you are implying is that the Calendar never contains two All Day events on the same day? For example, because your Calendar only tracks one kind of collection (Recycling or Trash but not both) or it does track more than one kind but they’re never on the same day.