Boiler automation for night tariff and power outages

Hi everyone,
Please help me create an automation. I want to turn on the boiler relay (switch.unknown_switch) for one hour at any time during the night tariff, which is active from 23:00 to 07:00.

Since I live in Ukraine and due to russian attacks, power outages are frequent. I need the automation to activate when the power is restored and the boiler relay is off, not unavailable.

I want the automation to check every hour, and if the relay is off, turn it on, wait an hour, and then turn it off. How can I make the automation trigger only once and not every hour?

A few of my automations have a check to see if the “last triggered” time stamp was NOT today, like this:

  condition:
  - condition: template
    value_template: '{{ now().strftime(''%x'') != as_timestamp(states.automation.my_automation_id.attributes.last_triggered)
      | timestamp_custom(''%D'') }}'

Maybe you can do something similar.

1 Like