# EVCC Device Inventory — Schön Consulting Homelab

## Network Topology

EVCC runs as HAOS add-on on HA VM 106 (10.0.30.10), port 7070.
Config: `/mnt/data/supervisor/homeassistant/evcc.yaml`

## Configured Devices

### Grid Meter
| Field | Value |
|-------|-------|
| Name | `grid` |
| Type | `custom` (Modbus registers) |
| URI | `10.0.50.201:502` |
| Modbus ID | 3 |
| Power register | 30865 (input, int32nan) |
| Energy register | 30529 (input, uint32nan, scale 0.001) |

### PV Inverters

#### pv1 — SMA Inverter (main roof)
- Template: `sma-inverter-modbus`
- Host: `10.0.50.201:502`
- Typical output: ~700W daytime

#### pv2 — SMA Inverter (secondary)
- Template: `sma-inverter-modbus`
- Host: `10.0.50.203:502`
- Typical output: ~350W daytime

#### hoymiles — Micro-inverter (balcony)
- Template: `hoymiles-opendtu`
- Host: `10.0.40.55` (OpenDTU web interface, HTTP API)
- Typical output: ~670W daytime

### Batteries

#### battery — SMA Sunny Boy Storage
- Template: `sma-sbs-modbus`
- Host: `10.0.50.202:502`
- Max charge power: 4200W
- Watchdog: 60s
- Capacity: ~2 kWh usable (reported)
- Status: Working ✓ (SOC 99%, power 286W as of 2026-06-27)

#### marstek — Marstek Venus E (bridged via HA REST API)
- Type: `custom` (HA REST API bridge — NOT template, NOT Modbus)
- Physical device: 10.0.50.113 (Modbus port 502 closed from EVCC network)
- HA integration: Working ✓ (reads via HA Modbus integration, all entities available)
- Bridged via HA entities:
  - power ← `sensor.marstek_venus_modbus_ac_leistung`
  - soc ← `sensor.marstek_venus_modbus_batterie_ladezustand`
  - energy ← `sensor.marstek_venus_modbus_gesamte_entladeenergie`
- Capacity: 5 kWh, maxchargepower: 2500W, maxdischargepower: 2500W
- Status: Working ✓ via HA bridge (verified 2026-06-27: power=0W, soc=100%, energy=336.34kWh)
- Controllable: No (read-only). For control, add `limitsoc`/`batterymode` setters targeting HA entities.

### Charger

#### wallbox — SMA EV Charger (bridged via HA)
- Type: `custom` (HA REST API bridge)
- Physical device: 10.0.50.205 (CN=SMA3010510346.local)
- HA reaches it via 192.168.100.95 (different VLAN)
- Direct EVCC connection fails: TLS cert without IP-SANs + SMA API returns 400
- Status: Working ✓ via HA bridge

### Tariff
- Provider: Tibber
- Token stored in EVCC config (not in 1Password — rotate if needed)

## Diagnostic Commands

```bash
# Full EVCC state
curl -s http://10.0.30.10:7070/api/state | python3 -m json.tool

# Quick health check — extract key metrics
curl -s http://10.0.30.10:7070/api/state | python3 -c "
import json, sys
d = json.load(sys.stdin)
print(f'Grid: {d[\"grid\"][\"power\"]}W')
for i, pv in enumerate(d.get('pv', [])):
    print(f'PV[{i}] ({pv[\"name\"]}): {pv[\"power\"]}W')
bat = d.get('battery', {})
print(f'Battery: {bat.get(\"power\")}W, SOC {bat.get(\"soc\")}%')
for dev in bat.get('devices', []):
    print(f'  {dev[\"name\"]}: {dev.get(\"power\")}W, SOC {dev.get(\"soc\")}, controllable={dev.get(\"controllable\")}')
"

# Check Marstek Modbus connectivity
python3 -c "
import socket
s = socket.socket(); s.settimeout(3)
try: s.connect(('10.0.50.113', 502)); print('OPEN')
except Exception as e: print(f'CLOSED: {e}')
finally: s.close()
"

# List HA Marstek entities
source ~/.hermes/.env
curl -s -H "Authorization: Bearer $HA_TOKEN" http://10.0.30.10:8123/api/states | \
  python3 -c "import json,sys; [print(f'{e[\"entity_id\"]}: {e[\"state\"]}') for e in json.load(sys.stdin) if 'marstek' in e['entity_id'].lower()]"
```

## EVCC Config File Locations on HAOS

```bash
# Find all copies
qm guest exec 106 -- find /mnt/data -name "evcc.yaml" -maxdepth 5

# Results:
# /mnt/data/supervisor/tmp/tmpXXXXXX/data/evcc.yaml          — temp, ignore
# /mnt/data/supervisor/homeassistant/evcc.yaml               — MAIN (referenced by config)
# /mnt/data/supervisor/app_configs/<hash>_evcc/evcc.yaml     — addon-managed copy
```
