Foxess Inverter Modbus

So… How to decode that?

You need to know where registers start

It’s just hex values

But

aa bb cc dd ee

How do you know if:

  • aa bb
  • bb cc
  • dd ee

If you have a static value in inverter, we can check.

Just convert decimal to hex and compare

From manual:

Data format explanation:
a) Frame Header:indicate the start byte, fixed data:7E7E.
b) Data Length:indicate the data pack length, include user data, data type is Uint16.
c) Function Code:indicate all function requirements and responses, please see below table in detail.
d) Timestamp: indicates the current time, in seconds.
e) User data: represents the monitoring data of the inverter.
f) Check Code:MODBUS CRC16 check, LSB first, don’t contain frame header.
g) Frame End:indicate the end byte for data pack, fixed bytes: E7E7.

https://tasmota.github.io/docs/Smart-Meter-Interface/

1 Like

I’m away from home right now. I’ll definitely have a go at decoding this weekend, though. There should be easy to identify bits (like voltage being close to 230), and then go from there. Seems like the first part of your example message is missing? It ends with e7/e7, but should also start with 7e/7e

I haven’t been able to get any message from my inverter with my esphome setup. Hope the new rs485 module will change that (arrives tomorrow). If not I perhaps will also order a elfin.

Those are all mesages that shown in HA MMQT mosquito, and they are repeated, as you can see (I removed serial nr.)…

Message 5 received on fox_modbus at 09:39:
b'~~\x06c#\xd3\xc4\x00VB10400there_was_serial\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00000000000000000000000000\x00\x00\x00\x00\x00\x00\x00\x00G\x91\xe7\xe7'

Message 4 received on fox_modbus at 09:38:
b'~~\x02c#\xd3\xa6\x00\xe8\x00\x00\x11\t\x00\x00\te\x00<\x13\x88\x05\xa1\tW\x00=\x13\x88\x05\xb1\ts\x00<\x13\x88\x05\xa9\x15r\x00F\x00\x00\rB\x00\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00(\x00(\x00(\x007\x00\x00U\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x16\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01B\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x00\x00\x00\x00\x03\xe7\xff|\x11\x0b\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01%\xdf\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00n/\xe7\xe7'

Message 3 received on fox_modbus at 09:38:
b"~~\x01c#\xd3\x88\x00l1.24\x00\x001.00\x00\x001.14\x00\x000.18\x00\x00\x00\x00T3\x00\x00\x00\x00\x00\x00T10-G3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'\x10\x00\x0e\x00\x001.24\x00\x001.00\x00\x001.14\x00\x000.18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff6\xe7\xe7"

Message 2 received on fox_modbus at 09:37:
b'~~\x06c#\xd3j\x00VB10400there_was_serial\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00000000000000000000000000\x00\x00\x00\x00\x00\x00\x00\x00Oz\xe7\xe7'

Message 1 received on fox_modbus at 09:37:
b'~~\x02c#\xd3L\x00\xe8\x00\x00\x10\xe2\x00\x00\t[\x00<\x13\x85\x05\x9b\tK\x00<\x13\x85\x05\x91\ti\x00<\x13\x85\x05\xa3\x15,\x00G\x00\x00\x0c\xdf\x00\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00(\x00(\x00(\x006\x00\x00U\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x16\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01?\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x00\x00\x00\x00\x03\xe7\xff}\x10\xe4\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01%\x85\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa2\x95\xe7\xe7'

Message 0 received on fox_modbus at 09:36:
b"~~\x01c#\xd3.\x00l1.24\x00\x001.00\x00\x001.14\x00\x000.18\x00\x00\x00\x00T3\x00\x00\x00\x00\x00\x00T10-G3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'\x10\x00\x0e\x00\x001.24\x00\x001.00\x00\x001.14\x00\x000.18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xb6\xe7\xe7"

I got this string from Easymodbus client, if I click any “Read” button every ~30sec:

7E 7E 02 63 23 ED AC 00 E8 00 00 17 E8 00 00 09 5B 00 55 13 87 07 F1 09 53 00 55 13 87 07 EA 09 63 00 55 13 87 07 F8 14 DA 00 60 00 00 0E 7F 00 1B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2C 00 2C 00 2C 00 82 00 00 55 5A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 50 78 00 10 00 00 00 00 00 1A 00 00 00 00 00 00 00 00 00 00 02 21 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 03 E7 FF 64 17 EA 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 3F E5 00 00 00 00 00 00 00 00 00 00 00 00 C6 63 E7 E7
1 Like

I believe I’ve got your message from your last post decrypted!
It’s giving all the realtime data.
I’m still on my phone and it’s getting a bit complicated, so I’ll wait till tomorrow when I’ve got acces to my PC to post my findings in detail.
Now we need to write a parser (which shouldn’t be too hard), and receive this string in HA somehow.

So, here’s what I was able to extract:

