DzVents interface to Husdata H60 heat pump interface

For heating/cooling related questions in Domoticz

Moderator: leecollings

Post Reply
Ric68
Posts: 15
Joined: Wednesday 28 January 2015 17:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

DzVents interface to Husdata H60 heat pump interface

Post by Ric68 »

Husdata H60 is a nifty little module http://www.heatpumponline.se/produkt/h6 ... l-gateway/ that can be connected to a number of heat pumps of different brands such as Nibe, Bosch, IVT, Autoterm, Buderus, Carrier, Danfoss, Jämä, Junkers, Nefit, Thermia and Worchester, see compatibility at http://husdata.se/ProdSelector.asp.

It basically corresponds to Nibe Uplink, but fits several brands and is significantly cheaper if you own an old Nibe. It communicates via Wifi and the api is really simple to use. The price of the module is 1495 SEK which corresponds to 140 euro.

Usage:
Create a number of virtual sensors such as 'T_RadiatorReturn' In the code below. Some of them are temperature sensors, some are custom sensors and some are switches, see in the code. Different manufactures has different subset of the sensors. In this case it fits an old Nibe f1230. The temperatures are in signed 16 format multiplied with 10 and has to be converted to the actual value

Change the 'API_ENABLED' in the configuration panel of the H60 to 1 (or 2 if you want to change parameters in the heat pump)

Further more, change the IP-address in the example to what you are using.

The code in dzVents to read the parameters from the heat pump:

Code: Select all

local function Signed(Value) 
    if Value > 32768 then
        Value = Value - 65536
    end
    return Value
end

return {
	on = {
		timer = {
			'every 1 minutes'
		},
		httpResponses = {
			'trigger'
		}
	},
	execute = function(domoticz, item)

		if (item.isTimer) then
			domoticz.openURL({
				url = 'http://192.168.8.120/api/alldata',
				method = 'GET',
				callback = 'trigger',
			})
		end

		if (item.isHTTPResponse) then
		    domoticz.log(item.data)
			if (item.statusCode == 200) then
                local data = domoticz.utils.fromJSON(item.data)
				domoticz.devices('T_RadiatorReturn').updateTemperature(data["0001"]/10)
				domoticz.devices('T_HeatCarrierForward').updateTemperature(data["0004"]/10)
				domoticz.devices('T_BrineIn').updateTemperature(Signed(data["0005"])/10)
				domoticz.devices('T_BrineOut').updateTemperature(Signed(data["0006"])/10)
				domoticz.devices('T_Outdoor').updateTemperature(Signed(data["0007"])/10)
				domoticz.devices('T_HotWaterTop').updateTemperature(data["0009"]/10)
				domoticz.devices('T_HotWaterMid').updateTemperature(data["000A"]/10)
				domoticz.devices('T_HotGas').updateTemperature(data["000B"]/10)
				domoticz.devices('T_SuctionGas').updateTemperature(data["000C"]/10)
				domoticz.devices('T_LiquidFlow').updateTemperature(data["000D"]/10)
				domoticz.devices('T_HeatingSetpoint').updateTemperature(data["0107"]/10)
				domoticz.devices('t_DegreeMinutes').updateCustomSensor(Signed(data["8105"]))
				domoticz.devices('Curve').updateCustomSensor(Signed(data["2205"])/10)
				domoticz.devices('Parallel').updateCustomSensor(Signed(data["2207"])/10)
				
				-- Special handling to avoid massive amount of data stored
				if (domoticz.devices('b_Compressor').state == 'On' and data["1A01"] == 0) then
				    domoticz.devices('b_Compressor').switchOff()
				elseif  (domoticz.devices('b_Compressor').state == 'Off' and data["1A01"] == 1) then
				    domoticz.devices('b_Compressor').switchOn()
                end
				if (domoticz.devices('b_PumpColdCircuit').state == 'On' and data["1A04"] == 0) then
				    domoticz.devices('b_PumpColdCircuit').switchOff()
				elseif  (domoticz.devices('b_PumpColdCircuit').state == 'Off' and data["1A04"] == 1) then
				    domoticz.devices('b_PumpColdCircuit').switchOn()
                end
				if (domoticz.devices('b_PumpHeatCircuit').state == 'On' and data["1A05"] == 0) then
				    domoticz.devices('b_PumpHeatCircuit').switchOff()
				elseif  (domoticz.devices('b_PumpHeatCircuit').state == 'Off' and data["1A05"] == 1) then
				    domoticz.devices('b_PumpHeatCircuit').switchOn()
                end
				if (domoticz.devices('b_WaterHeating').state == 'On' and data["1A07"] == 0) then
				    domoticz.devices('b_WaterHeating').switchOff()
				elseif  (domoticz.devices('b_WaterHeating').state == 'Off' and data["1A07"] == 1) then
				    domoticz.devices('b_WaterHeating').switchOn()
                end
			else
				domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
				domoticz.log(item, domoticz.LOG_ERROR)
			end
		end
	end
}
An example to change a setting: Add a virtual thermostat and change the temperature by offsetting of the setpoint (parallell) to the heat pump (In this case, there is a logic to iterate as the change is not always actuated for some unknown reason. In my setting, 21 degrees corresponds to 0 in offset):

