# \[NodeRed\] Heat the water heater using solar surplus

**URL:** <https://discourse.nodered.org/t/nodered-heat-the-water-heater-using-solar-surplus/89207>\
**Category:** Share Your Projects\
**Tags:** docker, home-assistant\
**Created:** [3 July 2024 05:13 UTC](https://discourse.nodered.org/t/nodered-heat-the-water-heater-using-solar-surplus/89207 "2024-07-03T05:13:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![IAMMETER](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iammeter/32/54033_2.png) [@IAMMETER](https://discourse.nodered.org/u/IAMMETER)\
**Post date:** [3 July 2024 05:13 UTC](https://discourse.nodered.org/t/nodered-heat-the-water-heater-using-solar-surplus/89207/1 "2024-07-03T05:13:05Z")

</div>

[NodeRed] Heat the water heater using solar surplus

[TOC]

Previously, we created a tutorial on using NodeRed to monitor a solar power station [Monitor your solar pv system in Nodered - IAMMETER](https://imeter.club/topic/129?sort=default).

This is an advanced tutorial on using NodeRed to control a water heater, utilizing solar surplus to heat water. This maximizes the use of solar power and reduces the reliance on the grid, thus lowering the grid electricity consumption.

> Why do this: The main reason is that the feed-in tariff is much lower than the electricity price, so we want to maximize the self-use rate of the solar system. If your feed-in tariff is similar to the electricity price, you don't need to consider this.

# Effect

 ![image-20240624141317022](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/a/3aa77ce097c12b01c0beba72069331133450a9ef.png)

From the above image, you can see that "Grid Power" is fluctuating around 0 W.

"Threshold": The control value of grid power

"Hysteresis": The allowable fluctuation range of grid power

"Grid Power": Real-time value of grid power

"Set Power": Power to control the load (e.g., the power of the water heater rod)

NodeRed's task is to read the "grid power" value in real-time.

- When the "Grid Power" value is higher than "Threshold" + "Hysteresis", reduce the "Set Power" value (lower the heater power) to reduce the demand for grid power.
- When the "Grid Power" value is lower than "Threshold" - "Hysteresis", increase the "Set Power" value (increase the heater power) to make the most of the solar power.

 ![image-20240624141033074](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/1/e12d223d4ec45c0b54761f41c549a3c0190ec3b3.png)

# SCR-485: Linear power adjustment for resistive loads

> A linear power controller with a maximum power output of 4 kW (220V 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.

[About SCR-485](https://community.home-assistant.io/t/heat-the-water-heater-using-solar-surplus/743372#about-scr-485-2)

[API of SCR-485](https://community.home-assistant.io/t/esp32-scr-module-linearly-adjust-the-power-output-of-resistive-loads-such-as-heaters/726575#the-api-of-the-wi-fi-scr-module-10)

[Run SCR-485 in standalone mode](https://community.home-assistant.io/t/heat-the-water-heater-using-solar-surplus/743372#run-scr-485-in-standalone-mode-10)

 ![SCR_485,linear power controller,voltage regulator for the resistive load](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/9/f973fdfc3f7d69f0cb9916a0f7ab9fd914eed9f7.jpeg)

# System wiring

> The system wiring is shown in the figure below, with the main components as follows: An IAMMETER three-phase power meter is used to measure grid power. Since IAMMETER's power meter is a bidirectional meter, it can measure bidirectional power (power drawn from the grid and power fed back to the grid) and provide an [API](https://www.iammeter.com/newsshow/blog-fw-features) to read the measurement results in real-time.

 ![power_control_scr485_solarPV](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/4/04e078091cc378e38df26ac0fa9f3b113c694554.jpeg)

# NodeRed

## Install Palette in NodeRED

node-red-contrib-iammeter, node-red-contrib-esphome

 ![image-20240624164711980](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/1/919616b03ad111d606f9c8300bbe881862385537.png)

 ![image-20240624164811985](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/2/2263068cdfc33f9679b8a4697e97dbe3aef344d1.png)

 ![image-20240624164840633](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/e/0eac324ca96d71d820ba28fd51fbdbb58ce4062c.png)

## Import flow.json in NodeRED

scr-485-flows.json

Link: [Solar-PV-Monitoring/NodeRed/scr-485-flows.json at master · lewei50/Solar-PV-Monitoring (github.com)](https://github.com/lewei50/Solar-PV-Monitoring/blob/master/NodeRed/scr-485-flows.json)

Copy the flows.json

 ![image-20240624165225815](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/f/5fd2f59b7e441501bc37211120c87b6a5e8063b5.png)

Import

 ![image-20240624165310305](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/f/efcca41463467d499230337da6c5bde3b44a7cb8.png)

Paste and import

 ![image-20240624165354129](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/a/baf973cdb4a938a6f612486c3a4a2d2a15deede2.png)

Deploy

 ![image-20240624165434924](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/b/8ba08a381fd5cc8ece69ba517671a5c07367b6d0.png)

## Make necessary changes in NodeRED

Change the IP address of SCR-485

 ![image-20240624163242542](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/f/7f9616c62ebb96b5d93956e6946f29a8b06db09d.png)

 ![image-20240624163303729](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/3/1338a2f204842d9a3fc0d8783f2c73544c88485d.png)

Change the IP address to your meter's IP

 ![image-20240624141916119](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/3/13c87874624594578b533f0bf73a2894e00ec386.png)

Choose your data source based on your meter type:

```auto
WEM3080 Grid Power use 
tmp_grid_power = msg.payload[2];

WEM3080T/WEM3050T/WEM3046T Grid Power use
if phase A: msg.payload[0][2]
if phase B: msg.payload[1][2]
if phase C: msg.payload[2][2]

```

 ![image-20240624142124542](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/c/3c23372de4b80c8f5479e8a0aad6183a245c62d1.png)

Set your run time

 ![image-20240624141946388](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/0/c02f7b62af950962891426f195ebb3a4a9d363cf.png)

Deploy

 ![image-20240624165434924](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/b/8ba08a381fd5cc8ece69ba517671a5c07367b6d0.png)

At this point, your automation control has been completed. You can see the control effect through debug or NodeRED Dashboard or SCR-485 web.

## NodeRED Dashboard

In HAOS: [http://yourip:1880/endpoint/ui](http://yourip:1880/endpoint/ui)

In Docker: [http://yourip:1880/ui](http://yourip:1880/ui)

 ![image-20240624141317022](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/a/3aa77ce097c12b01c0beba72069331133450a9ef.png)

# Reference

[Home Assistant: Heat the water heater using solar surplus](https://community.home-assistant.io/t/heat-the-water-heater-using-solar-surplus/743372)

[The First Customer Feedback-Based Test Report on SCR-485](https://www.iammeter.com/newsshow/blog-scr485-20240613)

[Quickstart manual for SCR-485, step by step tutorial](https://www.iammeter.com/newsshow/quickstart-scr485)

[Activities - Apply for the Linear Power Controller (SCR-485)](https://www.iammeter.com/newsshow/activity-engineering-prototype-scr485)
