Adding vacation from a calendar to workday sensor

Hi, since summer vacation is coming a new need is coming as well. Up until now workday sensor have worked nicely. But with a 5 week summer vacation coming up, I would like to have the to act accordingly.
Have anyone managed to pull full-day events from google calendar or similar to identify additional non-working days and added them to the workday sensor?


I made a template sensor;

    friendly_name: Arbetsdag
    value_template: >-
      {{ is_state("binary_sensor.workday", "on")
         and not is_state("calendar.ledig", "on") }}


Hi again,
I just realised You probably meant a bit more, this is what I have in my google_calendars.yaml.

- cal_id: my id
  - device_id: ledig
    name: "Pappa ledig"
    track: true
    search: "Ledig"


Thanks, I get the first part where you combine the workday sensor with the calendar state.

If I spend a few minutes with the google calendar addon, will the second part make sense?

It will, and definately worth the few minutes it takes. I use it for ‘all’ my sensors that schedule stuff, garbage pickup and what not. Made sure my kids converted their soccer practice and school schedules to google and my house now wakes/reminds them for all of that.

Never really liked the offset_reached stuff and instead use template sensors for that as well.

        value_template: >
          {% if as_timestamp(states.calendar.tunnor.attributes.start_time) - as_timestamp( strptime(states.sensor.date__time.state, "%Y-%m-%d, %H:%M" ) ) < 21600  %}on{% else %}off{% endif %}

means that 6 hrs before midnight the day before garbage is picked up early the sensor is on and start nagging me about my trash.

Really great stuff, probably couldn’t live without it!

I’m new here. :slight_smile:
I also tried it like suggested by Johann

  - platform: template 
        friendly_name: Arbeitstag
        value_template: >-
        {{ is_state("binary_sensor.workday", "on") and not is_state("calendar.thomas_urlaub", "on") }}

Also I tried this code, which is basically the same. Also I did some variations.But while checking the conifg I alwas get this error message:

Error loading /config/configuration.yaml: while scanning a simple key
  in "/config/configuration.yaml", line 191, column 9
could not find expected ':'
  in "/config/configuration.yaml", line 194, column 1

Has anyone an idea, what I’m doing wrong?


I think you missed the indentiation of the {{ }}-block.

The answer I hate most since I’m using Home Assistant is “Yes, you can, just make a template sensor”.
Why no native support? Why do I have create 2 or more sensors for one task?

Do we have a native support of workday Integration to add vacations from calendars meanwhile?
Does anyone know?