Heat the water heater using solar surplus

Heat the water heater using solar surplus

We have been committed to exploring ways to maximize profits in residential photovoltaic systems and implementing these methods in Home Assistant. These are some previous articles as below

This article mainly introduces how to achieve real-time adjustment of the water heater power in Home Assistant. The power of the water heater is adjusted in real-time based on the feed-in power.

Preface

With the increasing gap between feed-in electricity prices and electricity costs, there is a desire to minimize grid electricity consumption and maximize the self-consumption rate of photovoltaic systems.

There are generally two approaches to increasing the self-consumption rate:

  1. Introducing a battery storage system.
  2. Rationally controlling the load, ideally adjusting in real-time based on grid power.

This article mainly proposes a solution for the second method and includes two parts.

  • Add a controller (SCR-485) to Home Assistant that can linearly adjust the power of resistive loads (such as a water heater).
  • Create an automation so that the SCR-485 adjusts the power output based on the real-time grid power.

Grid Power REV: Feed-in power

SCR_485 Power: “Set Power” of SCR_485

About SCR-485

SCR-485 is a linear power controller with a maximum power output of 4 kW (230V system).

It can linearly adjust the power output within the range of 0-4 kW, recommended for controlling resistive loads (such as boiler heaters), and provides Wi-Fi functionality.

SCR_485,linear power contrllor,voltage regulator for the resistive load

Add SCR-485 in Home Assistant

