#Change state of a helper-Switch depending on the entries of a calendar

1 messages · Page 1 of 1 (latest)

plucky cairn
#

What I have:

  • local HA Calendar with 2 possible entries or none per day ,

What I need

  • entry A exists -> switch A on, else off
  • entry B exists -> switch B on, else off
  • change in the calender -> check for entries, apply above logic
tall dome
#

What is the issue?

plucky cairn
#

I tried automations, scripts and using google to find a solution but no luck

tall dome
#

Show your automation config

plucky cairn
#
alias: Calendar to Event
description: ""
triggers:
  - trigger: state
    entity_id:
      - calendar.presence
conditions: []
actions:
  - if:
      - condition: state
        entity_id: calendar.presence
        attribute: message
        state: Person_1
    then:
      - action: input_boolean.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.person1
    else:
      - action: input_boolean.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.person1
  - if:
      - condition: state
        entity_id: calendar.presence
        attribute: message
        state: Person_2
    then:
      - action: input_boolean.turn_on
        metadata: {}
        data: {}
        target:
          entity_id:
            - input_boolean.person2
    else:
      - action: input_boolean.turn_off
        metadata: {}
        data: {}
        target:
          entity_id:
            - input_boolean.person2
mode: single```