Polls a FoxESS H3 PRO inverter via Modbus TCP every 10 seconds and writes readings to InfluxDB 2.
| Field | Description | Unit |
|---|---|---|
battery_soc |
Battery state of charge | % |
battery_voltage |
Battery voltage | V |
battery_temp |
Battery temperature | °C |
battery_power |
Battery charge/discharge power (negative = charging) | kW |
inverter_temp |
Inverter temperature | °C |
load_power |
House load power | kW |
grid_ct |
Grid import/export via CT clamp (negative = export) | kW |
gen_load |
CT2 external generation (e.g. separate solar inverter) | kW |
pv1_power |
PV string 1 power | kW |
pv2_power |
PV string 2 power | kW |
- FoxESS H3 PRO inverter with Modbus TCP enabled (port 502)
- InfluxDB 2 instance
- Rust toolchain (for building)
All configuration is via environment variables.
| Variable | Required | Default | Description |
|---|---|---|---|
FOXESS_MODBUS_IP |
Yes | — | Inverter LAN IP address |
INFLUXDB_URL |
No | http://localhost:8086 |
InfluxDB base URL |
INFLUXDB_TOKEN |
No | foxess-local-token |
InfluxDB auth token |
INFLUXDB_ORG |
No | home |
InfluxDB organisation |
INFLUXDB_BUCKET |
No | inverter |
InfluxDB bucket |
DEBUG |
No | unset | Print register values to stdout each poll |
cargo build --releasebrew install messense/macos-cross-toolchains/aarch64-unknown-linux-gnu
rustup target add aarch64-unknown-linux-gnu
cargo build --release --target aarch64-unknown-linux-gnuBinary will be at target/aarch64-unknown-linux-gnu/release/foxess_feeder.
FOXESS_MODBUS_IP=192.168.0.x ./foxess_feederWith debug output:
DEBUG=1 FOXESS_MODBUS_IP=192.168.0.x ./foxess_feederOn startup the program prints one line once the first successful poll and InfluxDB write completes:
Connected to inverter and InfluxDB. Polling every 10s.
- Reconnects automatically if the Modbus TCP connection drops (30s delay between attempts)
- InfluxDB write failures are logged but do not trigger a reconnect
- Each Modbus read has a 15s timeout to handle half-open TCP connections
- Writes to the
invertermeasurement in InfluxDB line protocol
Create /etc/systemd/system/foxess-feeder.service:
[Unit]
Description=FoxESS inverter data feeder
After=network-online.target
Wants=network-online.target
[Service]
Environment=FOXESS_MODBUS_IP=192.168.0.x
Environment=INFLUXDB_URL=http://your-server:8086
Environment=INFLUXDB_TOKEN=your-token
ExecStart=/usr/local/bin/foxess_feeder
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetThen:
sudo systemctl enable --now foxess-feeder