Use entity attribute in time format as trigger in automation

Hi, I want to make a input boolean switch and turn the switch on/off when there is loadshedding at my house. I am using the Loadshedding Status integration which provides a entity, calendar.loadshedding_local_schedule, with an attribute, start_time and end_time, indicating the start and end of loadshedding.

My idea is to use the start time and end time as a variable in an automation trigger to then turn the input boolean on/off. My initial idea to use a different entity attribute failed as I discovered that the attribute does not actually change when there is loadshedding, referring to sensor.loadshedding_local_status entity with attribute, Currently Loadshedding.

The format of the start time and end time:
start_time: 2022-12-30 22:00:00
end_time: 2022-12-31 00:30:00

Any help would be greatly appreciated!

Use a Calendar Trigger in your automation.

alias: example
trigger:
  - platform: calendar
    event: start
    entity_id: calendar.loadshedding_local_status
condition: []
action:
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.status

Thank you, I was completely unaware of the calendar trigger.

1 Like