Kronoterm heat pump integration

Thank you, Smartpodgurc! I finally managed to integrate my Kronoterm heat pump into Home Assistant without spending money on an RS485 adapter. Hopefully, in the future, Kronoterm will make the Modbus available through the web module already installed in the heat pump. I still need to experiment with the POST method to modify the parameters.

Awesome! Glad to hear that!

I’ll try to create a more detailed step by step guide or video on the POST method, so everyone can follow.

2 Likes

yes please :pray: :pray: :pray:

Ok, here it goes…

Let’s say you want to set the Target Temperature of the house using Home Assistant. Marked in red, then follow the below steps.


1.) GOOGLE CHROME

In Google Chrome, go to Settings > More Tools > Developer Tools

When additional windows opens up follow the below steps:

    1. Select a Network tab
    1. In Filter write Action
    1. Change the Set temperature in Kronoterm App. Up or down, doesn’t matter.
    1. You should now see jsoncgi.php?TopPage=1&Subpage=5&Action=1 . Click it.
    1. Go to Payload tab
    1. Here’s the information you’ll need later in Node-Red.


2.) HOME-ASSISTANT

Go to Settings > Devices & Services > Helpers > + CREATE HELPER > Select Number

Set the desired Name, Icon, Minimum value, Maximum value, Step Size, Unit of measurement.

By default the Step size is set to 1. Make sure to put in a decimal value if you want to do the smaller adjustments in temperature. I’m fine with 0.5 °C adjustments.

Click Create.


3.) NODE-RED

Here’s the Updated Flow Export: :loudspeaker: https://pastecode.io/s/cj7bmvo0

I’ve renamed everything to English and added few extra sensors and fixed the Kronoterm Pump Operation (idle/not idle) thingy. Previously it had created two entites in HA, one for each state.

Before proceeding, these are the Pallets I have installed.

Add home assistant > events:state node. Click it.

image

In the node do the following changes:

    1. Add a Name. I’ve named it Kronoterm Target Temperature.
    1. Select a Server
    1. Find the Kronoterm Target Temperature Config entity
    1. Change the State Type to number
    1. Click Done

Add a function

Click the function, rename it. I called it Set Payload

Now take the values, we got from the Chrome browser and use them in the Javascript Code. Except for the param_value, which we’ll get from Home Assistant Helper.

image

Copy the JavaScript code and paste it in the On Message part of the function node.

// Define Query String Parameters
var topPage = 1;
var subPage = 5;
var action = 1;

// Prepare URL
msg.url = `https://cloud.kronoterm.com/jsoncgi.php?TopPage=${topPage}&Subpage=${subPage}&Action=${action}`

// Define Form Data
var paramName = "circle_temp";
var paramValue = msg.payload; // Setting param_value based on the helper value
var page = 5;

// Prepare payload for application/x-www-form-urlencoded
msg.payload = `param_name=${paramName}&param_value=${paramValue}&page=${page}`;

// Set content type header
msg.headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
};


// Return the message object to pass it to the next node
return msg;

It should look like this.

Now add http request node.

Click the http request

  • Change the Method to POST
  • Tick the box in front of Use authentication
  • Input your Username & Password. The same one you use when logging to Kronoterm Cloud app via browser.
  • Leave the URL and Headers empty, as it will be picked up from the function node (JavaScript code) we set up in above step.

Add debug node (optional).

Write statusCode instead of payload. Rename the Name is optional.

This is how the flow should look like in the end.

Now Deploy.

image


4.) TEST

Now, changing the value in Home Assistant in Kronoterm Target Temperature Config helper, should also change it on the Kronoterm Cloud.

In Node-Red, you should receive 200 in the debug Response. That means the response was successful. Anything else, would be an error.

And here’s the changed value Temperature in Kronoterm Cloud.


5.) CHANGING SOMETHING ELSE

If you’d like to change something else, like state of Heating circut operation mode (circle_status), you basically repeat the steps with small change in HA helper and Node-Red.

Turning it off will have param_value=0,
and turning it on will have param_value=1

Mind the parm_name=circle_status

But first, you need a different helper in HA. In this case I’ve selected a Toggle.

image

Here are the details.

Overview of the Node-Red flow.

In the events:state node, makes sure to select State Type as string this time.

