# Modbus TCP Communication Issues Between OpenEMS on UniPi and Windows Simulator

**URL:** <https://community.openems.io/t/modbus-tcp-communication-issues-between-openems-on-unipi-and-windows-simulator/10803>\
**Category:** Uncategorized\
**Created:** [April 11, 2026, 9:01pm UTC](https://community.openems.io/t/modbus-tcp-communication-issues-between-openems-on-unipi-and-windows-simulator/10803 "2026-04-11T21:01:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ALa8idi](https://community.openems.io/user_avatar/community.openems.io/ala8idi/32/2577_2.png) [@ALa8idi](https://community.openems.io/u/ALa8idi)\
**Post date:** [April 11, 2026, 9:01pm UTC](https://community.openems.io/t/modbus-tcp-communication-issues-between-openems-on-unipi-and-windows-simulator/10803/1 "2026-04-11T21:01:25Z")

</div>

We’ve deployed OpenEMS Edge and UI on a UniPi device (Base OS, Debian Trixie-based) and are running a Modbus TCP simulator on Windows 11 that emulates real energy assets across multiple ports.

The setup works correctly when using a Raspberry Pi (OpenEMS) and a Mac (simulator), but on UniPi we observe:

- Data not updating or showing incorrect/false values (e.g., Battery SoC)

- Intermittent or failed connectivity from Docker containers to the simulator’s IP

- Empty live/history views in OpenEMS UI

Felix logs currently show no errors. Previous issues (_Parsing Response failed_, _OpenemsException_, _Unable to set value_) were mitigated by adjusting data types/formatting in the simulator.

Modbus registers and components are correctly defined in OpenEMS. Connectivity tests confirm network reachability.

Any insights on Docker networking restrictions on UniPi Base OS, timing issues, or known incompatibilities with Modbus TCP setups would be greatly appreciated.

Thanks.

* * *

ON THE SIMULATOR (same registers are on OpenEMS)\*\*\*

**This is a smart meter register map:**

# Config (static)

- {address: 0x4003, name: modbus\_id, type: uint16, static\_value: 1}
- {address: 0x4004, name: baud\_rate, type: uint16, static\_value: 6}
- {address: 0x4007, name: software\_version, type: float32, static\_value: 1.03}
- {address: 0x4009, name: hardware\_version, type: float32, static\_value: 1.03}
- {address: 0x400F, name: combination\_code, type: uint16, static\_value: 1}
- {address: 0x4011, name: parity, type: uint16, static\_value: 0}
- {address: 0x4039, name: stop\_bits, type: uint16, static\_value: 1}

# Voltages

- {address: 0x5002, name: voltage\_l1, type: float32, unit: V,  
excel\_column: voltage\_l1, random\_min: 228.0, random\_max: 233.0}
- {address: 0x5004, name: voltage\_l2, type: float32, unit: V,  
excel\_column: voltage\_l2, random\_min: 228.0, random\_max: 233.0}
- {address: 0x5006, name: voltage\_l3, type: float32, unit: V,  
excel\_column: voltage\_l3, random\_min: 228.0, random\_max: 233.0}

# Currents

- {address: 0x500C, name: current\_l1, type: float32, unit: A,  
excel\_column: current\_l1, random\_min: 2.0, random\_max: 22.0}
- {address: 0x500E, name: current\_l2, type: float32, unit: A,  
excel\_column: current\_l2, random\_min: 2.0, random\_max: 22.0}
- {address: 0x5010, name: current\_l3, type: float32, unit: A,  
excel\_column: current\_l3, random\_min: 2.0, random\_max: 22.0}
- address: 0x5008  
name: current\_total  
type: float32  
unit: A  
derived: “current\_l1 + current\_l2 + current\_l3”

# Active power

- address: 0x5012  
name: active\_power\_total  
type: float32  
unit: kW  
derived: “(voltage\_l1\*current\_l1 + voltage\_l2\*current\_l2 + voltage\_l3\*current\_l3) / 1000”
- address: 0x5014  
name: active\_power\_l1  
type: float32  
unit: kW  
derived: “voltage\_l1 \* current\_l1 / 1000”
- address: 0x5016  
name: active\_power\_l2  
type: float32  
unit: kW  
derived: “voltage\_l2 \* current\_l2 / 1000”
- address: 0x5018  
name: active\_power\_l3  
type: float32  
unit: kW  
derived: “voltage\_l3 \* current\_l3 / 1000”

# Reactive power

- address: 0x501A  
name: reactive\_power\_total  
type: float32  
unit: kvar  
derived: “active\_power\_total \* 0.10”
- {address: 0x501C, name: reactive\_power\_l1, type: float32,  
derived: “active\_power\_l1 \* 0.10”}
- {address: 0x501E, name: reactive\_power\_l2, type: float32,  
derived: “active\_power\_l2 \* 0.10”}
- {address: 0x5020, name: reactive\_power\_l3, type: float32,  
derived: “active\_power\_l3 \* 0.10”}

# Apparent power

- address: 0x5022  
name: apparent\_power\_total  
type: float32  
unit: kVA  
derived: “math.sqrt(active\_power\_total\*\*2 + reactive\_power\_total\*\*2)”
- {address: 0x5024, name: apparent\_power\_l1, type: float32,  
derived: “math.sqrt(active\_power\_l1\*\*2 + reactive\_power\_l1\*\*2)”}
- {address: 0x5026, name: apparent\_power\_l2, type: float32,  
derived: “math.sqrt(active\_power\_l2\*\*2 + reactive\_power\_l2\*\*2)”}
- {address: 0x5028, name: apparent\_power\_l3, type: float32,  
derived: “math.sqrt(active\_power\_l3\*\*2 + reactive\_power\_l3\*\*2)”}

# Power factor

- address: 0x502A  
name: power\_factor  
type: float32  
derived: “active\_power\_total / max(apparent\_power\_total, 0.001)”
- {address: 0x502C, name: power\_factor\_l1, type: float32,  
derived: “active\_power\_l1 / max(apparent\_power\_l1, 0.001)”}
- {address: 0x502E, name: power\_factor\_l2, type: float32,  
derived: “active\_power\_l2 / max(apparent\_power\_l2, 0.001)”}
- {address: 0x5030, name: power\_factor\_l3, type: float32,  
derived: “active\_power\_l3 / max(apparent\_power\_l3, 0.001)”}

# Frequency

- {address: 0x503E, name: frequency, type: float32, unit: Hz,  
excel\_column: frequency, random\_min: 49.95, random\_max: 50.05}
- {address: 0x5132, name: freq\_l1, type: float32,  
random\_min: 49.95, random\_max: 50.05}
- {address: 0x5134, name: freq\_l2, type: float32,  
random\_min: 49.95, random\_max: 50.05}
- {address: 0x5136, name: freq\_l3, type: float32,  
random\_min: 49.95, random\_max: 50.05}

# Energy (cumulative)

# Energy (cumulative) - ALL changed to uint32 Wh

- address: 0x6000  
name: energy\_total  
type: uint32  
unit: Wh  
accumulate: active\_power\_total\_w # Must reference W, not kW  
initial\_value: 1500000 # 1500.0 kWh → 1,500,000 Wh

- address: 0x6010  
name: energy\_import  
type: uint32  
unit: Wh  
accumulate: active\_power\_total\_w  
initial\_value: 1480000

- address: 0x6020  
name: energy\_export  
type: uint32  
unit: Wh  
static\_value: 20000 # 20.0 kWh → 20,000 Wh

- address: 0x600A  
name: energy\_l1  
type: uint32  
unit: Wh  
accumulate: active\_power\_l1\_w  
initial\_value: 500000

- address: 0x600C  
name: energy\_l2  
type: uint32  
unit: Wh  
accumulate: active\_power\_l2\_w  
initial\_value: 500000

- address: 0x600E  
name: energy\_l3  
type: uint32  
unit: Wh  
accumulate: active\_power\_l3\_w  
initial\_value: 500000

- address: 0x6030  
name: reactive\_energy\_total  
type: uint32  
unit: Wh # Or use varh if OpenEMS expects it  
accumulate: reactive\_power\_total\_w  
initial\_value: 150000

# Virtual register to convert kW → W for accumulation

- address: 0xF100  
name: active\_power\_total\_w  
type: float32  
derived: “active\_power\_total \* 1000”

**This is a battery’s register map:**

# ── OpenEMS standard header (read-only, static) ───────────────────────

```
  - {address: 0, name: ems_hash, type: uint16, static_value: 0x6201}

  - {address: 1, name: block_length, type: uint16, static_value: 199}

  - {address: 2, name: ver_major, type: uint16, static_value: 2025}

  - {address: 3, name: ver_minor, type: uint16, static_value: 1}

  - {address: 4, name: ver_patch, type: uint16, static_value: 1}

  \# ── ESS state (222 / 0x00DE) ──────────────────────────────────────────

  - {address: 222, name: system_state, type: uint16, static_value: 0}

    \# 0=Ok, 1=Info, 2=Warning, 3=Fault

  \# ── SymmetricEss block ────────────────────────────────────────────────

  - address: 302 # 0x012E

    name: soc

    type: uint16

    unit: "%"

    \# SoC is updated by the simulator's internal integration loop.

    \# The static_value seeds the initial display; runtime value comes

    \# from self.state\["soc"\] which is written to this address each cycle.

    static_value: 60

  - {address: 303, name: grid_mode, type: uint16, static_value: 1}

    \# 1=On-Grid, 2=Off-Grid

  - address: 304 # 0x0130 ActivePower float32 (neg=charge, pos=discharge)

    name: active_power_w

    type: float32

    unit: W

    \# Driven by the charge_power_w setpoint from OpenEMS.

    \# Falls back to small random fluctuation if no setpoint received.

    derived: "charge_power_w if abs(charge_power_w) > 10 else random_uniform(-2000, 2000)"

  - {address: 306, name: reactive_power_var, type: float32, static_value: 0.0}

  - {address: 308, name: max_apparent_power, type: float32, static_value: 50000.0}

  - {address: 310, name: capacity_wh, type: float32, static_value: 116000.0}

  - {address: 312, name: charge_energy_wh, type: uint32, unit: Wh, 

     accumulate: active_power_w_charge, initial_value: 0, scale: 1}

  - {address: 316, name: discharge_energy_wh, type: uint32, unit: Wh,

     accumulate: active_power_w_discharge, initial_value: 0, scale: 1}

  \# ── ManagedSymmetricEss block ─────────────────────────────────────────

  - {address: 400, name: ess_hash2, type: uint16, static_value: 0xa3ed}

  - {address: 401, name: ess_block_length, type: uint16, static_value: 100}

  - {address: 402, name: min_power_setpoint, type: float32, static_value: -50000.0}

  - {address: 404, name: max_power_setpoint, type: float32, static_value: 50000.0}

  \# ── Virtual registers (helper values not in OpenEMS map) ─────────────

  - address: 0xF010

    name: active_power_w_charge

    type: float32

    derived: "abs(active_power_w) if active_power_w < 0 else 0"

  - address: 0xF012

    name: active_power_w_discharge

    type: float32

    derived: "active_power_w if active_power_w > 0 else 0"

  - address: 0xF000

    name: state_derived

    type: uint16

    derived: "1 if active_power_w < -10 else (2 if active_power_w > 10 else 0)"

    \# 0=Idle, 1=Charging, 2=Discharging

  - address: 0xF002

    name: power_kw

    type: float32

    unit: kW

    derived: "active_power_w / 1000"

  - address: 0xF004

    name: remaining_energy_kwh

    type: float32

    unit: kWh

    derived: "capacity_kwh \* soc / 100"

  - {address: 0xF006, name: pack_voltage, type: float32, static_value: 51.2}

  - address: 0xF008

    name: pack_current

    type: float32

    unit: A

    derived: "active_power_w / max(pack_voltage, 1)"

  - {address: 0xF00A, name: temperature, type: float32,

     random_min: 22.0, random_max: 35.0}

writable_registers:

  \# Primary setpoint — OpenEMS writes here to charge/discharge

  - address: 406 # 0x0196

    name: charge_power_w

    type: float32

    unit: W

    min: -50000

    max: 50000

    default: 0

    \# Negative = Charge, Positive = Discharge (OpenEMS convention)

  - {address: 408, name: set_reactive_power_var, type: float32,

     min: -50000, max: 50000, default: 0}

  - {address: 410, name: set_active_power_less, type: float32,

     min: 0, max: 50000, default: 50000}

  - {address: 412, name: set_reactive_power_less, type: float32,

     min: 0, max: 50000, default: 0}

  - {address: 414, name: set_active_power_greater, type: float32,

     min: -50000, max: -1, default: -50000}

  - {address: 416, name: set_reactive_power_greater, type: float32,

     min: -50000, max: 0, default: 0}

```

---

<div class="post-metadata">

**Author:** ![Howaner](https://community.openems.io/letter_avatar_proxy/v4/letter/h/87869e/32.png) [@Howaner](https://community.openems.io/u/Howaner)\
**Post date:** [April 15, 2026, 9:41am UTC](https://community.openems.io/t/modbus-tcp-communication-issues-between-openems-on-unipi-and-windows-simulator/10803/2 "2026-04-15T09:41:43Z")

</div>

Can you provide a wireshark dump of your modbus tcp connection?

You can create one with the following command on your unipi:

```auto
tcpdump -i <lan-interface> -s 65535 -w <target-file> host <ip-address-of-your-windows> and port <modbus-tcp-port>

```

---

<div class="post-metadata">

**Author:** ![ALa8idi](https://community.openems.io/user_avatar/community.openems.io/ala8idi/32/2577_2.png) [@ALa8idi](https://community.openems.io/u/ALa8idi)\
**Post date:** [April 24, 2026, 8:44am UTC](https://community.openems.io/t/modbus-tcp-communication-issues-between-openems-on-unipi-and-windows-simulator/10803/3 "2026-04-24T08:44:03Z")

</div>

Thank you for your response, we have solved that issue.
