Page 1 of 1

LUA script to control heat pump optimizing power from photovoltaic!!

Posted: Thursday 01 October 2020 0:02
by psubiaco
Controlling the heat pump optimizing power consumption, is not really easy, but it's possible!
I'm using a LUA script + a configuration LUA file for this purpose, for both heating and cooling, and it works very very well!
Cooling only when there is enough energy from the photovoltaic system (no energy from the electric grid).
Heating: it trys to regulate the heat pump power to reduce power consumption when there is no power production from photovoltaic (and rooms are almost in temperature), and increase heat pump power, fluid temperature and zone setpoints when there is an extra photovoltaic production (it's better to heat the house a little bit more than the setpoint today, if it's sunny, because tomorrow it can be cloudy).

I've explain something in the following page, where you can find the commands to download the two LUA scripts.
https://www.creasol.it/support/domotics ... otovoltaic

I hope this can be useful for you. Any suggestions are welcome!

Re: Controlling heat pump optimizing power usage

Posted: Thursday 01 October 2020 0:47
by waaren
psubiaco wrote: Thursday 01 October 2020 0:02 IAny suggestions are welcome!
Thanks for sharing this.

I tried to download the two files but heatpump_conf.lua is missing from your github. I get a 404: Not Found with

Code: Select all

curl https://raw.githubusercontent.com/CreasolTech/domoticz_lua_scripts/master/heatpump_conf.lua

In the Lua code I see

Code: Select all

json=require("dkjson")
but "dkjson" is not included in the domoticz distribution. Domoticz does use ./scripts/lua/JSON.lua for converting a Lua table to JSON and the other way around

Re: Controlling heat pump optimizing power usage

Posted: Thursday 01 October 2020 8:54
by psubiaco
Hi Waaren,
thanks a lot for both info.
I've just loaded heatpump_conf.lua in github, so now it's available.
About json, you can install lua-dkjson package as I did, or modify the script to use JSON.lua included in domoticz (this should be the preferred solution).
Have a nice day.
Paolo