Since the Home Assistant Toggle Helper is giving us on/off string in this case.

We need to change the JavaScript a little bit in the var paramValue section. This will translate on/off into 1 or 0.

// Define Query String Parameters
var topPage = 1;
var subPage = 5;
var action = 1;

// Prepare URL
msg.url = `https://cloud.kronoterm.com/jsoncgi.php?TopPage=${topPage}&Subpage=${subPage}&Action=${action}`

// Define Form Data
var paramName = "circle_status";
var paramValue = (msg.payload === "on") ? 1 : 0;  // Setting param_value based on the toggle payload
var page = 5;

// Prepare payload for application/x-www-form-urlencoded
msg.payload = `param_name=${paramName}&param_value=${paramValue}&page=${page}`;

// Set content type header
msg.headers = {
	'Content-Type': 'application/x-www-form-urlencoded'
};


// Return the message object to pass it to the next node
return msg;

Here’s how it should look like.

For the http request and Response nodes it’s the same as in the first example. Now after deploying, changing the toggle in HA helper should also change the value in Kronoterm Cloud.


5.) TYING IT ALL TOGETHER

In the end after you change the value in Home Assistant helper leading to change in Kronoterm Cloud, you can as well have the same flow trigger the data pull back to Home Assistant from Kronoterm Cloud.

For this I added the switch node. And I’m validating statusCode=200, just making sure that the call was successful. Then adding short delay node of 5 seconds, before I pull the data from Kronoterm Cloud.

image


6.) ONE MORE THING - UNUSED ENTITIES

Also, if you find yourself with a lot of unused entities in Home Assistant from node-red. And the Delete button is grayed out. It’s probably the reason, you have those entities still present in Node-Red under the unused section.

Make sure to check there… double click the ha-entity-config and delete it from there.

Hope this helps. :handshake:

1 Like

smartpodgurc thank you very much for your help :pray: :pray:

I have this error, what could it be in your opinion?

I’m trying to set the temperature circled below

the webpage of my system is different

is this one

https://cloud.kronoterm.com/dhws/

:grinning: :grinning: :grinning:

image

smartpodgurc,

is there a way to read the water temperature value?

thanks in advance,

Hey,

By the looks of your 200 response, you got it working. :clap:

To read your water temperature (I call it Kronoterm Sanitary Water Temperature) you can try this:

Kronoterm Cloud

You can also skip this step, and get/find the value directly in the Debug response in Node-Red.

Otherwise, same as before, go to the Chrome browser, login to the app, navigate to the page that contains the water temperature data and press F12.

  1. Go to Network
  2. Put TopPage in the Search
  3. Click one of the requests
  4. Navigate to Response
  5. Hit Ctrl+F, enter your water temperature number. It was 50.5 for me.
  6. See which variable holds the value. For me it’s tap_water_temp

Node-Red

  1. Enable Debug
  2. Expand TemperaturesAndConfig
  3. Navigate to tap_water_temp or whaterver you have
  4. Click the icon next to the value and click Copy path

  1. Add new home assistant entity - sensor and link it to the bottom of the switch node, like others

  1. Input a Name
  2. Add new Entity Config
  3. Paste the path you copied in step 4 above

image

  1. And below is my Entity Config for this sensor

image

Hope this helps. :crossed_fingers:

1 Like

Dear smartpodgurc,

thanks to your guide I was able to turn on/off and increase/decrease the temperature!!! and I am very grateful to you

unfortunately to continue with the “water temperature value”, as per your last post, I have to finish the first part of your guide which would be the return of information to HA, point 5.)

could you kindly give me some help?

this is my situation now

thank you very much in advance for your help, Danilo

Hey danilos2k,

has been great talking to you.

Posting here for others how’s possible to return the value to the helper entity of input_number & input_boolean. In example, when you change the Target Temperature in Kronoterm Cloud App, and want this value to reflect as well in the Home Assistant Helper Entity.

helper entity: input_number

First create a function, that will (in case it’s not already) transform string to number. In some cases the Kronoterm might return “20.6” (string), but in others 20.6 (number) without quotation marks.

msg.payload = Number(msg.payload.SystemData[1].calc_temp)
return msg;

