# EmonHub support for Samsung Heatpump Monitoring via Modbus

**URL:** <https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154>\
**Category:** emonHub\
**Tags:** heatpumps\
**Created:** [24 August 2022 23:41 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154 "2022-08-24T23:41:06Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![redzer\_irl](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/r/7ea924/32.png) [@redzer\_irl](https://community.openenergymonitor.org/u/redzer_irl)\
**Post date:** [31 January 2023 18:12 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/21 "2023-01-31T18:12:01Z")

</div>

Where does the pump flow rate come from? Are you getting it directly from the Sika sensor?

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [31 January 2023 18:12 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/22 "2023-01-31T18:12:59Z")

</div>

> [@william1066](#):
>
> I have worked out that if you don’t use “write multiple holding registers” you get very strange results. Either nothing, or the value not updating.

If you can post what you have actually done, it may well help others (even if that has modified the interfacer).

---

<div class="post-metadata">

**Author:** ![william1066](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/w/3da27b/32.png) [@william1066](https://community.openenergymonitor.org/u/william1066)\
**Post date:** [31 January 2023 18:34 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/23 "2023-01-31T18:34:04Z")

</div>

I have two flow rate sensors, one in the pump pump about ±10% accuracy and the Sika sensor ±2% accurate. Both read via modbus.

I have the Grundfos Magna3 - as I wanted to be able to control and monitor the pump via modbus - have since decided, it is an extravagance I could have avoided. In any case it has the useful feature of being able to estimate the pump flow rate using the pressure sensors and [I assume] other data from the pump … I read this [estimated flow rate] via modbus.

I then decided to follow the path Glyn took, and added a modbus module to the samsung heat pump as well.

---

<div class="post-metadata">

**Author:** ![william1066](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/w/3da27b/32.png) [@william1066](https://community.openenergymonitor.org/u/william1066)\
**Post date:** [31 January 2023 18:43 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/24 "2023-01-31T18:43:05Z")

</div>

\*\* disclaimer \*\* messing with modbus may be unsafe, proceed at your own risk

Please read pages 17 and 18 in the manual “Modbus Interface Module MIM-B19N/MIM-B19NT”.

The two commands that I used were (please double check the Message Set IDs and their order before you execute these commands)  
mbpoll -m rtu -0 -r 6000 -b 9600 -d 8 -t 4:hex /dev/ttyUSB0 0x8238 0x8204  
mbpoll -m rtu -0 -r 7000 -b 9600 -d 8 -t 4:hex /dev/ttyUSB0 0x411E 0x42D7 0x42D6 0x4087 0x406C 0x42E9 0x42F1 0x4067

The version of mbpoll I used is is as follows.  
mbpoll/jammy,now 1.4.11+dfsg-2 amd64 [installed]  
command line utility to communicate with ModBus slave (RTU or TCP)

I am using the “Waveshare Industrial USB to RS485 Converter with original FT232RL”

One final note: I am not sure if this is permanent or needs to be run after each power cycle of the heat pump. Will test this on the weekend.

---

<div class="post-metadata">

**Author:** ![william1066](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/w/3da27b/32.png) [@william1066](https://community.openenergymonitor.org/u/william1066)\
**Post date:** [2 February 2023 09:00 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/25 "2023-02-02T09:00:49Z")

</div>

I have a fancy [and expensive] pump - Magna 3, with an ethernet modbus module installed, which estimates flow rate, but it is not as accurate as the Sika. When I setup the system I was not aware I would be able to get the Sika data without some [potentially risky] interventions such as “sharing” the cable out the Sika with the controller. Thanks to Glyns work, I was able to get there reasonably safely and quickly.

---

<div class="post-metadata">

**Author:** ![glyn.hudson](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/glyn.hudson/32/35003_2.png) [@glyn.hudson](https://community.openenergymonitor.org/u/glyn.hudson)\
**Post date:** [2 February 2023 17:55 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/26 "2023-02-02T17:55:20Z")

</div>

Ah thanks for reminding me, I had fixed this issue locally on my system but forgot to update the remote git repository, I’ve now pushed up my changes which do exactly as you describe to set all the registers at the same time. I now get real-time flow rate updates:

> <https://github.com/openenergymonitor/emonhub/commit/aa3b3c0500231734c727c79ff06ba49cf5d70406>

> [@redzer\_irl](#):
>
> Where does the pump flow rate come from? Are you getting it directly from the Sika sensor?

The data is coming from the Samsung outdoor unit via modbus which is in turn reading the flow rate from the Sika.

> [@william1066](#):
>
> I have two flow rate sensors, one in the pump pump about ±10% accuracy and the Sika sensor ±2% accurate. Both read via modbus.

Same here, I’ve also got a heat meter which has a flow sensor. The readings from the Sika via Samsung modbus match the Sontex heat meter readings very closely:

 ![Screenshot from 2023-02-02 17-47-58](https://community.openenergymonitor.org/uploads/default/original/3X/6/3/63865ba72fa19830de1038e939c3d0c1a02ee4c8.png)

> [@william1066](#):
>
> I have a fancy [and expensive] pump - Magna 3, with an ethernet modbus module installed,

Wow, I didn’t know such a pump existed. That’s very fancy 🥳

* * *

Once issue with Samsung modbus that i’ve not yet been able to solve is the fact that it cannot report negative temperature readings. When the outdoor temp drops below zero the Samsung outdootT reports a very large number `6552`. This sounds like some sort of variable overflow, but I can’t see any issue with the modbus reading code. Anyone got any ideas?

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [2 February 2023 17:59 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/27 "2023-02-02T17:59:49Z")

</div>

> [@glyn.hudson](#):
>
> When the outdoor temp drops below zero the Samsung outdootT reports a very large number `6552`

Two’s complement?

---

<div class="post-metadata">

**Author:** ![william1066](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/w/3da27b/32.png) [@william1066](https://community.openenergymonitor.org/u/william1066)\
**Post date:** [2 February 2023 22:40 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/28 "2023-02-02T22:40:43Z")

</div>

> [@glyn.hudson](#):
>
> Anyone got any ideas?

The minimal modbus documentation does mention two’s complement which aligns with what Brian suggested. But that would not be 6552 - probably a typo on your part.

---

<div class="post-metadata">

**Author:** ![glyn.hudson](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/glyn.hudson/32/35003_2.png) [@glyn.hudson](https://community.openenergymonitor.org/u/glyn.hudson)\
**Post date:** [6 February 2023 12:08 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/29 "2023-02-06T12:08:52Z")

</div>

Thanks, yes I think you’re right.

I’ve enabled the two’s complement conversion as per MinimnalModbus docs which is the modbus library emonhub is using: [Internal documentation for MinimalModbus — MinimalModbus 2.1.1 documentation](https://minimalmodbus.readthedocs.io/en/stable/internalminimalmodbus.html)

> <https://github.com/openenergymonitor/emonhub/commit/ebbaa96e71765f050177b0ccdf2c670b8aa992ca>

This should now be fixed, but I just need a cold night to test it!

> [@william1066](#):
>
> But that would not be 6552 - probably a typo on your part.

I’m definitely seeing 6551.5 on the Emoncms graph, but there’s a 10x scale factor applied, so the actual figure will be 65515, but possibly something else in Emoncms is limiting the value

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [6 February 2023 12:34 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/30 "2023-02-06T12:34:10Z")

</div>

> [@glyn.hudson](#):
>
> I’ve enabled the two’s complement conversion

> [@glyn.hudson](#):
>
> but I just need a cold night to test it!

does the devices Modbus docs say anything about the encoding?

I’ve thought for a while we should have ‘dev’ branches on all the Repos so changes that we are no 100% sure about go into dev for testing, moved to ‘master/main’ once OK and the Stable once part of a release.

Bit more work but stops relatively untested changes being commited directly to a branch, quite a few folk use.

---

<div class="post-metadata">

**Author:** ![glyn.hudson](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/glyn.hudson/32/35003_2.png) [@glyn.hudson](https://community.openenergymonitor.org/u/glyn.hudson)\
**Post date:** [7 February 2023 00:51 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/31 "2023-02-07T00:51:54Z")

</div>

> [@borpin](#):
>
> does the devices Modbus docs say anything about the encoding?

Not really, it just says `Celsius value x10 (-41℃ to 100℃)`.

> [@borpin](#):
>
> I’ve thought for a while we should have ‘dev’ branches on all the Repos so changes that we are no 100% sure about go into dev for testing, moved to ‘master/main’ once OK and the Stable once part of a release.
> 
> Bit more work but stops relatively untested changes being commited directly to a branch, quite a few folk use.

I added the integer reading section of MinimalModbus emonhub interfacer specifically for this Samsung interfacer, so I don’t think it will be used by many others. The only negative effect I can think of this change will limit the maximum positive integer from 65535 to 32767 which I can’t see being an issue. Thanks for your help.

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [7 February 2023 07:45 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/32 "2023-02-07T07:45:00Z")

</div>

[Modbus details — MinimalModbus 2.0.1 documentation](https://minimalmodbus.readthedocs.io/en/stable/modbusdetails.html#some-extensions-not-covered-by-the-official-standard)

If 65535 = -1, then 65515 = -20 = -2.0°C

That looks about right.

---

<div class="post-metadata">

**Author:** ![glyn.hudson](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/glyn.hudson/32/35003_2.png) [@glyn.hudson](https://community.openenergymonitor.org/u/glyn.hudson)\
**Post date:** [16 February 2023 13:30 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/33 "2023-02-16T13:30:53Z")

</div>

I can confirm the fix had worked, a couple of nights ago the temperature dropped below freezing and emonhub Samsung modbus correctly returned a negative reading 😀

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [16 February 2023 15:23 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/34 "2023-02-16T15:23:32Z")

</div>

Great.

I do think this needs the option for an integer and a signed int as you cannot assume everything will always be within the signed int range.

---

<div class="post-metadata">

**Author:** ![Michal\_S](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/michal_s/32/28455_2.png) [@Michal\_S](https://community.openenergymonitor.org/u/Michal_S)\
**Post date:** [7 February 2024 19:13 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/35 "2024-02-07T19:13:08Z")

</div>

Hi guys, I’ve seen you were able to get realtime flow reports. That’s great actually. I assume that power data are not possible to extract right? So the only way is power meter?

I have two questions though:

1. With real time flow monitoring it is possible to accurately calculate the COP so I don’t need heat meter? Or let’s say in some +/- 5% difference? Would be good for me.

2. @glyn.hudson Glyn, how were you able to extract those mod bus data so you know what is what? Is there some guide or I need to read the whole register and guess what is what? I would need to read and write, respectively need to modify weather compensation curve realtime time based on outer temperature. It’s available in some registers ?

Also one more question, in your python code you have this at the beginning ?

instrument.write\_registers(7005,[0x42E9, 0x42F1, 0x4067, 0x8204])

What is this doing? It’s writing something into registers? I’d like not to mess with writing command at the beginning 🙂

1. it is possible to somehow backup registers before I screw up something? Or it is possible to screw up something and make the pump paperweight ?

Thanks!

---

<div class="post-metadata">

**Author:** ![william1066](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/w/3da27b/32.png) [@william1066](https://community.openenergymonitor.org/u/william1066)\
**Post date:** [17 February 2024 10:07 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/36 "2024-02-17T10:07:02Z")

</div>

Hi Michael

> [@Michal\_S](#):
>
> instrument.write\_registers(7005,[0x42E9, 0x42F1, 0x4067, 0x8204])
> 
> What is this doing? It’s writing something into registers?

This is configuring the modbus adapter with additional commands to query the heatpump. Some have called these “hidden registers” infact they are documented in the manual [that I have] at the end,but just not enabled by default.

In terms of the question as to whether you need a heat meter, that will depend on what accuracy you need. I don’t have one [yet], as soon as budget allows I will install one.

> [@Michal\_S](#):
>
> it is possible to somehow backup registers before I screw up something? Or it is possible to screw up something and make the pump paperweight ?

I did not have any issues with configuring my modbus interface. Just be very very careful 🙂

I am also now adjusting the flow temperature and dhw target temp as well as on/off of my Samsung Gen6 via HA. No issue so far and about 14 months in.

William

---

<div class="post-metadata">

**Author:** ![glyn.hudson](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/glyn.hudson/32/35003_2.png) [@glyn.hudson](https://community.openenergymonitor.org/u/glyn.hudson)\
**Post date:** [17 February 2024 21:46 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/37 "2024-02-17T21:46:43Z")

</div>

> [@Michal\_S](#):
>
> it is possible to somehow backup registers before I screw up something? Or it is possible to screw up something and make the pump paperweight ?

Unlike some heatpumps where the control registers have been hacked/ reverse engineered, this is an [official documented modbus protocol by Samsung themselves](https://midsummerwholesale.co.uk/pdfs/mim-b19n-manual.pdf), therefore it’s designed to be used this way.

---

<div class="post-metadata">

**Author:** ![Michal\_S](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/michal_s/32/28455_2.png) [@Michal\_S](https://community.openenergymonitor.org/u/Michal_S)\
**Post date:** [22 February 2024 22:22 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/38 "2024-02-22T22:22:25Z")

</div>

> [@william1066](#):
>
> have any issues with configuring my modbus i

Thanks, it’s the document Glyn refers to ? What monitoring solution are you going to install ? I was looking at EmonHP Level 3 but it’s pretty expensive and not sure if it would give me some additional value. Not sure if Samsung inbuild monitoring is very precise, sometime it gives strange numbers and efficiency shows from 3 to 3.5 in 0 - 10C. Seems above 10 COP is displaying pretty same so not sure if it can be trusted.

> [@glyn.hudson](#):
>
> Unlike some heatpumps where the control registers have been hacked/ reverse engineered

Thanks, I’ve thought it some manual for airconditioners since there are parameters which makes no sense. For me I guess the only value I need to control is water outlet temperature. Not sure if it is possible to set directly, do you know ? Or Maybe I need to modify heating curve ? What I want to achieve is to set water outlet temperature at specific outside temperature. I need that up to 3C and above the water temperature is constant 45C. And below 3C I need it to follow weather curve. I guess this is possible with modbus and your python script ? Thx.

---

<div class="post-metadata">

**Author:** ![glyn.hudson](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/glyn.hudson/32/35003_2.png) [@glyn.hudson](https://community.openenergymonitor.org/u/glyn.hudson)\
**Post date:** [23 February 2024 00:23 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/39 "2024-02-23T00:23:03Z")

</div>

> [@Michal\_S](#):
>
> For me I guess the only value I need to control is water outlet temperature. Not sure if it is possible to set directly, do you know

Yes it is. Here’s an example

> <https://github.com/glynhudson/samsung-modbus-mim-b19n/blob/main/samsung-modbus.py#L137>

---

<div class="post-metadata">

**Author:** ![Michal\_S](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/michal_s/32/28455_2.png) [@Michal\_S](https://community.openenergymonitor.org/u/Michal_S)\
**Post date:** [23 February 2024 07:58 UTC](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154/40 "2024-02-23T07:58:19Z")

</div>

Hi Glyn, great thanks. But if you change the flow temperature what about weather compensation curve ? Do I need to disable this or how it works because I guess it would fight each other. Do you know if there are register to write weather curve values ? Maybe I could use this instead of setting flow temp.

[Previous page](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154.md?page=1)

[Next page](https://community.openenergymonitor.org/t/emonhub-support-for-samsung-heatpump-monitoring-via-modbus/21154.md?page=3)
