Ok, you want to use scripts to get this working. I have an example of a timed door that you may be able to piece apart. 1 timer required 2 scripts and 1 automation if my memory serves me:
automation:
- alias: Entry light trigger on entry door
trigger:
- platform: state
entity_id: sensor.entry_door_hindge
to: 'open'
condition:
- condition: state
entity_id: sun.sun
state: "below_horizon"
action:
- service: homeassistant.turn_on
entity_id: script.timed_entry
the scripts:
script:
alias: Turn on Entry Lights for 2 Minutes
sequence:
# Cancel ev. old timers
- service: script.turn_off
data:
entity_id: script.entry_timer_off
- service: switch.turn_on
data:
entity_id: switch.entry_s_switch_17_0
# Set new timer
- service: script.turn_on
data:
entity_id: script.entry_timer_off
alias: Start New Entry Light Timer
sequence:
- delay:
minutes: 2
- service: switch.turn_off
data:
entity_id: switch.entry_s_switch_17_0
When the automation calls the first script, the first script calls a timer-script that shuts it off after 2 minutes. This code was copied from separate config files so the spacing is probably off. You may need to adjust that. But the principle is the same.
Every hour call an automation:
The script starts a timer that last 5 minutes.