Trying to set up a specific automation pattern

Hey everyone, I’m pretty new to all this automation stuff. I have a specific plug that I want to turn on for X amount of hours but turn off for 10 minutes every 5 hours. Is this at all possible with Home Assistant automations?

There are a few ways to do this here is one method: Automation Device on x minutes off y minutes - #2 by Didgeridrew

1 Like

Thank you for this. This is the current automation I’m using for my switch.

alias: Switch Timer
description: ""
trigger:
  - platform: state
    entity_id:
      - switch.living_room_tv
    to: "on"
    for:
      hours: "{{ states.input_number.break_in_switch_time.state | int }}"
      minutes: 0
      seconds: 0
condition: []
action:
  - service: switch.turn_off
    data: {}
    target:

I’d like to integrate your script with this one. Currently the way I set my timer is a slider card, I’d like to keep this part the same. Basically I just want the switch to turn off every 5 hours for 10 minutes if it’s on. This switch is controlling a machine that runs for different durations.

Basically, say I want the switch to be on for 34 hours but every 5 hours I want it to shut off so it doesn’t over heat. Is there a way to script it so that when it turns back on the timer wont restart.

Can you clarify what you mean?

So say I want it to run for 36 hours. I want it to turn off for 10 minutes every 5 hours but I want the 36 hour timer to resume from wherever it left off before that 5 hour mark. Hopefully that makes sense.

36 > 5 hour mark 10 minute off state then back on > 31 hours remaining.

How will you be triggering the long cycle?

What happens at the end of the long cycle?

Triggering it with a toggle entity card and after the long cycle it just shuts off until I manually start it again.