Google Calendar allday event offset

Is it possible to see if my calendar is ON - fx. 9 hours from now? and how?

I have this , but it only works on starttime and not all_day

 {% if states.calendar.ferie.attributes.start_time %}
            {{((as_timestamp(states.calendar.ferie.attributes.start_time) - as_timestamp(now())) / 60) | default(99) | int }}
          {%- else -%}
            0
          {%- endif %}

You can use calendar triggers described Calendar - Home Assistant

If you have a more complex automation triggered by something other than the calendar event, you can make a template binary sensor from the event triggers. This is an example searching for an event with a specific name:

- trigger:
    - platform: calendar
      event: start
      entity_id: calendar.device_automation_schedules
      offset: "-24:00:00"
    - platform: calendar
      event: end
      entity_id: calendar.device_automation_schedules
      offset: "-24:00:00"
  binary_sensor:
    - name: Trash Pickup Tomorrow
      state: "{{ iif('Trash Pickup' in trigger.calendar_event.summary, iif(trigger.event == 'start', 'on', 'off'), states('binary_sensor.trash_pickup_tomorrow')) }}"

So then you have a binary sensor you can reference from the automation.

thanks i’ll try it

This is a bit beyond my level of understanding.
Would the following do, meaning to start 45 before sunset on the evening before the calendar (Nellie) and ending 25 hours later, around sunset on the day of the calendar (Nellie) ?
alias: Test Yurzeit
description: ‘’
trigger:

  • platform: calendar
    event: start
    offset: ‘-24:0:0’
    entity_id: calendar.isy_yurzeit_miepie
    condition:
  • condition: sun
    before: sunset
    before_offset: ‘00:45:00’
    action:
  • type: turn_on
    device_id: 8344ee668430672b1dcc17a41b724dda
    entity_id: switch.1_guest_entrance
    domain: switch
  • delay:
    hours: 25
    minutes: 0
    seconds: 0
    milliseconds: 0
  • type: turn_off
    device_id: 8344ee668430672b1dcc17a41b724dda
    entity_id: switch.1_guest_entrance
    domain: switch
    mode: single

SORRY… I made a mistake :slight_smile:
This is a bit beyond my level of understanding.
Would the following do, meaning to start 45 before sunset on the evening before the calendar (Nellie) and ending 25 hours later, around sunset on the day of the calendar (Nellie) ?
alias: Test Nellie
description: ‘’
trigger:

  • platform: calendar
    event: start
    offset: ‘-24:0:0’
    entity_id: calendar.nellie
    condition:
  • condition: sun
    before: sunset
    before_offset: ‘00:45:00’
    action:
  • type: turn_on
    device_id: 8344ee668430672b1dcc17a41b724dda
    entity_id: switch.1_guest_entrance
    domain: switch
  • delay:
    hours: 25
    minutes: 0
    seconds: 0
    milliseconds: 0
  • type: turn_off
    device_id: 8344ee668430672b1dcc17a41b724dda
    entity_id: switch.1_guest_entrance
    domain: switch
    mode: single

The example I have above creates a template binary sensor (Template - Home Assistant) that you can use in other automations combined with other conditions.

I’m having trouble understanding what you’re trying to accomplish.