I resolved my issue. Stupidly I had another automation that I used for testing turning it off. Check on the entity to see what automation are linked to it. Here’s what works for me.
alias: "Water heater on for 20 minutes "
description: ""
trigger: []
condition: []
action:
- service: water_heater.turn_on
entity_id: water_heater.dhw_controller
alias: Water Heater On
- delay:
hours: 0
minutes: 20
seconds: 0
milliseconds: 0
- service: water_heater.turn_off
entity_id: water_heater.dhw_controller
enabled: true
- service: water_heater.set_operation_mode
data:
operation_mode: auto
target:
entity_id: water_heater.dhw_controller
enabled: true
mode: single