Running a script for only a single hour of the day

I would like to know if there is any way to run a script every day for only one hour. So lets say at 7am it starts and it runs it every minute until 8am and just keeps the last value as a static value.

Off the top of my head, why not just use a timer script on the gateway that runs every minute, and checks the time to see if it's between the times you're wanting, and if it is, executes the script, and if not, it just does nothing.

1 Like

A gateway scheduled script can do it, probably a bit easier:
crontab.guru

How would I check the times? do you think you can provide an example script!

Alternative using gateway events:

3 Likes

@Transistor has probably the best method, but the script to check if it's the hour you want would be something like this:

if system.date.getHour24(system.date.now()) == 7:
    # Put your logic here