Interesting challenge. As I understand it, there are three temperature zones governing the water heater’s operation:
Temperature Zone 1: 32-25, ON for 15 minutes, restart in 45 minutes
Temperature Zone 2: 24-15, ON for 30 minutes, restart in 30 minutes
Temperature Zone 3: 15 and less, ON
In the following example:
-
sensor.outdoor_temperature
represents the Wunderground temperature reading
-
input_text.temperature_zone
keeps track of the current temperature zone
This example uses seven automations.
The first three automations monitor the outdoor temperature. Each one monitors a separate temperature zone (1, 2, and 3). If the temperature enters within the range of a temperature zone the automation turns on the water heater and records the current temperature zone.
- alias: 'monitor temperature zone 1'
trigger:
- platform: numeric_state
entity_id: sensor.outdoor_temperature
below: 32
above: 25
action:
- service: input_text.set_value
entity_id: input_text.temperature_zone
value: 1
- service: switch.turn_on
entity_id: switch.water_heater
- alias: 'monitor temperature zone 2'
trigger:
- platform: numeric_state
entity_id: sensor.outdoor_temperature
below: 24
above: 15
action:
- service: input_text.set_value
entity_id: input_text.temperature_zone
value: 2
- service: switch.turn_on
entity_id: switch.water_heater
- alias: 'monitor temperature zone 3'
trigger:
- platform: numeric_state
entity_id: sensor.outdoor_temperature
below: 14
action:
- service: input_text.set_value
entity_id: input_text.temperature_zone
value: 3
- service: switch.turn_on
entity_id: switch.water_heater
The next two automations monitor the time the water heater is on.
The water heater is turn off if it has been on for:
- 15 minutes AND temperature zone is 1
- 30 minutes AND temperature zone is 2
- alias: 'heater on 15 minutes'
trigger:
platform: state
entity_id: switch.water_heater
to: 'on'
for: '00:15:00'
condition:
condition: state
entity_id: input_text.temperature_zone
state: '1'
action:
- service: switch.turn_off
entity_id: switch.water_heater
- alias: 'heater on for 30 minutes'
trigger:
platform: state
entity_id: switch.water_heater
to: 'on'
for: '00:30:00'
condition:
condition: state
entity_id: input_text.temperature_zone
state: '2'
action:
- service: switch.turn_off
entity_id: switch.water_heater
The final two automations monitor the time the water heater is off.
The heater is turned on if it has been off for:
- 45 minutes AND temperature zone is 1
- 30 minutes AND temperature zone is 2
- alias: 'heater off for 45 minutes'
trigger:
platform: state
entity_id: switch.water_heater
to: 'off'
for: '00:45:00'
condition:
condition: state
entity_id: input_text.temperature_zone
state: '1'
action:
- service: switch.turn_on
entity_id: switch.water_heater
- alias: 'heater off for 30 minutes'
trigger:
platform: state
entity_id: switch.water_heater
to: 'off'
for: '00:30:00'
condition:
condition: state
entity_id: input_text.temperature_zone
state: '2'
action:
- service: switch.turn_on
entity_id: switch.water_heater
Although what I’ve presented is conceptually sound (or so I believe it to be), it is untested. Use at your own risk. I suggest you experiment with something non-critical, like turning a light on/off, before letting it loose on a water heater.