Days until event I google Calendar

Not going hard on you, just trying to get this information:

There are about 800 ways to do a condition. And when you want to get number of days until a calendar event, you need a template. Meaning you can only use a template condition or a template sensor to get that information out. This is all I was trying to get out of you. No one here is a mind reader. You could have wanted to get the number of days to your calendar event and then add 10 days for all I know.


This sensor here will provide number of days until an event, where 0 is today.

sensor:
  - platform: time_date
    display_options:
      - 'date'

  - platform: template
    sensors:
      event_day:
        friendly_name: Event Day
        entity_id: sensor.date
        unit_of_measurement: days
        value_template: >
          {% set midnight = now().replace(hour=0, minute=0, second=0, microsecond=0).timestamp() %}
          {% set event = states('calendar.xxx') | as_timestamp %}
          {{ ((event - midnight) // 86400) | int }}
4 Likes