Sonoff + Dallas water heater

I am looking for a solution to heat water.
I would like the program to start after pressing key

binary_sensor:

  • platform: gpio
    pin:
    number: GPIO0
    mode: INPUT_PULLUP
    inverted: True
    name: “Start”
    on_click:
    then:
    - script.execute: control_keg

sensor it DS18B20

dallas:

  • pin: GPIO02
    update_interval: 5s
    sensor:
  • platform: dallas
    address: 0xxxxxxxxxx
    id: head
    name: “thermometr”

script:
id: control_keg
then:
- delay: 20ms
- lambda: |-
if (!id(keg).has_state()) {
ESP_LOGW(“main”, “Sensor keg has no state!”);
id(heater1).turn_off();
id(heater2).turn_off();
return;
}
//float id(keg).state;
if (id(keg).state >= 70) {
id(heater1).turn_on();
id(heater2).turn_off();
}
//float id(keg).state;
if (id(keg).state >= 96) {
id(heater1).turn_off();
id(heater2).turn_off();
return;
}
Unfortunately esp only does this once. Is there any other way for him to do this until the water heats up and off ?
To make the measurement visible in Hassio?

Mariusz