Then use the action node and do the following:

  1. Set a Name
  2. Select a Server
  3. Use action input_number.set_value
  4. Select entity
  5. Make sure to select JSON
  6. write {"value":"{{payload}}"}

image


helper entity: input_boolean

Create a switch, that will capture the status of the pump. Returns 1 or 0.

Make sure to select a number from the dropdown.
image

Then just map correctly the values to the action node.

image

As action select input_boolean.turn_on.
Select the right entity.
And that’s it.

Repeat the same step for switch==0 and select input_boolean.turn_off in the action node.

:handshake:

1 Like

I would like to publicly thank @smartpodgurc, he helped me a lot on this forum and especially with 1h private call. He is a fantastic guy with a great sense of community and help for others.

thank you thank you very much !! :pray: :pray: :pray:

@smartpodgurc I tryed new code, with two way funciont, Now if I change the value of the sanitary water temperature and heating on the cloud it transmits the change! Excellent! But why if I change from the cloud in HA it doesn’t update the new value?

1 Like

I purchased a PW11 modbus to wifi interface ★Protoss-PW11. I connected it to the Adapt heat pump, A+, B-, GND and to the 12v terminals. I can access its WEB interface, but now I don’t know how to set it up. I think I set the Serial Port Settings correctly, according to the specifications from Kronoterm that I got from them, but I don’t have enough knowledge to establish communication via MODBUS. Please help me how to proceed.



I’ll share what I have in two weeks time. Traveling currently.

I recommend Modbus/TCP protocol with standard port 502 to be used connecting to your nearest WiFi access point. Setup serial baudrate to 19200 and then from Home Assistant try to ping the Protoss device. Try telnet protoss-IP port to check if it is open. Then try the following python script

#!/usr/bin/env python3
import pymodbus.client
pymodbus.pymodbus_apply_logging_config("DEBUG")
client = pymodbus.client.ModbusTcpClient('MyProtosDevice.lan') 
try:
    client.connect()
    rr = client.read_holding_registers(2100, 10, slave=20)
    print('KRONOTERM Temperatures:', [u'{:.1f}\N{DEGREE SIGN}C'.format(t/10) for t in rr.registers])
except pymodbus.ModbusException as exc:
    print(f"Received ModbusException({exc}) from library")
client.close()

It this works then you just change the line kronoterm2mqtt/kronoterm2mqtt/api.py at 6f50d4528feb848cabc3f9ecded9b6812c519316 · kosl/kronoterm2mqtt · GitHub to what it works for you and the rest should be working too.

I don’t know what I have wrong, but the script gives me an error in the 3rd line:

Traceback (most recent call last):
 File "/home/pi/Downloads/Kronoterm.py", line 3, and <module>
 pymodbus.pymodbus_apply_logging_config("DEBUG")
AttributeError: module 'pymodbus' has no attribute 'pymodbus_apply_logging_config'

import pymodbus
before that line


Hi Danilo, I have a pdc boiler, can you share your nodes?

I don’t understand how to generate entities

this is my debug

10/31/2024, 00:28:26node: debug
msg.payload : Object
Object
tableName: “Base”
ConnectionStatus: object
Module: 1
Cloud: 1
last_access: “31.10.2024 00:27:39”
dates: “31. 10. 2024”
time: “0:28:00”
StatusBar: object
default_mode: “0”
compressor_status: “0”
error_status: 0
warning_status: 0
active_program: “0”
add_src_status: “0”
reserve_source_status: “0”
holiday_mode_status: 0
remote_activation: 0
GlobalOverview: object
compressor_status: “0”
add_src_status: “0”
boiler_temp: “48.9”
ext_src_temp: “-327.6”
inlet_air_temp: “19.7”
desired_add_src: “1”
reserve_source_status: “0”
heat_source_priority: “0”
BasicData: object
boiler_calc_temp: “-3276.8”
default_mode: “1”
boiler_setpoint: “51.0”
boiler_eco_offset: -5
boiler_comf_offset: 2.5
boiler_temp_min: 20
boiler_temp_max: 55
result: “success”

Try this @wifi75.

https://pastecode.io/s/y9novxe0

the problem is that if I change the temperature from HA on the cloud it sets the new temperature, while if I change the temperature from the cloud on HA it doesn’t update the values, why?