Code: Select all

return {
    on = {
		devices = { 'Termostat' },
		timer = { 'on every 5 minutes' }
	},
	execute = function(domoticz, device)
	    local setpoint = domoticz.devices('Termostat').setPoint
	    local NewParallel = (setpoint-21)*10
	    local ActualParallel = tonumber(domoticz.devices('Parallel').state)

	    if NewParallel/10 ~= ActualParallel then
	        domoticz.openURL('http://192.168.8.120/api/set?idx=2207&val=' .. NewParallel)
	    end
	    end
}
Image
Attachments
custom-temperature-graph.png
custom-temperature-graph.png (242.05 KiB) Viewed 5123 times
ervpele
Posts: 2
Joined: Sunday 08 January 2017 18:34
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by ervpele »

Thanks, I got all the reading to work:)

But I cannot get the changing of settings to work. I have an IVT, with Rego 1000
rogerthn
Posts: 25
Joined: Thursday 26 July 2018 12:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by rogerthn »

Many Thanks!
Since my H60, connected to Thermia Diplomat at rare occasion do send -2 662.4 °C for Outdoor temperature I've applied a fix as below.

Code: Select all

if ( Signed(data["0007"])/10 > -32 ) then
  domoticz.devices('Outdoor').updateTemperature(Signed(data["0007"])/10)
else
  domoticz.log('Outdoor=' .. Signed(data["0007"])/10, domoticz.LOG_ERROR)
end
Ric68
Posts: 15
Joined: Wednesday 28 January 2015 17:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by Ric68 »

Actually since both Husdata and Domoticz (latest beta) now handles MQTT auto discovery it was pretty easy to install mqtt and enable it instead of the REST API that I used in the script previously.

There are two benefits of using MQTT instead of REST. The first one is that you do not have to bother with defining all the virtual sensors manually, which can be quite tedious and the second benefit is that as soon as there is any new data, it is sent directly to Domoticz instead of being polled at any given interval,

For installing Mosquitto follow the directions at https://mosquitto.org/blog/2013/01/mosq ... epository/. The only change I made was to use the bullseye version (which is the version I use for my Raspberry Pi)

Code: Select all

sudo wget http://repo.mosquitto.org/debian/mosquitto-bullseye.list
Do not forget to add two lines into /etc/mosquitto/mosquitto.conf file and add:

Code: Select all

listener 1883

allow_anonymous true
You will also have to restart Mosquitto or reboot your device in order for the changes to become active

Code: Select all

sudo service mosquitto restart
or

Code: Select all

sudo reboot
In the Hardware tab of Domoticz, choose MQTT Auto Discovery Client Gateway with LAN interface and add 127.0.0.1 in the Remote Address field.

In Husdata Config Menu, add the IP address of your Domoticz device to MQTT_SRVR, Set MQTT_DISCOV to 1 and if you would like to be able to change setpoint parameters, set MQTT_SUBS to 1 and reboot your H60.

It can be a good idea to install MQTT Explorer http://mqtt-explorer.com/ to see that Husdata is actually sending any parameters, but everything worked flawlessly and I automatically got 45 new devices, of which 8 were tunable parameters defined as "Thermostat", into Domoticz
McLund
Posts: 9
Joined: Monday 28 December 2020 16:29
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

DzVents interface to Husdata H60 heat pump interface

Post by McLund »

Hi.

We have a Husdata H60 heat pump interface connected to a Compress Bosch 7000i AWE air/water heat pump.

It is one CR10 thermostat that controls the heat pump.

