Max timer (restart if required) on thermostat

In order to avoid freezing / overburning the AC/heater… I’m looking to implement some logic straight in Velbus (dont want to rely on external components for this)…

In short…

When the Cooler or Heater channel goes on, I want the AC/heater to switch on and in the back a timer started. That timer essentially states: 1hr maximum ON

After 1 hr, if the channel is still on (from thermostat perspective) I want to switch OFF the cooler / heater relay for 30 minutes

If after 30 minutes the Cooler/Heater demand (from thermostat) is still present, the cooler/heater relay should switch on again, but if the cooler/heater demand is off, the relay does not go on (resume).

What is the best way to implement this?