Wiring diagram

  • The SCR-485 is serially connected before the thermostat to supply power to the heater.
  • Use the IAMMETER`s energy meter to measure grid power and provide the grid power data to the SCR-485 as the basis for power adjustment.

power_control_scr485

Configure “SCR_485” Wi-Fi Credentials,add Device

image-20240506150949118 image-20240506150609044

Step by step :Configure “SCR_485” Wi-Fi Credentials,add Device in the HA

Add Sensor

Add in configuration.yaml:

code link: scr-485_automation/configuration.yaml

# Example configuration.yaml entry
switch:
  - platform: template
    switches:
      scr_ha_with_battery:
        friendly_name: "With Battery"
        # value_template: "{{ is_state('switch.source', 'on') }}"
        turn_on:
          service: switch.turn_on
          target:
            entity_id: switch.scr_ha_with_battery_open
        turn_off:
          service: switch.turn_off
          target:
            entity_id: switch.scr_ha_with_battery_close
            
sensor:
  - platform: template
    sensors:
      tmp_grid_power:
        unit_of_measurement: 'W'
        value_template: >-
            {% if is_state('switch.scr_ha_with_battery', 'on') %}
                {{ (states('sensor.solarpv_power_b')|float - states('sensor.battery_power_a')|float)|round(1) }}
            {% else %}
                {{ (states('sensor.solarpv_power_b')|float)|round(1)}}
            {% endif %}
      dev_threshold_hysteresis:
        unit_of_measurement: 'W'
        value_template: "{{ (states('number.scr_485_5_threshold')|float - states('number.scr_485_5_hysteresis')|float)|round(1) }}"
      add_threshold_hysteresis:
        unit_of_measurement: 'W'
        value_template: "{{ (states('number.scr_485_5_threshold')|float + states('number.scr_485_5_hysteresis')|float)|round(1) }}"
        
  1. Where sensor.solarpv_power_b is changed to the Grid Power of your meter
  2. If you don’t have a battery, just keep With Battery turned off (operate in the home assistant panel).

Add Automation

Copy the ‘Auto SCR’ code from here: scr-485_automation/auto_scr_automation

alias: Auto SCR
description: Automatically control SCR-485 via HomeAssistant
trigger:
  - platform: state
    entity_id:
      - sensor.tmp_grid_power
condition:
  - condition: time
    after: "08:00:00"
    before: "17:00:00"
action:
  - if:
      - condition: numeric_state
        entity_id: sensor.tmp_grid_power
        below: sensor.dev_threshold_hysteresis
    then:
      - service: number.set_value
        data:
          value: >-
            {% set tmp_set_power = (states('number.scr_485_set_power')|float +
            (states('sensor.tmp_grid_power')|float -
            states('number.scr_485_5_threshold')|float)|abs)|round(0) %} {% if
            tmp_set_power < 0 %}
              {{ 0 }}
            {% elif tmp_set_power > states('number.scr_485_6_max_power')|float
            %}
              {{ states('number.scr_485_6_max_power')|float }}
            {% else %}
              {{ tmp_set_power }}
            {% endif %}
        target:
          entity_id: number.scr_485_set_power
  - if:
      - condition: numeric_state
        entity_id: sensor.tmp_grid_power
        above: sensor.add_threshold_hysteresis
    then:
      - service: number.set_value
        data:
          value: >-
            {% set tmp_set_power = (states('number.scr_485_set_power')|float -
            (states('sensor.tmp_grid_power')|float -
            states('number.scr_485_5_threshold')|float)|abs)|round(0) %} {% if
            tmp_set_power < 0 %}
              {{ 0 }}
            {% elif tmp_set_power > states('number.scr_485_6_max_power')|float
            %}
              {{ states('number.scr_485_6_max_power')|float }}
            {% else %}
              {{ tmp_set_power }}
            {% endif %}
        target:
          entity_id: number.scr_485_set_power
    enabled: true
mode: single

Select All and Paste

save

Add Fast Update Sensors in automation

Copy the ‘Fast Update Sensors’ code from here: Yaml in Home Assistant/scr-485_automation/fast_update_sensors.yaml

alias: Fast Update Sensors
description: Fast Update Sensors
trigger:
  - platform: time_pattern
    seconds: /3
condition: []
action:
  - service: homeassistant.update_entity
    target:
      entity_id:
        - sensor.tmp_grid_power
        - sensor.solarpv_power_b
    data: {}
mode: single

This is to be able to obtain the required sensors faster if these sensors were updated very slowly before.

Adding Home Assistant Dashboard

Copy the ‘dashboard ui’ code from here: [Solar-PV-Monitoring/Yaml%20in%20Home%20Assistant/scr-485_automation/dashboard_ui.yaml at master · lewei50/Solar-PV-Monitoring (github.com)](https://github.com/lewei50/Solar-PV-Monitoring/blob/f22af124b8e5d8ffe2e51205de2d8259e6d2b171/Yaml in Home Assistant/scr-485_automation/dashboard_ui.yaml)

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: switch.scr_ha_with_battery
      - entity: sensor.tmp_grid_power
      - entity: number.scr_485_5_threshold
      - entity: number.scr_485_5_hysteresis
      - entity: number.scr_485_set_power
  - type: history-graph
    entities:
      - entity: sensor.tmp_grid_power
      - entity: number.scr_485_set_power
    hours_to_show: 1

Run SCR-485 in standalone mode

The SCR-485 can also operate in ‘standalone mode,’ without the need for Home Assistant.

Quickstart manual for SCR-485,step by step tutorial

When the ‘auto mode switch’ option is enabled, the SCR-485 automatically adjusts the set power based on the grid power.

  • When the grid power exceeds the threshold plus hysteresis, the set power will be decreased.
  • When the grid power is less than the threshold minus hysteresis, the set power will be increased.

SCR-485 actual test results

This feedback is from one of the customers who tested the SCR-485 in the first batch.

21 June

Mostly cloudy day full utilisation of any generation thanks to the scr-485, previously I would have been heating the water at about 1KW and any generation over about 2KW would have been exported to the grid, now I harness all that generation into heating the water, as a result on these days also hotter water if not at full temp. couple of spikes at about 11 & 12 there was my dishwasher running

Results from SCR-485

Reference

ESP32 + SCR module: Linearly adjust the power output of resistive loads, such as heaters

Quickstart manual for SCR-485,step by step tutorial

Control a boiler heater using a Wi-Fi SCR module automatically

Activities - Apply for the Linear Power Controller (SCR-485)