Customizable water heater target with helpr

Hi all, this is my first thread!
I want to make an automation to turn the water heater on (Sonoff TH16) if the water is not hotter than a variable value using a helper, so that my user can customize his chosen water temp.
But I can’t use the helper in the automation because is a ‘float’ vs an ‘int’.
How can I come around this?
Screen Shot 2022-06-14 at 13.15.27

type: is_temperature
condition: device
device_id: 86582b383fb6776b8e6929293------
entity_id: sensor.sonoff_10015dbeec_temperature
domain: sensor
below: input_number.water_temperature_setpoint

any reason, you don’t use generic thermostat?

Thanks for your response:

  1. I want this to work specifically at sunset (I have a solar heater on top of the electrical)
  2. Same issue, the Generic Thermostat expects a ‘float’ value, while the helper is an integer.

You may also need a failsafe to turn off the water heater.

Let’s say Home Assistant or the computer go offline, the temperature sensor fails, or …

Consider what will happen if the water heater does not turn off. Will it overheat and burst?

1 Like

The switch has a routine that protects it, it will not work more than 40 min in any case.

1 Like

The float error is because for below you provided a string (the input sensor name), I don’t think you can specify a template for below, but if you can you should be putting {{ and }} around the expression. The expression would be something like this:

“ {{ states(‘input_number.my_name’) }}”

You are likely having the same issue with the generic thermostat. Post that yaml and I’ll look at it.

Thanks, Pete, I tried this one below, and the syntax is OK, but I can’t get it to work either in conditions or triggers inside the automation. Any ideas?

value_template: "{{ states('input_number.water_temperature_setpoint') > states('sensor.sonoff_10015dbeec_temperature')}}" 

Screen Shot 2022-06-14 at 13.15.27

below likely does not support a template.

So, make a binary_sensor template with the expression.

Then run the automation when the binary sensor goes from “off” to “on”

Thanks for your help, I managed to use a template in the trigger field and it solved my problem:

trigger:
  - platform: template
    value_template: >-
      {% if states('input_number.water_temperature_setpoint') >
      states('sensor.sonoff_10015dbeec_temperature') %} 
        True
      {% else %}
        False
      {% endif %}
condition:
  - condition: sun
    before: sunset
    after: sunset
    after_offset: '0:30:00'
    enabled: false
action:
  - type: turn_on
    device_id: 86582b383fb6776b8e69292----
    entity_id: switch.sonoff_10015dbeec
    domain: switch
    enabled: true
  - wait_for_trigger:
      - platform: template
        value_template: >-
          {% if states('input_number.water_temperature_setpoint') <
          states('sensor.sonoff_10015dbeec_temperature') %} 
            True
          {% else %}
            False
          {% endif %}
  - service: notify.mobile_app_ariels_bitch
    data:
      message: Water temperature has achieved its setpoint.
      title: Boiler Notification
  - type: turn_off
    device_id: 86582b383fb6776b8e6929293ba----
    entity_id: switch.sonoff_10015d---
    domain: switch
mode: single