I’ve recently got a Nibe Heatpump and the electrician installed a Siemens PAC2200 energy meter right before it. To monitor the work of the heatpump and later on control it to mostly use solar power, I’ve installed Home Assistant.
Now, I’d like to get the readings of the PAC2200 logged in HA. To do so, I’ve added the following to my configuration.yaml:
2023-07-17 23:17:03.179 DEBUG (SyncWorker_9) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)
2023-07-17 23:17:18.180 DEBUG (SyncWorker_5) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote slave/Unable to decode response
I’ve already experimented a bit with the address (54,55,56, 40055 and so on), because I’ve ready somwhere, that you had to add or substract 1. Neither helped here
Using the tool “Modbus poll”, I was able to read data from the device. So something seems to be wrong with my HA config. Can you please give me a hint on what could be wrong? Is there maybe a way to view the raw communication packet that HA sent out via Modbus TCP so I can compare them to the packet from the “Modbus poll”?
Having used the PAC3200 meters before (same register layout) elsewhere I know that we were reading register 56 for the frequency but it is a float IEEE reversed data type so I can only assume in HA you would need a data_type: custom and use structure: “<f” or “>f”. If I am reading the docs correctly < is little-endian and > is big-endian whilst f is 4 byte float. I am not sure of the correct syntax. This may help but equally I may be completely wrong.
and it displays a plausible value for the frequency. That’s why I went for float32 in the first place
Also, from my understanding, the wrong data type wouldn’t explain why I get a “0 byte” error from HA, right?
Is it important to add the “count: 2” when I already have a 2-byte datatype defined or is it enough to set the datatype and HA chooses to read 2 registers on its own?
I’d try to break this up into two parts. First let’s see if we can get HASS to read the register at all and then work on getting it to interpret the data.
sensors:
- name: test
address: 55
data_type: uint16
scan_interval: 10
If that works then verify you see the same value at that register in the other tool when reading a uint16. If not then it may be the off by one issue on the address.
If that works then try changing the data type to Float32 and see what happens.
I don’t think you’ll need to specify count, that could be the whole issue.
If you get the wrong value for the float there are some setting to swap the bytes, experiment with those.
to the configuration.yaml and restart! (I didn’t restart before but just reloaded the yaml files).
Anyway, that’s how I nailed down the problem on a byte level.
HA sents
0x0 0x4 0x0 0x0 0x0 0x6 0x0 0x3 0x0 0x37 0x0 0x1
but it should be
0x0 0x4 0x0 0x0 0x0 0x6 0x1 0x3 0x0 0x37 0x0 0x2
this brought me to the culprit here: Even though I changed the sensor parameters in the configuration.yaml, just reloading the yaml files didn’t do anything to the packet sent via modbus. You have to restart HA for the changes to take effect.
Long story short: The following configuration works fine for me