I get all the desired values to Domoticz via LUA Script wich Ric68 has written. Big thank´s to Ric68 for this exellent code!!! :D

Code: Select all

local function Signed(Value) 
    if Value > 32768 then
        Value = Value - 65536
    end
    return Value
end

return {
	on = {
		timer = {
			'every 1 minutes'
		},
		httpResponses = {
			'trigger'
		}
	},
	execute = function(domoticz, item)

		if (item.isTimer) then
			domoticz.openURL({
				url = 'http://192.168.1.20/api/alldata',
				method = 'GET',
				callback = 'trigger',
			})
		end

		if (item.isHTTPResponse) then
		    domoticz.log(item.data)
			if (item.statusCode == 200) then
                local data = domoticz.utils.fromJSON(item.data)
				domoticz.devices('Innetemp_Bosch_Termostat').updateTemperature(data["0008"]/10)
				domoticz.devices('T_Room_temp_setpoint').updateTemperature(data["0203"]/10)
				domoticz.devices('Framledningstemperatur').updateTemperature(data["0002"]/10)
	    		domoticz.devices('T_Outdoor').updateTemperature(Signed(data["0007"])/10)
	    		domoticz.devices('T_HotWaterTop').updateTemperature(data["0009"]/10)
				domoticz.devices('T_HotWaterMid').updateTemperature(data["000A"]/10)
        		domoticz.devices('T_Add_heat_status').updateTemperature(data["3104"]/10)
        		domoticz.devices('P_Add_heat_status_2').updatePercentage(data["3104"]/10)
        		domoticz.devices('T_Brine_In').updateTemperature(Signed(data["0005"])/10)
				domoticz.devices('T_Brine_Out').updateTemperature(Signed(data["0006"])/10)
				domoticz.devices('P_Brine pump speed').updatePercentage(Signed(data["3110"])/10)
				domoticz.devices('P_Compressor_Percentage').updatePercentage(Signed(data["3108"])/10)
				-- domoticz.devices('T_HotGas').updateTemperature(data["000B"]/10)
				-- domoticz.devices('T_SuctionGas').updateTemperature(data["000C"]/10)
				-- domoticz.devices('T_LiquidFlow').updateTemperature(data["000D"]/10)
				-- domoticz.devices('T_HeatingSetpoint').updateTemperature(data["0107"]/10)
				-- domoticz.devices('t_DegreeMinutes').updateCustomSensor(Signed(data["8105"]))
				-- domoticz.devices('Curve').updateCustomSensor(Signed(data["2205"])/10)
			    -- domoticz.devices('Parallel').updateCustomSensor(Signed(data["2207"])/10)
	        	  	
				-- Special handling to avoid massive amount of data stored
				-- if (domoticz.devices('b_Compressor').state == 'On' and data["1A01"] == 0) then
			    	-- domoticz.devices('b_Compressor').switchOff()
				-- elseif  (domoticz.devices('b_Compressor').state == 'Off' and data["1A01"] == 1) then
			    	-- domoticz.devices('b_Compressor').switchOn()
				-- end
				if (domoticz.devices('Larm').state == 'On' and data["1A20"] == 0) then
					domoticz.devices('Larm').switchOff()
				elseif  (domoticz.devices('Larm').state == 'Off' and data["1A20"] == 1) then
					domoticz.devices('Larm').switchOn()
				end
				-- if (domoticz.devices('Larm Text').state == 'On' and data["2A91"] == 0) then
					-- domoticz.devices('Larm Text').switchOff()
				-- elseif  (domoticz.devices('Larm Text').state == 'Off' and data["2A91"] == 1) then
					-- domoticz.devices('Larm Text').switchOn()
				-- end
				-- if (domoticz.devices('b_PumpColdCircuit').state == 'On' and data["1A04"] == 0) then
				    -- domoticz.devices('b_PumpColdCircuit').switchOff()
				-- elseif  (domoticz.devices('b_PumpColdCircuit').state == 'Off' and data["1A04"] == 1) then
				    -- domoticz.devices('b_PumpColdCircuit').switchOn()
                -- end
				-- if (domoticz.devices('b_PumpHeatCircuit').state == 'On' and data["1A05"] == 0) then
				    -- domoticz.devices('b_PumpHeatCircuit').switchOff()
				-- elseif  (domoticz.devices('b_PumpHeatCircuit').state == 'Off' and data["1A05"] == 1) then
				    -- domoticz.devices('b_PumpHeatCircuit').switchOn()
                -- end
				-- if (domoticz.devices('b_WaterHeating').state == 'On' and data["1A07"] == 0) then
				    -- domoticz.devices('b_WaterHeating').switchOff()
				-- elseif  (domoticz.devices('b_WaterHeating').state == 'Off' and data["1A07"] == 1) then
			    -- domoticz.devices('b_WaterHeating').switchOn()
                -- end
				else
				domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
				domoticz.log(item, domoticz.LOG_ERROR)
			end
		end
	end
}
Now that electricity is very expensive in Sweden, I have started running with night reduction (lower room temperature) on the heat pump.

