Calendar start/stop unable to determine

Hi,

as a newbie to HA, I am trying to set a bool if I am in home office.
Having a calendar with whole day events, I try this (according to https://www.home-assistant.io/integrations/calendar/)

alias: OttoHO_Start
trigger:
  - platform: calendar
    event: start
    entity_id: calendar.urlaube
  - platform: calendar
    event: end
    entity_id: calendar.urlaube
condition:
  - condition: template
    value_template: "{{ 'Otto HO' in trigger.calendar_event.summary }}"
action:
  - if:
      - "{{ trigger.event == 'start' }}"
    then:
      - service: telegram_bot.send_message
        data:
          message: Otto HO Start
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.otto_ho
     else:
      - service: telegram_bot.send_message
        data:
          message: Otto HO Ende
      - service: input_boolean.turn_off
        target:
          entity_id: input_boolean.otto_ho
mode: single

But when trying to save I get:
Message malformed: Unable to determine action
Anyone knows how to solve?
Best regards and thanks in advance,
Otto

you had a number of errors in syntax. i didn’t work on the logic, only the syntax.

are you using the automation ui builder to write your automation? it should have caught all of the errors you had…

i think it’s great that you’re grabbing code from the documentation (heck, you’re using the documentation… hurray!). once you grab the code and put it in the automation creator, then flip it to the ui editor and do your edits of the sample there as much as you can…

flip to yaml mode only when you must and when you want to see proper yaml generated to learn…

:point_down: :slight_smile:

Move else: to the left by one space.

FYI this is valid shorthand for template conditions.

No need for:

See: https://www.home-assistant.io/docs/scripts/conditions/#template-condition-shorthand-notation

1 Like

well… shows my noobness :blush:

Thanks a lot! seems to work now!
I am still having problems with the gosh darn indentations of yaml…

If you use VSCode with the Home Assistant Helper extension it will alert you to indentation issues.