Automation: Help with Electric Heating and Hive

Hi
I have a LightwaveRF L92 switch linked to my bathroom electric Towel rail. During the summer I have got the automations to switch on and off at certain times so my towels are warm.
As the rail is the only source of heating in the bathroom I wanted to link it to my Hive system so that when the heating comes on or off the Towel rail also comes on or off.
The following YAML code seems to work a treat

alias: Switch Bathroom on with Hive Heating
description: ""
trigger:
  - platform: state
    entity_id:
      - climate.thermostat_1
    from: null
    to: heat
condition: []
action:
  - type: turn_on
    device_id: 20661aeb559029a0b6f6452edf14a920
    entity_id: 870823c1f1547d60ddaa8d268cff658f
    domain: switch
mode: single

So my question. Sometimes the Hive Heating comes on for a few seconds and then goes off, so I have a lot of switch on and off activities, so what I would like to do is detect when the heating goes on, wait for a period of time and if it stays on then switch the radiator on. Anyone any ideas how I go about that?
My thoughts would be in the Trigger section, something like this.

  • Detect when Hive changes from anything to Heat
  • Wait 2 minutes
  • Detect if hive is still set to heat
  • Switch on

Just wondered if anyone has done this before and can offer any advice?

Thanks in advance

Adam

You can add a time constraint to the trigger like this:

alias: Switch Bathroom on with Hive Heating
description: ""
trigger:
  - platform: state
    entity_id:
      - climate.thermostat_1
    from: null
    to: heat
    for:
      hours: 0
      minutes: 2
      seconds: 0
condition: []
action:
  - type: turn_on
    device_id: 20661aeb559029a0b6f6452edf14a920
    entity_id: 870823c1f1547d60ddaa8d268cff658f
    domain: switch
mode: single

thusassistint
Thanks for that it makes complete sense, I will try it out and let you know.

Thanks for you help thusassistint