The disadvantage of the pump is that it is only possible to set a single control per heat source.

We have set the night lowering function so that the heat is switched on Monday - Sunday from 04:30 in the morning until 21:30 when the night lowering takes place. Then you cannot set more times and heating values ​​in the pump.

We would like to be able to set several schedules via Domoticz instead of in the heat pump.

We would like to be able to lower the temperature at a selectable time on the days when we are working during the day in order to save precious energy.

So I'm wondering if anyone can get me some help to creating a Lua script in DzVentz where you set the time for which temperature Domoticz Idx 2 "T_Room_temp_setpoint" and Husdata H60 Idx 0203 "Room temp setpoint" should be changed to.

E.g. Weekdays:
1. Heat in the house Monday - Friday from 04:30 - 06:00
2. Reduced heat in the house Monday - Friday from 06:00 - 16:00
3. Heating in the house Monday - Friday from 16:00 - 22:00
4. Reduced heat in the house Monday - Friday from 22:00 - 04:30

E.g. Weekends:
1. Heating in the house Saturday - Sunday from 07:00 - 22:00
2. Reduced heat in the house Saturday - Sunday from 22:00- 07:00


I thank you in advance for all help in this tricky case.

Sincerely
Mats McLund
Sweden
Ric68
Posts: 15
Joined: Wednesday 28 January 2015 17:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by Ric68 »

If you have created a "thermostat" as I did, you can define how many triggers you want in Domoticz.
In my case, I set it to 24 degrees at midnight and then to 20 degrees at 7.45 every day, but you can add an unique setpoint for each day if you want
Screenshot 2022-10-04 090858.jpg
Screenshot 2022-10-04 090858.jpg (380.72 KiB) Viewed 3710 times
McLund
Posts: 9
Joined: Monday 28 December 2020 16:29
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by McLund »

Hi Ric.

Thank you for your answer! :P

I have done a script via Blockly as you can see in picture. This script also works very well.

Natt och dagsänkning i Domoticz - Opera.png
Natt och dagsänkning i Domoticz - Opera.png (101.32 KiB) Viewed 3682 times

But this solution is temporary until I have MQTT to work in Domoticz. All data sends from Husdata as you can see in picture from MQTT Explorer but this data will not come in to Domoticz. I don´t now whats going wrong....

Aqara sensors via ZigBee2MQTT works very well....

MQTT Data från HusData.png
MQTT Data från HusData.png (39.44 KiB) Viewed 3682 times
Broker 1.5.7.png
Broker 1.5.7.png (11.2 KiB) Viewed 3682 times

So if you have some tips at MQTT ......


Best ragard´s

//Mats
McLund
Posts: 9
Joined: Monday 28 December 2020 16:29
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by McLund »

Hi, it´s me again..... ;)

I just want to say that at MQTT from HusData to Domoticz works now..... Hurray!!!! :D

I have to remove text "Domoticz" in MQTT_PREFIX in HusData config´n, then all sensors come in to Domoticz.


Have a nice weekend!


Best,
Mats McLund
rogerthn
Posts: 25
Joined: Thursday 26 July 2018 12:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by rogerthn »

Intresting Mats!
Do you have an indoor temperature sensor or does lowering Room temp setpoint "do the trick" without it?
PS
My MQTT-data is stored in InfluxDB and is displayed using Grafana
e,g, https://rogerthn.se/grafana/d/HaQJPWg4z ... refresh=1m
Good night.
McLund
Posts: 9
Joined: Monday 28 December 2020 16:29
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by McLund »

rogerthn wrote: Friday 07 October 2022 23:27 Intresting Mats!
Do you have an indoor temperature sensor or does lowering Room temp setpoint "do the trick" without it?
PS
My MQTT-data is stored in InfluxDB and is displayed using Grafana
e,g, https://rogerthn.se/grafana/d/HaQJPWg4z ... refresh=1m
Good night.
Hi rogerthn.

