Will a time based automation run forever?

Hello there,

I’m very new to the world of home automation and have recently set up some very simple automations for some roller shutters.

The shutter will open 50% at sunrise, and then close completely at a specific time, say 10am.

I’m am running ZigBeemqtt.

I set up a shutter to do so, and it worked correctly one day. The next, it didn’t work and it looked like the automation didn’t run either (although this could be me not interpreting it correctly). My question is, do time based automations run forever, or do they happen once and then HA considers them completed?

If so, how do I set up a loop for infinity?

Thank you in advance

Forever is a very long time but yes. Your automation should continue to trigger every day.

To see why the automation did not do what you expected have a look at the automation traces. See:

If you post your automation here on the forum (and correctly format it) we might be able to spot what is wrong.

Can you share your automation?

Hi guys,

This is what I have for raising the shutter based on sunrise:

alias: Shutter Up
description: ""
trigger:
  - platform: sun
    event: sunrise
    offset: "00:10:00"
condition: []
action:
  - device_id: 58a1d726e9a770dbad7e982f606880e9
    domain: cover
    entity_id: ecf8b44d85b3ee4d83070625a0be15fd
    type: set_position
    position: 50
mode: single

For lowering the shutter, I have:

alias: Shutter Close
description: ""
trigger:
  - platform: time
    at: "10:00:00"
condition: []
action:
  - device_id: 58a1d726e9a770dbad7e982f606880e9
    domain: cover
    entity_id: ecf8b44d85b3ee4d83070625a0be15fd
    type: close
mode: single

It’s very simple, so I am trying to learn the basics before I add conditions etc.

Thank you

Not knowing where in the world you are, there could be a problem if 10-mins-after-Sunrise occurs after 10am.

Hi jchh,

No that’s not a problem in my side of the world.
Does anything stand out as incorrect?

Cheers

On second thoughts, am I right in saying that sunrise is calculated based on where I have set my home location?

nothing obvious, no. If it worked once, it should continue working.

I don’t have shutters and I try to avoid using the device_id (I prefer only entity_id), but that’s just me

yes, it is. I imagine if you are closer to the (ant)artic circle this would become an issue.

edit: where is your home location? …you can check your sunrise by going to developer toolsstates and type in sun.sun (assuming it is the sun integration you are using).

I’m in NSW Australia.
I presume the time is in UTC?

G’day :slight_smile:
yes, you should be able to see your local offset. Mine is:

2023-10-04T12:24:39.293985+01:00

and the +01:00 is my offset to UTC (currently in British Summer time).

…lived in Australia for 6 years - say Hi to it :+1:


Edit: btw, I use the sun2 HACS as it has nicer sensors to sun.sun eg: sensor.dawn, sensor.dusk etc.

Australia says hello back!

I don’t see anything wrong with my sunrise values.

I guess I’ll monitor it over the next few days and report back.

It may be worth checking what your logs say around the time that the automations should run - might show something.