Documentation

read and control cFos Charging Manager via Modbus

In addition to HTTP and MQTT, the cFos Charging Manager also provides a Modbus API. This is modelled after SunSpec. You can specify a TCP port or COM port parameter and a Modbus ID under "SunSpec address settings" in the Charging Manager configuration. This causes the cFos Charging Manager to listen to the TCP port or COM port under the specified parameters and to the Modbus ID and Modbus ID + 1. General Charging Manager values, parameters, flags and variables are available under the Modbus ID. Devices set up in the Charging Manager (wallboxes and meters) can be queried under ID + 1. As Modbus function you can use 3 and 4 for reading and 6 and 16 for writing. Attention: On Raspberry, TCP ports below 1024 are reserved for programmes with admin rights. It is therefore better to select a higher port number, e.g. 1502.

The SunSpec Modbus specification states that the Modbus address range begins with an identifier "SunS" and then contains so-called SunSpec models. Each model has a model identification number at offset 0 and a length specification of the remaining registers belonging to the model at offset 1. The values of the model then follow from offset 2. Important: You should scan the SunSpec address range and always estimate the length at offset 1. Do not assume fixed lengths or fixed register addresses, as it is very likely that we will add further values to the models over time. Model 1 (Common) always comes first, with details of the manufacturer, version numbers, etc. Please download the SunSpec Modbus specifications from the SunSpec Alliance for detailed information. The SunSpec address range for the cFos Charging Manager starts with address 40000.

The cFos Charging Manager initially displays the following values as Model 213 (three phase meter, float) under the Modbus ID after the Common model:
Grid consumption
Total consumers
Total generators
PV surplus
Utilised wallbox power
Available wallbox power
Fault power

This is followed by "custom" model 60000 with setting parameters of the cFos Charging Manager: 8 float values currently follow after model and length: Maximum total current, reserve, overdraw, maximum total wallbox current in mA per phase, maximum phase imbalance (in mA), load management active (1 = active, 0 = inactive), imbalance incl. consumers (1 = active, 0 = inactive), load management active (1 = active, 0 = inactive), load management inactive (1 = active, 0 = inactive), load imbalance incl. consumers (1 = active, 0 = inactive). Load (1 = active, 0 = inactive), maximum total current in per cent. These are the global Charging Manager parameters that can also be set in the UI. Changes to these values are saved (with a maximum delay of 150 seconds). The total current in per cent can be used, for example, to dynamically adjust the charging power at the request of the grid operator.

This is followed by "custom" model 60001. 32 registers (16bit) follow the model and length. These can contain the values 0 and 1 and read or write up to 32 Charging Manager flags. The status of these flags can then be queried in formulae using CM._flag1 to CM._flag32 and used for calculations.

This is followed by "custom" model 60002, followed by possible Charging Manager variables after model and length. There are 22 registers available for each variable. The first 20 registers are a Modbus string for the variable name (names that are too long are truncated). The following 2 registers contain the current float value of the variable. If you write the float value of a Charging Manager variable, you delete any existing formula and set the variable to a fixed value.

Under Modbus ID + 1, meters and wallboxes set up in the Charging Manager are displayed as follows. Wallboxes exchange as SunSpec model 113 extended by 2 16 bit registers. Offset 62 contains the status of the wallbox (1=waiting, 2=plugged in, 3=charging, 4=charging with ventilation, 5=error) and offset 63 contains the device ID. 1 = E1, 2 = E2, etc. Counters are displayed with the model 213 extended by 2 16 bit registers. Offset 126 contains the role of the meter (0=display, 1=consumption, 2=generation, 3=grid consumption, 4=electric car consumption, 5=storage home, 6=storage all), offset 127 contains the device ID (-1 for M1, -2 for M2, etc.). If the meter is a storage device (role 5 or 6), model 213 is followed by model 124, which is extended by a 16-bit register. Offset 26 again contains the device ID. To display devices under Modbus ID + 1, you must activate "Publish device information via Modbus" in the device settings.

