User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active


an creDomBus31 pdc vmc

This article shows how to manage the heat pump and ventilation system (HVAC) with Domoticz open-source software installed on a Raspberry PI (but any other hardware should be OK), to use the most energy from renewable sources, photovoltaic system in this case.

Also, the goal is to overheat the building, during winter, when there is an extra power available from photovoltaic (if setpoint is 21°C but there is extra power, setpoint can be raised to 21.5 or 22°C for example), consuming power when it's available from renewable sources!Domoticz supports several scripting languages, and LUA script has been chosen in this case because very easy to learn, use and customize.

Two different methods were used with the heat pump EMMETI Mirai SMI EH1018 : in the first section it's explained how to control the heat pump by Modbus, changing the water temperature, and then a rough control using their ON/OFF inputs.

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.

This is certainly a good input that is used.

The heat pump has an algorithm to compute the outlet water temperature based on current outdoor temperature, and regulate the compressor frequency (power) proportially 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:

  1. difference between room setpoint and current temperature diffTemp
  2. derivative of diffTemp (it's important to know if the difference between setpoin and temperature is decreasing or increasing!)
  3. minimum (maximum in the Summer) outdoor temperature
  4. current power from the photovoltaic system (to improve own consumption)
  5. 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.

An algorithm is implemented, in a lua script, to compute the right value of outlet water temperature, and the command mbpoll is invoked to set this temperature to the heat pump control, by Modbus (RS485).

The files script_time_heatpump_emmeti.lua and config_heatpump_emmeti.lua are available in the Github

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.

Controlling the heat pump by their On/Off inputs

- Rough/old implementation

The heat pump used in this example is a EMMETI Mirai SMI EH1018 (but many other heat pumps can be used as well), connected to a DomBus device using 4 relay outputs (connected to Domoticz controlled by a RS485 bus) which controls the following heat pump inputs:

  1. Heat pump ON / OFF (normally connected to a thermostat)
  2. Heat pump Full power / Half power
  3. Heat pump Fancoil / Radiant fluid temperature
  4. Heat pump Cooling / Heating

Using another kind of heat pump, it should be verify that it has a way to control the power and fluid temperature, by analog or digital inputs or by bus/network.

Also, two DS18B20 sensors are used to measure the temperature of fluid from heat pump to the radiant system, and from the radiant system back to the heat pump: some algorithms regulate the heat pump to:

  • limit the max/min fluid temperature to the system;
  • use the best fluid temperature related to the difference between room setpoints and real temperatures, power availability, external temperature.

Also, a ventilation system is installed in the building to renew the air (through a heat recovery system), dehumidify (by a chiller) and heat/cool air by a coil supplied by the heat pump.

Finally, an energy meter Eastron SDM230 is used to measure the power exchanged with the grid, so when the measured power is negative, photovoltaic is producing more than what building is using. Power is measured every 2 seconds: more information about connecting and managing energy meter is available in this page.



AN cmv heatpump power control fluidout


AN energy meter domESP1

With less than 200€ of hardware you're able to fully control your heating/cooling system, and get cooling system that works only with energy produced by the sun (photovoltaic) as like as heating system that use as much as possible energy from the sun.

Also, please note that Domoticz is suitable to make much much more: in the same Domoticz home automation system you can integrate the light management, garden watering, burglar alarm system (connecting all magnetic contact sensors, PIRs, sirens to the raspberry), and these features are fully monitorable and controllable by the smartphone and web browser!
Check the video showing Domoticz managing heating/cooling, burglar alarm system, short video on smartphone when an external alarm sensor has been activated, indoor and outdoor lights, water tank level and garden watering, picture sent to the smartphone when someone ring the bell, and more... the web interface is not really beautiful, but can be customized to get roomplan, floorplan or other kind of layout.


Prerequisites: some feeling with computers and electric systems!
If you have not a domoticz controller installed, you can valuate the possibility to purchase a Raspberry KIT , or burn a SD with a Raspbian + Domoticz image, or install Domoticz in your existing Raspberry hardware with Raspbian OS already installed. It's possible to use Domoticz on other types of hardware, but Raspberry is recommended in most cases due to its low power consumption (less than 10W).

From a working Raspberry with Raspbian + Domoticz already installed, enter the shell (through a SSH connection) and:

#become root
sudo su -
#install/upgrade curl, a command to fetch files from the web
apt install curl lua-dkjson
# go to domoticz directory
cd /home/pi/domoticz/scripts/lua
# fetch the script
curl -o script_time_heatpump.lua
curl -o heatpump_conf.lua
# now, edit the configuration file nano heatpump_conf.lua

and define all constants and device names for your system.


We've tested the script for more than 1 year and we can say to have saved lot of energy using this heat pump management.
We know that the heat pump manufacturer can provide a system to automatically regulate the heat pump power based on photovoltaic power production and grid power mesurements, but we're sure that that system is not customizable and versatile as a script where it's possible to easily change algorithm as needed. Also, the controller provided by the heat pump supplier has a cost that is more than double than a system with Raspberry + Domoticz + DomBus1 + Energy meter + DomESP1.

For any support, don't hesitate to contact us! We're happy to help you and improve the script.

creDomBus1 creDomESP1 videobanner

AN domoticz example2


If you like this product, please share it on social networks. Thank you! Your satisfaction is our best advertisement.
Pin It

Comments powered by CComment

FaLang translation system by Faboba