-
Notifications
You must be signed in to change notification settings - Fork 29
configuration register
The whole modbus protocol can be configure by register.h. It´s implemented by json.
The first Level are the inverter type. The second Level are "configuration" and "data". Third Level are the data level and contains the items of available "id data" and "live data".
This section describes the behaviour of modbus protocoll of selected inverter
| Option | Example | Description |
|---|---|---|
| RequestLiveData | "#ClientID", "0x04", "0x00", "0x00", "0x00", "0x77"],["#ClientID", "0x04", "0x00", "0x78", "0x00", "0x77" | The Request message for Live Data. See hints below. |
| RequestIdData | ["#ClientID", "0x03", "0x00", "0x00", "0x00", "0x14"] | Same as RequestLiveData, but only one Request are implemented |
| LiveDataFunctionPos | 1 | At this position the function code is expect |
| LiveDataFunctionCode | 0x04 | This Code indicates livedata in byte string |
| IDDataFunctionPos | 1 | At this position the function code is expect |
| IdDataFunctionCode | 0x03 | This Code indicates IDdata in byte string |
| LiveDataStartsAtPos | 3 | At this position livedata bytes start |
| IdDataStartsAtPos | 3 | At this position IDdata bytes start |
| LiveDataErrorPos | 1 | At this position the error code is expect if Live Data was requested |
| LiveDataErrorCode | 0x83 | This code indicates an error of requeted Live data |
| IdDataErrorPos | 1 | At this position the error code is expect if ID Data was requested |
| IdDataErrorCode | 0x84 | This code indicates an error of requested ID Data |
| LiveDataSuccessPos | 1 | At this position the success code is expect if Live Data was requested |
| LiveDataSuccessCode | 0x03 | This code indicates a successful response of Live Data |
| IdDataSuccessPos | 1 | At this position the success code is expect if ID Data was requested |
| IdDataSuccessCode | 0x04 | This code indicates a successful response of ID Data |
It´s possible to request multiples, because only max 250 bytes are allowed to get back. So this item is designed as array of byte arrays. Each Message array will send, waiting 100ms, get response, waiting 1000ms and the next loop starts. Only after the last request message the whole concatinated response of all requests starts to parse. That means, the item positions are increasing.
If you want to add new items or change something it´s recommend to enable at least debug level 4.
there is a process implemented to get all avaialbe inverters from json. So a random item is picked up to get the json small. The selected item is: IdDataStartsAtPos. So please don´t change this name. Otherwise the Inverter selection list don´t work properly.
This section describes the available items of Inverter ID-Data.
The configured name "InverterSN" is showing at status webgiu page. Please don´t change the name.
This section describes the available items of Livedata.
| Option | Example | Mandantory / Optional | Description |
|---|---|---|---|
| position | [67, 68] | M | byte position in inverter answer |
| position2 | [69, 70] | O | like "position", used if negative value has his own register. Value at "position" must 0 to use "position2" |
| name | Input Energy Charge Today | M | internal unique name, this name is a part of mqtt topic name too |
| realname | InputEnergyChargeToday | O | a pretty writable name in webgui |
| datatype | float | M | need to convert from byte to target value. Possible datatypes: string, integer, float |
| factor | 0.1 | O | need to get the right value too |
| unit | kWh | O | only for showing in webgui |
| openwbtopic | openWB/set/houseBattery/W | O | send out the value twice with this additional topic. Activated if item is set as.active (-> page Item Config) |
- load test sketch "test_RS485_Solax_ESP32.ino in Arduino IDE
- Study your inverter modbus protocoll documentation carfully
- find out the first right "RequestLiveData" Request hex string without CRC at the end
- replace Hex String in the Sketch at "byte request[] =" with yours
- flash the sketch on your ESP
- now you should get back a sucessfully answer with a long hex string
you can use vscode with platformio or as the simplest way gitpod
- create a new section in JSON (->register.h), maybe use "Solax-X1" as template
- replace data in "config" section with your Request-Hex-Strings (see above) and the other parameters in the config section
- your can leave some data items in "data" section as template
- verify the whole JSON at jsonlint.com
- flash the sketch on your ESP and monitor serial output. Please don´t forget to switch debugmode at least to 4
- In WebGUI, page Raw Data, you should see the same hex-String output as in your example sketch
- find our right data positions of your preferred values according your inverter modbus protocoll documentation
- please keep in mind, the first 3 hex are headers, don`t count it while comparing it with your documentation
If you have a full working new or enhanced section, please contact me by creating a new issue in github to add this in my repo for sharing this to all
Growatt Inverter, live data, GridFrequency at position 37, datatype: uint16
- uint16 means 2 Bytes
- (position) 37 x 2 (byte) = (position) 74
- (position) 74 + 3 (byte header)) = (position) 77
- look in Rawdata at position 77 and 78
- you will find like this: 0x14 and 0x84
- Please use bin-dez-hex-umrechner.de
- 0x14, 0x84 = (hex) 1484 = (decimal) 4996
- in documentation, factor is 0.1Hz
- 4996 = 49,96Hz
- add this as new item in section "livedata"
{
"position": [77, 78],
"name": "GridFrequency",
"realname": "Grid Frequency",
"datatype": "float",
"factor": 0.01,
"unit": "Hz"
},
- Overview
- Schematic
- Start it
- Configuration
- Compiling firmware
- Advanced stuff
- Questions and Answers