I have one Bosch CR10 indoor thermostat in middle of plane 1 in our 2 plane house.

There is two tangential fans on plane 1, and two on plane 2 (wich we not use just now...)

As you can see in my Blockly script send this script URL-adress 192.168.1.20/api/set?idx=0203&val=200 or 192.168.1.20/api/set?idx=0203&val=165 specified times if day is Mondays to Fridays. Then same time check for Saturday and Sunday.

In this case is "val=165" = set room temp in heatpump to 165/10 = 16,5 degrees and so on.....

The "idx=0203" value in script is Husdata idx 0203 "Room temp setpoint" 16.50 C

Have a nice day!

//Mats McLund
rogerthn
Posts: 25
Joined: Thursday 26 July 2018 12:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by rogerthn »

Thanks Mats!
0203 on my H60 (Thermia Diplomat) is Room temp setpoint :-)
Might consider something similar to what you have and also something in Domoticz for 0205 Heat set 1, Curve to be used when leaving the house for some days :-D
magnusb
Posts: 4
Joined: Thursday 30 November 2017 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by magnusb »

rogerthn wrote: Friday 07 October 2022 23:27 Intresting Mats!
Do you have an indoor temperature sensor or does lowering Room temp setpoint "do the trick" without it?
PS
My MQTT-data is stored in InfluxDB and is displayed using Grafana
e,g, https://rogerthn.se/grafana/d/HaQJPWg4z ... refresh=1m
Good night.
Really nice!
Do you have any instructions on how you set this up?
rogerthn
Posts: 25
Joined: Thursday 26 July 2018 12:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by rogerthn »

magnusb wrote: Wednesday 07 December 2022 19:10 Really nice!
Do you have any instructions on how you set this up?
No detailed instructions, it has been "some" Trial and error :lol:
I'm running Grafana and InfluxDB on RPI 4 with 8GB ram and SSD-drive.

Once you have Grafana and InfluxDB installed you need to configure MQTT_SRVR, MQTT_PORT, MQTT_USER and MQTT_PASS
If OK there should be a line like "MQTT Connected with user/pass" on H60 log.

I do have scripts on the RPI for writing to InflucDB that I could share.
It might also be possible to share my Grafana Dashboard
fjuppe
Posts: 42
Joined: Thursday 14 September 2023 19:32
Target OS: Raspberry Pi / ODroid
Domoticz version: 16341
Location: Stockholm
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by fjuppe »

Hello,
I am very new to DzVents scripting but I used the code in this post to read out the available values from the Husdata H66 interface.
Since I have 2 different heat pumps, each with a H66 module, I want to have data from both displayed in Domoticz. I have created separate sensors in the interface, created 2 separate scripts in DzVents and, of course, changed the IP address for the second H66 board. My problem is that the Domoticz senors for the 2 heat pumps shows the same data, I suspect the 2 scripts refer to the same data table. What parameter in the second script do I need to change in order to have separate datatables created ?
Thanks for any input that can help solve this problem
rogerthn
Posts: 25
Joined: Thursday 26 July 2018 12:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by rogerthn »

Do you have different names in the scripts?
domoticz.devices('Radiator Return')).updateTemperature(data["0001"]/10
domoticz.devices('Radiator Forward').updateTemperature(data["0002"]/10
fjuppe
Posts: 42
Joined: Thursday 14 September 2023 19:32
Target OS: Raspberry Pi / ODroid
Domoticz version: 16341
Location: Stockholm
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by fjuppe »

Yes, different names in script....
rogerthn
Posts: 25
Joined: Thursday 26 July 2018 12:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by rogerthn »

OK
fjuppe
Posts: 42
Joined: Thursday 14 September 2023 19:32
Target OS: Raspberry Pi / ODroid
Domoticz version: 16341
Location: Stockholm
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by fjuppe »

Hello,

After som trials, I have found a fix for this issue.
In the code

httpResponses = {'trigger'}

I changed to

httpResponses = {'trigger1'}

This obviously creates another table for JSON data that I can use for the second heat pump.

/fjuppe
rogerthn
Posts: 25
Joined: Thursday 26 July 2018 12:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: DzVents interface to Husdata H60 heat pump interface

Post by rogerthn »

Well done!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests