evcc icon indicating copy to clipboard operation
evcc copied to clipboard

Creation of redundant loadpoints within Sunny Portal / Sunny Home Manager 2.0

Open fjt99 opened this issue 2 months ago • 2 comments

Description

The SMA Sunny Home Manager integration of SMA via the SEMP protocol leads to the creation of redundant loadpoints within the Sunny Portal. I have one wallbox, which is exposed to the Sunny Home Manager via EVCC and I have not changed anything about the standard configuration since it became enabled per default. I now have 3 different "Non-controllable loads" for the same wallbox, of which only one is actually displaying energy values. I know that there were only 2 when I checked the last time. In the event monitor of SMA I can see that it regularly registers "EM devices" but that was happening regularly before it created additional loadpoints. I cannot tell if the behavior is caused by SMA or by evcc. It might also be some artifacts of energy usage which were not correctly attributed to the wallbox. I'll try to attach screenshots. I cannot pinpoint to a specific date/time when the loadpoints were created. I registered the loadpoint once within the sunny portal after being promted about it, when evcc was setup.

Steps to Reproduce

  1. Run evcc
  2. Run SMA Sunny Home Manager
  3. Unwanted creation of additional redundant loadpoints after normal operation within Sunny Portal

Configuration (YAML)

plant: *****

Configuration (UI)

{
  "charger": [
    {"id":1,"name":"db:1","type":"template","config":{"template":"easee","charger":"EHEGAC2A","password":"***","timeout":"20s","user":"***"}}
  ],
  "experimental": true,
  "influx": {"database":"","insecure":false,"org":"","password":"","token":"","url":"","user":""},
  "interval": 10,
  "loadpoints": [
    {"id":2,"name":"db:2","batteryBoostLimit":20,"charger":"db:1","defaultMode":"pv","limitEnergy":0,"limitSoc":0,"maxCurrent":16,"minCurrent":6,"minSoc":0,"phasesConfigured":0,"planEnergy":0,"planPrecondition":0,"planStrategy":{"continuous":false,"precondition":0},"planTime":"0001-01-01T00:00:00Z","priority":0,"smartCostLimit":0,"smartFeedInPriorityLimit":null,"soc":{"estimate":false,"poll":{"interval":3600000000000,"mode":"connected"}},"thresholds":{"disable":{"delay":180000000000,"threshold":0},"enable":{"delay":60000000000,"threshold":0}},"title":"Easee Große Garage","ui":{"maxTemp":0,"minTemp":0}}
  ],
  "meter": [
    {"id":4,"name":"db:4","type":"template","config":{"id":3,"template":"sma-hybrid","chargepower":"","host":"192.168.178.55","maxacpower":"0","modbus":"tcpip","port":502,"usage":"pv","watchdog":"60s"},"deviceTitle":"Wechselrichter"},
    {"id":5,"name":"db:5","type":"template","config":{"id":3,"template":"sma-hybrid","baudrate":9600,"capacity":10.24,"chargepower":"","comset":"8N1","host":"192.168.178.55","maxacpower":10000,"maxchargepower":"","maxdischargepower":"","modbus":"tcpip","port":502,"usage":"battery","watchdog":"60s"},"deviceTitle":"Hausbatterie"},
    {"id":6,"name":"db:6","type":"template","config":{"template":"sma-home-manager","host":"192.168.178.33","usage":"grid"}}
  ],
  "mqtt": {"broker":"wss://mqtt.evcc-crowdscience.de/","caCert":"","clientCert":"","clientID":"","clientKey":"","insecure":false,"password":"","topic":"evcc/019c94b5-c4cc-7000-9784-48ff8684fc7c","user":""},
  "residualPower": 100,
  "shm": {"deviceId":"","deviceSerial":"","vendorId":""},
  "site": {"aux":null,"battery":["db:5"],"consumer":null,"curtail":["db:15"],"ext":null,"grid":"db:6","pv":["db:4"],"title":"So30"},
  "tariff": [
    {"id":8,"name":"db:8","type":"template","config":{"template":"fixed","price":0.078},"deviceProduct":"Fixed Price"},
    {"id":7,"name":"db:7","type":"template","config":{"template":"tibber","token":"***"},"deviceProduct":"Tibber"},
    {"id":10,"name":"db:10","type":"template","config":{"template":"open-meteo","ac":"1000","alphatemp":"-0.004","az":-135,"de":"0","dec":6,"dm":"0","efficiency":"100","interval":"1h","kwp":10.2,"lat":"***","lon":"***","rossmodel":"0.0342"},"deviceProduct":"Open-Meteo","deviceTitle":"PV-Küchendach"},
    {"id":16,"name":"db:16","type":"template","config":{"template":"open-meteo-temperature","interval":"1h","lat":"***","lon":"***"},"deviceProduct":"Open-Meteo Temperature"},
    {"id":11,"name":"db:11","type":"template","config":{"template":"open-meteo","ac":"1000","alphatemp":"-0.004","az":35,"de":"0","dec":90,"dm":"0","efficiency":"100","interval":"1h","kwp":3.48,"lat":"***","lon":"***","rossmodel":"0.0342"},"deviceProduct":"Open-Meteo","deviceTitle":"PV-Zaun"},
    {"id":9,"name":"db:9","type":"template","config":{"template":"grünstromindex","zip":"***"},"deviceProduct":"Grünstromindex"}
  ],
  "tariffRefs": {"co2":"db:9","feedIn":"db:8","grid":"db:7","planner":"","solar":["db:10","db:11"],"temperature":"db:16"},
  "vehicle": [
    {"id":12,"name":"db:12","type":"template","config":{"template":"tesla","accessToken":"***","autodetectdisabled":false,"cache":"15m","capacity":72,"clientId":"5d74d959-96fe-44aa-a683-d8e2afabeee8","climaterdisabled":false,"commandProxy":"https://api.myteslamate.com","icon":"car","mode":"pv","priority":0,"refreshToken":"***","title":"Model Y","vin":"***"},"deviceProduct":"Tesla"}
  ]
}

Logs

[lp-1  ] DEBUG 2026/09/21 17:37:40 charger status: A
[site  ] DEBUG 2026/09/21 17:37:50 ----
[lp-1  ] DEBUG 2026/09/21 17:37:50 charge power: 0W
[lp-1  ] DEBUG 2026/09/21 17:37:50 charge currents: [0 0 0]A
[site  ] DEBUG 2026/09/21 17:37:50 grid power: -2584W
[site  ] DEBUG 2026/09/21 17:37:50 grid powers: [-933 -944 -707]W
[site  ] DEBUG 2026/09/21 17:37:50 grid currents: [-4.04 -4.07 -3.29]A
[site  ] DEBUG 2026/09/21 17:37:50 battery 1 power: 0W
[site  ] DEBUG 2026/09/21 17:37:50 pv 1 power: 3157W
[site  ] DEBUG 2026/09/21 17:37:50 battery 1 soc: 100%
[site  ] DEBUG 2026/09/21 17:37:50 site power: -2484W
[lp-1  ] DEBUG 2026/09/21 17:37:50 charge total import: 7285.030kWh
[lp-1  ] DEBUG 2026/09/21 17:37:50 charger status: A
[site  ] DEBUG 2026/09/21 17:38:00 ----
[lp-1  ] DEBUG 2026/09/21 17:38:00 charge power: 0W
[lp-1  ] DEBUG 2026/09/21 17:38:00 charge currents: [0 0 0]A
[site  ] DEBUG 2026/09/21 17:38:00 grid power: -2569W
[site  ] DEBUG 2026/09/21 17:38:00 grid powers: [-920 -930 -720]W
[site  ] DEBUG 2026/09/21 17:38:00 grid currents: [-3.98 -4.01 -3.32]A
[site  ] DEBUG 2026/09/21 17:38:00 battery 1 power: 0W
[site  ] DEBUG 2026/09/21 17:38:00 pv 1 power: 3099W
[site  ] DEBUG 2026/09/21 17:38:00 battery 1 soc: 100%
[site  ] DEBUG 2026/09/21 17:38:00 site power: -2469W
[lp-1  ] DEBUG 2026/09/21 17:38:00 charge total import: 7285.030kWh
[lp-1  ] DEBUG 2026/09/21 17:38:00 charger status: A
Image Image

Version

v0.315.2

System

linux/amd64, CEST +02:00

fjt99 avatar Sep 21 '26 16:09 fjt99

Root cause

This looks like the same underlying issue as #28126, not a new bug.

hems/shm/shm.go generates the SEMP gateway's UPnP device UUID (uid) with a fresh random uuid.New() on every evcc start:

uid := uuid.New()
...
if cfg.DeviceSerial != "" {
    ...
    copy(uid[10:], b) // only patched if deviceSerial is explicitly configured
}

Only the charger's DeviceId (used in deviceID()) is derived deterministically from the machine id via UniqueDeviceID()/machine.ProtectedID. The gateway UUID that's advertised via SSDP and used as the device UDN (s.uid, see gatewayDescription()/run()) stays fully random across restarts unless shm.deviceSerial is explicitly set in the config.

Your posted config confirms this: "shm":{"deviceId":"","deviceSerial":"","vendorId":""} — no deviceSerial is configured. Every evcc restart therefore advertises a "new" gateway to the Sunny Home Manager, and depending on the machine (e.g. multiple NICs, Docker network changes) Sunny Portal ends up registering additional "Non-controllable load" entries for the same wallbox, as described in #28126.

Workaround

Set a fixed deviceSerial (12 hex characters) in the SHM config to pin the UDN across restarts:

shm:
  deviceSerial: "001122334455"  # any stable 12-hex-char value

This was the mitigation introduced in #28198, but it's opt-in rather than the default, so fresh setups still hit this by default.

Assessment

Affected file: hems/shm/shm.go (NewFromConfig, gatewayDescription, run). This is fixable by making the gateway UUID stable by default too (e.g. deriving its node bytes from the machine id the same way UniqueDeviceID() already does for the charger DeviceId, when deviceSerial isn't configured), but that's a deliberate default-behavior change the maintainers should weigh in on (see the tradeoff discussion already in the code comment and in #28126), so I'm not opening a PR for it here.

🤖 Generated with Claude Code

github-actions[bot] avatar Sep 21 '26 16:09 github-actions[bot]

I have the same problem with my installation in newest evcc version 0.316.1

philipp750 avatar Oct 03 '26 06:10 philipp750