Cannot trigger a Boolean input according to calendar event

Hello everyone

I’m new to Home Assistant, and I’m trying to create my first automations, but it’s not easy (the HA docs are difficult to understand sometimes…)

Despite my searches and several attempts to write an automation script, I cannot make a boolean input state change according to a calendar event.

I want that, when I’m not at work (therefore there is a whole day event in my Google calendar named « Absence », or on week-ends or on public holiday, the boolean input «Repos» (« rest » in english) is activated, else (when I’m at work, in working days or regular days), the boolean input is deactivated.

Here are the automations I tried :

1st, based on calendar event :

alias: "Evènement: Absence"
description: ""
trigger:
  - platform: time
    at: "00:00:00"
  - platform: calendar
    event: start
    entity_id: calendar.agenda_perso
condition:
  - condition: or
    conditions:
      - condition: state
        entity_id: calendar.agenda_perso
        attribute: message
        state: Absence
      - condition: state
        entity_id: binary_sensor.workday_sensor
        state: "off"
      - condition: state
        entity_id: calendar.france
        state: "on"
action:
  - target:
      entity_id: input_boolean.absence
    data: {}
    action: input_boolean.turn_on
  - metadata: {}
    data:
      message: Jour non travaillé
    action: notify.info
mode: single

2nd, consisting in 2 single automations ( based on a template according to calendar event summary / 2nd based on workday status or on french public holiday status), each one activating the boolean input :

alias: "Evènement: présence"
description: ""
trigger:
  - platform: calendar
    event: start
    entity_id: calendar.agenda_perso
condition:
  - condition: template
    value_template: "{{ 'absence' in trigger.calendar_event.summary }}"
action:
  - target:
      entity_id: input_boolean.absence
    data: {}
    action: input_boolean.turn_off
mode: single
alias: "Evènement: week-end ou jour férié"
description: ""
trigger:
  - platform: time
    at: "00:00:00"
condition:
  - condition: or
    conditions:
      - condition: state
        entity_id: calendar.france
        state: "on"
      - condition: state
        entity_id: binary_sensor.workday_sensor
        state: "off"
action:
  - target:
      entity_id: input_boolean.wejf
    data: {}
    action: input_boolean.turn_on
mode: single

I really thought the 2nd strategy would work, but it’s not the case…

Moreover, how can I force the boolean input deactivated when none of the conditions are met ?

Thank you for your help…

i think you have a fundamental misunderstanding about triggers and conditions.

home assistant automation get triggered when the trigger event goes from being false to true. then it checks the conditions to see if it should proceed to the actions.

Since you are starting, I think you would benefit greatly from looking at the automation section of this:

Thank you so much. Indeed, beginning with Home Assistant is quite more difficult than Jeedom that I was using before… But I it’s it’s worth the work
I’m going to study the guide you put in link. Thank you.

great… holler if you have questions, if anything there doesn’t make sense.