Suggestion for solving an automation

Hi,

I have a button that toggles a fan; the automation is done with the UI. I need to change it so that the toggle feature remains, but when the fan toggles ON must switch off after a delay, if not toggled OFF again by the button push.

I have done this automation on ST using WebcoRE but struggling with YAML.
Do you guys have a suggestion to put me in the right direction?

trigger:
  platform: state
  entity_id: switch.your_fan
  to: on
  for:
    seconds: 7 # or whatever delay you want 
action:
  service: switch.turn_off
  entity_id: switch.your_fan

Thanks tom_I, it works!

1 Like

No problem.There’s a button under my post to mark it as the solution. By doing this you may help people searching in future.

1 Like