Aufstellung Start-Addressen der Modelle:
Modbus ID:
Model: 1, Addr: 40002
Model: 213, Addr: 40070, Netzbezugszähler
Model: 213, Addr: 40196, Summe Verbraucher
Model: 213, Addr: 40322, Sume Erzeuger
Model: 213, Addr: 40448, PV Überschuss
Model: 213, Addr: 40574, Genutzte Wallboxleistung
Model: 213, Addr: 40700, Verfügbare Wallboxleistung
Model: 213, Addr: 40826, Fehler-Leistung
Model: 60000, Addr: 40952
Model: 60001, Addr: 40970
Model: 60002, Addr: 41004
Die konkreten Start-Addressen können bei späteren Versionen des cFos Charging Managers variieren, daher sollte der Register-Bereich, wie oben beschrieben, gescannt werden.
Modbus ID + 1:
Modelle und Startadressen hängen von den eingeblendeten Geräten ab.

List of values for model 213:
Offset 0: 213
Offset 1: Length
Offset 2: Total currents L1-L3 (A)
Offset 4: Current L1 (A)
Offset 6: Current L2 (A)
Offset 8: Current L3 (A)
Offset 10: Voltage (V)
Offset 12: Voltage L1 (V)
Offset 14: Voltage L2 (V)
Offset 16: Voltage L3 (V)
Offset 26: 50 Hz
Offset 28: Power (W)
Offset 30: Power L1 (W)
Offset 32: Power L2 (W)
Offset 34: Power L3 (W)
Offset 36: Apparent power (VA)
Offset 38: Apparent power L1 (VA)
Offset 40: Apparent power L2 (VA)
Offset 42: Apparent power L3 (VA)
Offset 44: Reactive power (VAr)
Offset 60: Export, active power (Wh)
Offset 68: Import, active power (Wh)
Offset 126: Role (for Modbus ID + 1)
Offset 127: Device ID (for Modbus ID + 1)

List of values for model 113:
Offset 0: 113
Offset 1: Length
Offset 2: Total currents L1-L3 (A)
Offset 4: Current L1 (A)
Offset 6: Current L2 (A)
Offset 8: Current L3 (A)
Offset 16: Voltage L1 (V)
Offset 18: Voltage L2 (V)
Offset 20: Voltage L3 (V)
Offset 22: Power (W)
Offset 24: 50 Hz
Offset 26: Apparent power (VA)
Offset 32: Import, active power (Wh)
Offset 62: Status (for Modbus ID + 1)
Offset 63: Device ID (for Modbus ID + 1)

List of values for model 124:
Offset 0: 124
Offset 1: Length
Offset 2: Max of charging/discharging power (W)
Offset 3: Percent of current charging power limit
Offset 4: Percent of current discharging power limit
Offset 8: State of charging in per cent
Offset 18: Scaling factor for offset 2
Offset 19: Scaling factor for Offset 3 and 4
Offset 26: Device ID (for Modbus ID + 1)

List of values for model 60000:
All values in float, read/write access, causes the flash to be updated, i.e. do not change often to avoid damage.i.e. do not change often to avoid damage.
Offset 0: 60000 (unt16, read-only)
Offset 1: Length (uint16, read-only)
Offset 2: Max. Total current (mA)
Offset 4: Power Reserve (mA)
Offset 6: Overdraw (mA)
Offset 8: Max Wallbox total current (mA)
Offset 10: Max. Phase imbalance (mA)
Offset 12: 1 = Load management active, 0 = inactive
Offset 14: 1 = Add home consumption to imbalance, 0 = inactive
Offset 16: Percent of max. total current, is not saved, can be changed frequently.

List of values for model 60001:
All values 0 or 1, int16, read/write access, are not saved, can be changed frequently.
Offset 0: 60001 (uint16, read-only)
Offset 1: Length (uint16, read-only)
Offset 2: CM._flag1
...
Offset 33: CM._flag32

List of values for model 60002:
All values float, read/write access, are not saved, can be changed frequently. Offset 0: 60002 (uint16, read-only)
Offset 1: Length (uint16, read-only)
Offset 2..22: Name Charging Manager Variable 1
Offset 23..24: Value Charging Manager Variable 1
Offset 25..45: Name Charging Manager Variable 2
Offset 46..47: Value Charging Manager Variable 2
...