7E 7E	header	
02	function code	
63 23 ED AC	timestamp	september 16th 2022 03:29:48 GMT
00 E8	number of bits	
00 00	grid power	0W
17 E8	generation power	6120W
00 00	loads power	0W
09 5B	gridvoltage R	239,5V
00 55	gridcurrent R	8,5A
13 87	gridfrequency R	49,99Hz
07 F1	gridpower R	2033W
09 53	gridvoltage S	238,7V
00 55	gridcurrent S	8,5A
13 87	gridfrequency S	49,99Hz
07 EA	gridpower S	2026W
09 63	gridvoltage T	240,3V
00 55	gridcurrent T	8,5A
13 87	gridfrequency T	49,99Hz
07 F8	gridpower T	2040W
14 DA	PV 1 voltage	533,8V
00 60	PV 1 current	9,6A
00 00	PV 1 power	0W
0E 7F	PV 2 voltage	371,1V
00 1B	PV 2 current	2,7A
00 00	PV 2 power	0W
00 00	PV 3 voltage	0V
00 00	PV 3 current	0A
00 00	PV 3 power	0W
00 00	PV 4 voltage	0V
00 00	PV 4 current	0A
00 00	PV 4 power	0W
00 2C	boost temperature	44C°
00 2C	inverter temperature	44C°
00 2C	ambient temperature	44C°
00 82	todays yield	13kWh
00 00 55 5A	total yield	2185kWh
some more uninterresting Info		
C6 63	checksum	
E7 E7	footer	

What doesn’t add up though, is PV1 power and PV2 power both being 0W.
As I understand it, you were generating about 6120W of PV Energy at the moment you captured this message. The sum of PV1 power and PV2 power should be approximately 6120W (minus the loss resulting from transforming). I’m not sure why it isn’t…

Are these values plausible for your inverter? For example your current total yield should be a bit more than 2185kWh.

I’ll try to get some readings from my own inverter this weekend, hopefully. That will make troubleshooting at bit easier.

1 Like

Very good news! Data is obsoluly right. I have two inputs in my inventer, PV1 and PV2. Generation power is sum of both inputs power. Power of PV1 and PV2 not show in inventer a screen too, power of PV1 must be calculated of voltage and current of PV.

Power of PV1 and PV2 I can see in foxesscloud, I think, they calculated it from voltage and current data.

1 Like

yeah, it shouldn’t be a problem to calculate PV1 power and PV2 power.
PV1 power = 533.8 * 9.6 = 5124.5
PV2 power = 371.1 * 2.7 = 1002

PV1 + PV2 = 6126.5W → which corresponds with generated power and the cumulated power from the 3 phases.

I just don’t understand why the inverter doesn’t report this properly. It must be a bug?

Inventer send other data too, configuration and identification data, but I think that data not need fof importing in HA.

If you really need it, it shouldn’t be a problem to get it in HA.
But i’m honestly only interested in the realtime PV generation (PV1 + PV2), so i know when to turn on the heat pump :wink:

About PV wattage, I think is not a bug, it’s a peculiarities. of the software.
Generation power is power of PV panels, grid power is power send to grid.

Forexample, screenshots of realtime data from foxess aplication.


How are you planning to connect to HA?
My approach with Esphome is gathering nothing at all. Even with the new rs485 module @nikito7 suggested.
I thought i would at least see raw values in the logs (very_verbose), but i get nothing.

The RXD led on the rs485 module is blinking every 15 seconds, but i get no data. I only get this over and over:

[16:32:19][VV][api.service:355]: on_ping_request: PingRequest {}
[16:32:19][VV][api.service:043]: send_ping_response: PingResponse {}

I use Elfin-EW11, inventer send data every half of minute, or something similar… Need some modbus software, that can only receiving data over tcp… Some HA modbus software modification, that only listening modbus port and receiving data.

Other way, withing MQTT, but HA with mmqt mosquito receiving data like my first post:

Message 5 received on fox_modbus at 09:39:
b’~~\x06c#\xd3\xc4\x00VB10400there_was_serial\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00000000000000000000000000\x00\x00\x00\x00\x00\x00\x00\x00G\x91\xe7\xe7’

Is this data decodable?

I am not programmer, I not so good in parsers or something like this… :slight_smile:

Thats what i’m trying to create

There is a lot missing and a lot of noise. The other one was nice and clean. Definitely the way to go.

I’m no programmer either, just learning by doing at the moment :slight_smile:

Do you have to request the data you receive by easymodbus or does the inverter just stream the message continiously?
Are you connected to the COM-Port, or the Wifi-Port of the inverter?

Inverter just stream the messages continiously. There are three message blocks, that repeated.

I connected to Elfin-EW11 modbus to tcp port via wifi. Elfin-EW11 connected to inventer RS485 port.

That is what we need. Good hex values

Standard modbus in esphome cannot read that.

Maybe only with tasmota.

Because ther is no modbus request. Only responses.

And you need to skip header.

Tasmota scripting is something like this:

1,01040aUUuuUUuu@i4:1,Active Power Import ,W,Power,0
1,01040axxxxxxxxUUuuUUuu@i4:1,Active Power Export ,W,Active Power Export,0
1,01040axxxxxxxxxxxxxxxxUUuu@i4:1000,Power Factor ,φ,Factor,3

But my devices have active request.

So script is something different

https://tasmota.github.io/docs/Smart-Meter-Interface/