Select English language to read the up-to-date version of this article!
Introduction
This article shows how to manage the heat pump and ventilation system (HVAC) with Domoticz open-source software installed on a Rock PI S or Raspberry PI (but any other hardware should be OK), to use the most energy from renewable sources (photovoltaic system in this case) reducing the electricity bill.
First, a smart building should not have thermostats to regulate room temperature, because they usually are not so smart as a domotic controller. It's preferred to have a temperature (and humidity) sensor in some rooms and modify the outlet water temperature to get the best comfort and needed power consumption.
Controlling a building with radiating system with heat pump and photovoltaic on the roof is a bit complex, because several items must be kept into account:
-
outdoor min and max temperature
-
room temperatures (and diff=difference from the setpoint)
-
variation of diff with the time (derivative of diff on time)
-
current power from grid (if negative, some extra power is available from solar photovoltaic, and it's better to use it increasing heat pump power)
-
electricity cost, to increase consumption when electricity energy is cheaper and reduce power during the peak hours (usually 7-9 in the morning, and 18-21 in the evening) to contribute to the electricity grid stability!
- solar energy forecast, so it's possible to reduce heat pump power in the morning or night in case that there will be enough energy from photovoltaic to compensate the OFF time of the heat pump.
The goal is to get a comfortable temperature in all rooms, maybe reducing the temperature when rooms are not used, and overheat the building, during winter, when extra power from photovoltaic is available: if setpoint is 21°C but extra power from photovoltaic is available, setpoint can be dinamically raised to 21.5 or 22°C for example.
For this reason temperature/humidity sensors in some rooms are preferred over manual thermostats!
This is a very compact board, DomBusTH, that can be used with Domoticz, Home Assistant, ...,with a temperature and humidity sensor, a touch sensor (acting as a multi-function pushbutton), Red+Green+White LEDs (for notifications), 4 inputs (alarm sensors, pushbuttons, ...) and 2 outputs (that can be connected to external relay, for example to drive a roller shutter UP/DOWN). This is just an adv for our product, but it's possible to use any temperature sensor for this purpose, of course!
Domoticz supports several scripting languages, and LUA script has been chosen in this case because very clear so it's easy to learn, use and customize.
In GitHub https://github.com/CreasolTech/domoticz_lua_scripts it's possible to find the script_time_heatpump_emmeti.lua example to control EMMETI Mirai SMI EH1018DC by Modbus, setting the outlet water temperature and compressor power. The script is really complicate because customized for the needs of a specific building, so it's suggested to start with some simple rules to make an automation, then adapt and improve rules to get the wanted behaviour.
What do you need?
- a single board computer (like Raspberry PI, Rock PI) or NUC or other mini-PC, with at least 1 USB port (that can be expanded with a USB Hub, if needed)
- Linux operating system + Domoticz software. You can also find SD board with operating system + software already installed, and ready to use: check https://store.creasol.it/19-kit for some kits.
- cheap USB/RS485 adapter to connect the heat pump by RS485. Alternatively it's possible to use a WiFi-RJ45/RS485 module.
- cheap USB/RS485 adapter, or WiFi-RJ45/RS485 module, to connect the all DomBus modules by RS485 bus, if needed.
- temperature sensors
- specifics for your heat pump Modbus registers, some patience and some skills to make an automation to control the heat pump.
Why Domoticz?
You can use other systems, like Home Assistant, Node-RED, OpenHAB, ... The choice of Domoticz is good because it's simple, stable, and permit to make complex automations easily by programming in LUA. Other home automation systems are not so versatile, but they can be used as well with some limitations.
Controlling the heat pump by ModBus
The heat pump has one input to select half power or full power: it's mainly used during the night to reduce noise, limiting the compressor and fan frequency to 50% or so (the compressor frequency/power can be selected from 0 to 100%).
As the compressor frequency can be reduced, it's possible to use this function to reduce heat pump power.
Water temperature is a good solution to maximize the house comfort, while compressor frequency is perfect to control the usage power.
By default the heat pump has an algorithm to compute the outlet water temperature based on current outdoor temperature, and regulate the compressor frequency (power) proportionally to the difference between the computed temperature and current water temperature.
The idea is to implement a better control of the outlet water temperature based on:
- difference between room setpoint and current temperature diffTemp
- derivative of diffTemp (it's important to know if the difference between setpoin and temperature is decreasing or increasing!)
- minimum (maximum in the Summer) outdoor temperature
- current power from the photovoltaic system (to improve own consumption)
- peak power of the electrical grid, to reduce power consumption in the peak hours (in the early morning and late afternoon): this is used only to help the electrical network to avoid peak power and high energy prices
- photovoltaic energy forecast: if enough high, it's possible to limit power during night and peak hours, increasing the power during the day. If energy from photovoltaic will be insufficient, it's better to keep the heat pump to a low power during peak hours, but keep it ON.
The control algorithm is implemented, in a LUA script that computes the right value of outlet water temperature and compressor frequency (power), sending those parameters by Modbus (RS485) to the heat pump by using the mbpoll command or through a plugin to control the heat pump, if exists.
Heatpump RS485 is connected to the domotic controller (RaspberryPI in this case) by a RS485/USB adapter; also the DomBus31 module is used to control heat pump inputs (thermostat on/off, coil/radiant temperature, heating/cooling and full power/half power.
Actually, heat pump is always configured in "night mode", and lua script controls both
- outled fluid temperature needed to have the right comfort in the house
- compressor power percentage, to regulate power
During the night, both fluid temperature and power are reduced to limit power consumption and fan/compressor noise.
During the day both fluid temperature and power are increased (higher temperature => higher efficiency), with the exception of the peak hours in the morning and evening where it's a good practice to reduce consumptions for a better electricity grid stability, and even to save money.
If there is an extra production from photovoltaic (energy exported to the grid), fluid temperature and power are increased to consume all available energy from photovoltaic. Also, room setpoints are automatically increased in case of extra power from photovoltaic, to reduce the power consumed in the evening or in the night.
The files script_time_heatpump_emmeti.lua and config_heatpump_emmeti.lua are available in the Github https://github.com/CreasolTech/domoticz_lua_scripts
Electricity energy cost and photovoltaic energy forecast
In the same GitHub page it's possible to find script_time_entsoe.lua that compute the hour-by-hour electricity price and cost, average electricity price, hour-by-hour solar energy forecast and total daily energy forecast.
Electricity price is computed for the selected zone (e.g. Northern Italy, or Denmark2, ...) and hourly energy cost is computed by specifying 3 additional parameters depending by your supplier.
For the solar energy forecast, it's possible to specify orientation/declination/kWp for one or more systems, so having solar panels placed with different orientations it's possible to compute the hourly energy for all strings. Unfortunally solar trackers are not managed by this forecast API.
The script_time_entsoe.lua produces 4 variables containing hourly values separated by semicolons:
- hourly + average electricity price today
- hourly + average electricity price tomorrow
- hourly + total photovoltaic energy today
- hourly + total photovoltaic energy tomorrow
By including the scripts globalvariables.lua and globalfunctions.lua it's possible to use the functions:
- tonumber( getItemFromCSV(uservariables['entsoe_today'], ';', timeNow.hour) ) to get the current average electricity price
- tonumber( getItemFromCSV(uservariables['entsoe_today'], ';', 24) ) to get the current average electricity price
- tonumber( getItemFromCSV(uservariables['pv_today'], ';', 24) ) to get the total forecasted energy from photovoltaic, today
- tonumber( getItemFromCSV(uservariables['pv_tomorrow'], ';', 24) ) to get the total forecasted energy from photovoltaic, tomorrow
With Domoticz it's possible to write complex automations that take into account all parameters, permitting to save money by increasing self consumption and reducing the energy consumption in the peak hours where electricity cost is higher. Also, in this way it's possible to improve the energy flexibility, helping the electricity grid by reducing consuming (or exporting energy) when its availability is low (during peak hours).
Domoticz plugin to manage Emmeti Mirai SMI heat pump
A plugin for Domoticz that manages heat pumps made by Emmeti is available at https://github.com/CreasolTech/domoticz-emmeti-mirai