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, reducing the electricity bills.

First, a smart building should not have "smart thermostats", 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 power consumption.

Controlling a building with radiating system, heat pump and photovoltaic on the roof is not simple, because several items must be kept into account:

  • outdoor min and max temperature

  • room temperatures (called diff, difference from set point and room temperature)

  • 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)

  • and finally, maybe you want to reduce power consumption during the peak hours (usually 9-10 in the morning, and 18-21 in the evening) to contribute to the electricity grid stability!

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 there is extra power, setpoint can be dinamically raised to 21.5 or 22°C for example.
For this reason thermostats are not a smart solution, if they don't know the current building power consumption! It's better to have temperature/humidity sensors in some rooms and let the home automation system decide what to do!

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 EH1018DC : in the first section it's explained how to control the heat pump by Modbus, changing the water temperature and compressor power, 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 (the compressor frequency/power can be selected from 0 to 100%).

Heat pump managed by a LUA script to overheat in case of extra power from photovoltaic

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) 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.

The control algorithm is implemented, in a LUA script that computes the right value of outlet water temperature and compressor frequency (power), using the command mbpoll to set the parameters to the heat pump control by Modbus (RS485).

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

  1. outled fluid temperature needed to have the right comfort in the house
  2. 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, with the exception of the peak hours 9-10 and 18-21 where it's a good practice to reduce consumptions for a better electricity grid stability.

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

Import energy in a house with optimized heat pump management


Smart heat pump control by Domoticz to minimize power consumption


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