Automate Solar Panel For Hot Water, and heating

Hi everybody.
I’m looking to automate the production of hot water with solar panels, and use the excess to support the UFH. I’ve installed shelly temp sensors in solar panel, and hot water tank, and shelly actuator to turn the pump on, I also have a three way valve that will divert the solar circulation to UFH tank when the water for bathing temp is enough. all sensors and switches integrated in home assistant.

I’ve been trying to do this but don’t manage to do it through the UI, and yaml is just at the beginning for me.

basically, what I want to do is, turn on the circulator pump when the temp at panels are superior to the temp of the tank in 20,0º C, and stop circulating when it reaches 10.0ºc, later on, when the bathing tank reaches 60ºC, Divert circulator to the UFH tank, but only if the temp at panels exceed by 20ºC the temp of the UFH.

Can I do it through automations in UI?

thanks
Nelson

I think you’ll need to use a template trigger for that. Maybe something like this:

- platform: template
  value_template: "{{ (states('sensor.temp_panels') | float) - (states('sensor.temp_tank') | float) >= 20 }}"

You can do almost everything in UI, it’ll just fall back to showing you a yaml code editor if it finds something it doesn’t understand. Either way, please post the whole automation as yaml here on the forums, so that other people can help you. No one will decipher UI screenshots.

hi
I´ve come to this automation for wich I get valid config, but in the log I get this:

Logger: homeassistant.config
Source: config.py:464
First occurred: 16:22:42 (3 occurrences)
Last logged: 16:24:04

Invalid config for [automation]: [template] is an invalid option for [automation]. Check: automation->template. (See /config/configuration.yaml, line 10).

my automation is:

`template:
  - sensor:
      - name: temperature_difference
        unit_of_measurement: "°C"
        state: >
          {{ ((states('sensor.shelly_shsw_pm_e09806aa0e47_3_temperature') | float)  - (states('sensor.shelly_shsw_pm_e09806aa0e47_2_temperature') | float ) ) }}
          
  - alias: pump_on
    trigger:
      platform: numeric_state
      entity_id: sensor.temperature_difference
      above: 20
    action:
      service: switch.turn_on
      entity_id: binary_sensor.shelly_shsw_pm_e09806aa0e47_switch 
  - alias: pump_off
    trigger:
      platform: numeric_state
      entity_id: sensor.temperature_difference
    below: 6
    action:
    service: switch.turn_off
    entity_id: binary_sensor.shelly_shsw_pm_e09806aa0e47_switch`

Blockquote

Please can some help what is wrong?
thanks
NM

You seem to be mixing automation config with a template sensor.

You need to put this in your configuration.yaml:

template:
  - sensor:
      - name: temperature_difference
        unit_of_measurement: "°C"
        state: >
          {{ ((states('sensor.shelly_shsw_pm_e09806aa0e47_3_temperature') | float)  - (states('sensor.shelly_shsw_pm_e09806aa0e47_2_temperature') | float ) ) }}

and this in your automations.yaml:

  - alias: pump_on
    trigger:
      platform: numeric_state
      entity_id: sensor.temperature_difference
      above: 20
    action:
      service: switch.turn_on
      entity_id: binary_sensor.shelly_shsw_pm_e09806aa0e47_switch 
  - alias: pump_off
    trigger:
      platform: numeric_state
      entity_id: sensor.temperature_difference
    below: 6
    action:
    service: switch.turn_off
    entity_id: binary_sensor.shelly_shsw_pm_e09806aa0e47_switch`

Hi Ondra
I did separate the sensor…but, still the sensor is not working, in the log I get this:

Logger: homeassistant.helpers.template
Source: helpers/template.py:1291
First occurred: 07:50:22 (4 occurrences)
Last logged: 07:50:23

Template warning: 'float' got invalid input 'unavailable' when rendering template '{{ ((states('sensor.shelly_shsw_pm_e09806aa0e47_3_temperature') | float) - (states('sensor.shelly_shsw_pm_e09806aa0e47_2_temperature') | float ) ) }}' but no default was specified. Currently 'float' will return '0', however this template will fail to render in Home Assistant core 2022.1

Any idea?
Cheers
NM

You are getting this warning because one of your sensors is unavailable.
To get rid of the warning, you can specify a default value in the float filter:

{{ ((states('sensor.shelly_shsw_pm_e09806aa0e47_3_temperature') | float(0))  - (states('sensor.shelly_shsw_pm_e09806aa0e47_2_temperature') | float(0) ) ) }}

However, what you really want is to define an availability template:

template:
  - sensor:
      - name: temperature_difference
        unit_of_measurement: "°C"
        state: >
          {{ (states('sensor.shelly_shsw_pm_e09806aa0e47_3_temperature') | float(0))  - (states('sensor.shelly_shsw_pm_e09806aa0e47_2_temperature') | float(0) ) }}
        availability: >
          {{ states('sensor.shelly_shsw_pm_e09806aa0e47_3_temperature') not in ['unknown','unavailable'] and states('sensor.shelly_shsw_pm_e09806aa0e47_2_temperature') not in ['unknown','unavailable'] }}

If both of your sensors have proper states, your template sensor should work.

Hi again,
thanks for your comment.
I just created a card to check the temperature difference , and checked directly with shelly ap, and the sensor seems to be working correctly.
Just have to check when the difference becomes negative if it is still working.
What I don´t get is why the log shows the error.
Thanks again for your help :slight_smile: