evcc icon indicating copy to clipboard operation
evcc copied to clipboard

OCPP Error payload sampledValue 0

Open ElZetto opened this issue 4 weeks ago • 14 comments

Hi,

I'm new to evcc and not sure if it is really a bug, or if Sonnen is violating OCPP standard.

Hardware Setup

  • SonnenBatterie
  • Sonnen Home Charger 2 (I know its not in the list of supported devices yet)
  • Raspberry Pi

Software Setup

  • EVCC 0.210.2 in a docker container on a raspberry pi 3

Config Setup

This is where I get confused quite a bit. When I create a evcc.yaml I can only see the standard "start configuration" screen on the web UI. If I use the UI configuration, it does not alter the evcc.yaml on save. However, I found that it seems to be writing the changes in the sqlite3 dabase. Feels weird to have the config in two different places, but I get it. However, since only the UI config is showing anything I copy the sqlite3 dump into here:

id class type title icon product value
1 1 template     OCPP 1.6J kompatibel {"connector":"1","connecttimeout":"5m","meterinterval":"10s","stationid":"MYSTATIONID","template":"ocpp"}
2 5         {"charger":"db:1","circuit":"","defaultMode":"pv","meter":"","phasesConfigured":3,"soc":{"poll":{"mode":"charging","interval":3600000000000},"estimate":true},"thresholds":{"enable":{"delay":60000000000,"threshold":0},"disable":{"delay":180000000000,"threshold":0}},"title":"test","vehicle":""}
3 2 template     Sonnen sonnenBatterie {"defaultmode":"self-consumption","host":"IPADRESS","maxchargepower":"3300","port":"8080","template":"sonnenbatterie","usage":"grid"}

I know the config is not finalized, but it's a minimum working example. The behaviour stays the same if I add PV and battery.

The issue

I keep receiving error logs. Hundreds. Every 6 seconds. [ocpp ] ERROR 2025/11/30 19:17:20 ocpp message (653df3bd-8a4a-4d1b-8aa9-4ffc464e274f): PropertyConstraintViolation - Field Call.Payload.TransactionData[0].SampledValue must be minimum 1, but was 0 for feature StopTransaction ([2,"653df3bd-8a4a-4d1b-8aa9-4ffc464e274f","StopTransaction",{"meterStop":792981,"timestamp":"2025-11-30T13:14:01Z","transactionId":1764506865,"reason":"Local","idTag":"148ba065","transactionData":[{"sampledValue":[],"timestamp":"2025-11-30T13:14:01Z"}]}])

A quick chatgpt talk indicated that sending the payload with an empty array for 'sampledValue' seems to be violating standard.

However, when I set it up this afternoon for the first time it seemed to work for a few hours correctly (maybe not we had to leave to get food 😆 ). But at least it showed the charging power and the data was correct. Now it shows no data from the Wallbox in the UI. The logs are unfortunately gone, though.

Just wanted to check if there's anything I can do. I'm even willing to learn GO if you direct me at where to look in the src, because it feels like a potential quick fix.

Steps to reproduce

  1. Install fresh docker
  2. setup Sonnenbatterie and Sonnenhome Charger2 via UI

Configuration details

## evcc.yaml

meters:
  - name: my_grid
    type: template
    template: sonnenbatterie
    usage: grid
    host: IP # IP-Adresse oder Hostname
    port: 8080 # Port, optional
  - name: my_pv
    type: template
    template: sonnenbatterie
    usage: pv
    host: IP # IP-Adresse oder Hostname
    port: 8080 # Port, optional
  - name: my_battery
    type: template
    template: sonnenbatterie
    usage: battery
    host: IP # IP-Adresse oder Hostname
    port: 8080 # Port, optional
    token: # Token, API Token (benötigt für aktive Batteriesteuerung) (optional)
    capacity: 50 # Akkukapazität (kWh), optional
    maxchargepower: 3300 # Maximale Ladeleistung (W), Für erzwungenes Laden des Speichers. (optional)
    maxdischargepower: # Maximale Entladeleistung (W), Maximale Entladeleistung des Speichers. (optional)
    minsoc: 25 # Minimaler Ladestand (%), Untere Grenze beim Entladen der Batterie im normalen Betrieb (optional)
    maxsoc: 95 # Maximaler Ladestand (%), Oberes Limit beim Laden der Batterie aus dem Netz (optional)
    defaultmode: self-consumption # Standardmodus für die aktive Batteriesteuerung, Wechselrichter fällt nach einem Laden des Speichers oder Unterbinden der Entladung zurück auf diesen Modus. [self-consumption, time-of-use]


## evcc.db

id | class | type | title | icon | product | value
-- | -- | -- | -- | -- | -- | --
1 | 1 | template |   |   | OCPP 1.6J kompatibel | {"connector":"1","connecttimeout":"5m","meterinterval":"10s","stationid":"MYSTATIONID","template":"ocpp"}
2 | 5 |   |   |   |   | {"charger":"db:1","circuit":"","defaultMode":"pv","meter":"","phasesConfigured":3,"soc":{"poll":{"mode":"charging","interval":3600000000000},"estimate":true},"thresholds":{"enable":{"delay":60000000000,"threshold":0},"disable":{"delay":180000000000,"threshold":0}},"title":"test","vehicle":""}
3 | 2 | template |   |   | Sonnen sonnenBatterie | {"defaultmode":"self-consumption","host":"IPADRESS","maxchargepower":"3300","port":"8080","template":"sonnenbatterie","usage":"grid"}

Log details

`[ocpp  ] ERROR 2025/11/30 19:17:20 ocpp message (653df3bd-8a4a-4d1b-8aa9-4ffc464e274f): PropertyConstraintViolation - Field Call.Payload.TransactionData[0].SampledValue must be minimum 1, but was 0 for feature StopTransaction ([2,"653df3bd-8a4a-4d1b-8aa9-4ffc464e274f","StopTransaction",{"meterStop":792981,"timestamp":"2025-11-30T13:14:01Z","transactionId":1764506865,"reason":"Local","idTag":"148ba065","transactionData":[{"sampledValue":[],"timestamp":"2025-11-30T13:14:01Z"}]}])`

What type of operating system or environment does evcc run on?

Docker container

External automation

  • [x] I have made sure that no external automation like HomeAssistant or Node-RED is active or accessing any of the mentioned devices when this issue occurs.

Nightly build

  • [x] I have verified that the issue is reproducible with the latest nightly build

Version

0.210.2

ElZetto avatar Nov 30 '25 18:11 ElZetto

I was able to get a bit more out of it. I set up a completely new container and configured everythin in UI and it was working correctly. Showed charging power, etc. As soon as I restarted the server to save the configuration, the log shows as follows:

[CHARGEPOINTID] DEBUG 2025/11/30 20:05:00 waiting for chargepoint: 5m0s
[ocpp ] DEBUG 2025/11/30 20:05:01 charge point connected: CHARGEPOINTID
[CHARGEPOINTID] DEBUG 2025/11/30 20:05:14 failed configuring availability: Rejected
[ocpp ] ERROR 2025/11/30 20:05:30 ocpp message (1272f11e-a84b-4781-a7f3-e5e90bbccdd9): PropertyConstraintViolation - Field Call.Payload.TransactionData[0].SampledValue must be minimum 1, but was 0 for feature StopTransaction ([2,"1272f11e-a84b-4781-a7f3-e5e90bbccdd9","StopTransaction",{"meterStop":792981,"timestamp":"2025-11-30T13:14:01Z","transactionId":1764506865,"reason":"Local","idTag":"148ba065","transactionData":[{"sampledValue":[],"timestamp":"2025-11-30T13:14:01Z"}]}]) 

Edit:

Last update for today: It might in fact have been a bug from the wallbox. Seems like the soft restart of the wallbox's webUI might not have been sufficient and the wallbox was in some floating state (I've just noticed that the wallbox was also mentioned as "not ready" sometimes) A hard reset (popping the fuse) seems to have solved the issue for now. At least I don't get error messages every few seconds. I will keep this thread updated. Sorry for the inconvenience.

ElZetto avatar Nov 30 '25 19:11 ElZetto

Just another box that violates the OCPP specification. Vendor should fix their code to become compliant.

andig avatar Nov 30 '25 20:11 andig

Sonnen Home Charger 2 (I know its not in the list of supported devices yet)

We could easily add it.

Is Sonnen the real manufacturer? I do not think so.

Can you share the BootNotification and GetConfuguration responses from OCPP trace log?

premultiply avatar Nov 30 '25 20:11 premultiply

Nope. According to the requests piHole resolved it's calling webasto, which is also what your requested data shows. And it also looks like automatic phase switching is not enabled by the wallbox firmware? Though it is possible via Sonnen App. I've obfuscated some values that I assume to be sensitive. (<REDACTED>)

[
  2,
  "1134f673-9c24-4d1f-86c8-dbb11b1d4f64",
  "BootNotification",
  {
    "chargePointModel": "WB_MK3_EU_16A",
    "chargePointVendor": "Webasto",
    "chargePointSerialNumber": "MK3AC-WS100723",
    "firmwareVersion": "3.41.13",
    "iccid": "<REDACTED>",
    "imsi": "<REDACTED>",
    "meterSerialNumber": "MK3AC-WS100723",
    "meterType": "EICH"
  }
]

and

[
  3,
  "3776396639",
  {
    "configurationKey": [
      {
        "key": "ChargeProfileMaxStackLevel",
        "readonly": true,
        "value": "255"
      },
      {
        "key": "ChargingScheduleAllowedChargingRateUnit",
        "readonly": true,
        "value": "['Current', 'Power']"
      },
      {
        "key": "ChargingScheduleMaxPeriods",
        "readonly": true,
        "value": "50"
      },
      {
        "key": "ConnectorPhaseRotationMaxLength",
        "readonly": true,
        "value": "1"
      },
      {
        "key": "ConnectorSwitch3to1PhaseSupported",
        "readonly": true,
        "value": "False"
      },
      {
        "key": "GetConfigurationMaxKeys",
        "readonly": true,
        "value": "2000"
      },
      {
        "key": "LocalAuthListMaxLength",
        "readonly": true,
        "value": "256"
      },
      {
        "key": "MaxChargingProfilesInstalled",
        "readonly": true,
        "value": "10"
      },
      {
        "key": "MeterValuesAlignedDataMaxLength",
        "readonly": true,
        "value": "22"
      },
      {
        "key": "MeterValuesSampledDataMaxLength",
        "readonly": true,
        "value": "1"
      },
      {
        "key": "NumberOfConnectors",
        "readonly": true,
        "value": "1"
      },
      {
        "key": "ReserveConnectorZeroSupported",
        "readonly": true,
        "value": "False"
      },
      {
        "key": "SendLocalListMaxLength",
        "readonly": true,
        "value": "0"
      },
      {
        "key": "StopTxnAlignedDataMaxLength",
        "readonly": true,
        "value": "1"
      },
      {
        "key": "StopTxnSampledDataMaxLength",
        "readonly": true,
        "value": "1"
      },
      {
        "key": "SupportedFeatureProfiles",
        "readonly": true,
        "value": "Core,FirmwareManagement,RemoteTrigger,SmartCharging"
      },
      {
        "key": "SupportedFeatureProfilesMaxLength",
        "readonly": true,
        "value": "4"
      },
      {
        "key": "SecurityProfile",
        "readonly": true,
        "value": "1"
      },
      {
        "key": "WhitelistStorage",
        "readonly": true,
        "value": "0"
      },
      {
        "key": "WhitelistMaxLength",
        "readonly": true,
        "value": "256"
      },
      {
        "key": "WhitelistEntries",
        "readonly": true,
        "value": "0"
      },
      {
        "key": "WhitelistAvailable",
        "readonly": true,
        "value": "1"
      },
      {
        "key": "AuthorizeRemoteTxRequests",
        "readonly": false,
        "value": "False"
      },
      {
        "key": "AuthorizationCacheEnabled",
        "readonly": false,
        "value": "False"
      },
      {
        "key": "AllowOfflineTxForUnknownId",
        "readonly": false,
        "value": "False"
      },
      {
        "key": "BlinkRepeat",
        "readonly": false,
        "value": "0"
      },
      {
        "key": "ClockAlignedDataInterval",
        "readonly": false,
        "value": "5"
      },
      {
        "key": "ConnectionTimeOut",
        "readonly": false,
        "value": "60"
      },
      {
        "key": "ConnectorPhaseRotation",
        "readonly": false,
        "value": "0.Unknown"
      },
      {
        "key": "HeartbeatInterval",
        "readonly": false,
        "value": "240"
      },
      {
        "key": "LightIntensity",
        "readonly": false,
        "value": "100"
      },
      {
        "key": "LocalAuthListEnabled",
        "readonly": false,
        "value": "False"
      },
      {
        "key": "LocalAuthorizeOffline",
        "readonly": false,
        "value": "True"
      },
      {
        "key": "LocalPreAuthorize",
        "readonly": false,
        "value": "False"
      },
      {
        "key": "MaxEnergyOnInvalidId",
        "readonly": false,
        "value": "0"
      },
      {
        "key": "MeterValuesAlignedData",
        "readonly": false,
        "value": ""
      },
      {
        "key": "MeterValuesSampledData",
        "readonly": false,
        "value": "Power.Active.Import"
      },
      {
        "key": "MeterValueSampleInterval",
        "readonly": false,
        "value": "10"
      },
      {
        "key": "MinimumStatusDuration",
        "readonly": false,
        "value": "None"
      },
      {
        "key": "ResetRetries",
        "readonly": false,
        "value": "3"
      },
      {
        "key": "StopTransactionOnEVSideDisconnect",
        "readonly": false,
        "value": "True"
      },
      {
        "key": "StopTransactionOnInvalidId",
        "readonly": false,
        "value": "False"
      },
      {
        "key": "StopTxnAlignedData",
        "readonly": false,
        "value": "Energy.Active.Import.Register"
      },
      {
        "key": "StopTxnSampledData",
        "readonly": false,
        "value": "Energy.Active.Import.Register"
      },
      {
        "key": "TransactionMessageAttempts",
        "readonly": false,
        "value": "3"
      },
      {
        "key": "TransactionMessageRetryInterval",
        "readonly": false,
        "value": "5"
      },
      {
        "key": "UnlockConnectorOnEVSideDisconnect",
        "readonly": false,
        "value": "False"
      },
      {
        "key": "WebSocketPingInterval",
        "readonly": false,
        "value": "30"
      },
      {
        "key": "WhitelistEnabled",
        "readonly": false,
        "value": "0"
      },
      {
        "key": "LearningModeTimeout",
        "readonly": false,
        "value": "60"
      },
      {
        "key": "OcppMeterCurrent",
        "readonly": true,
        "value": "[0.0, 0.0, 0.0]"
      },
      {
        "key": "OcppMeterVoltage",
        "readonly": true,
        "value": "[228.44, 226.28, 227.76]"
      },
      {
        "key": "OcppMeterPower",
        "readonly": true,
        "value": "[0.0, 0.0, 0.0]"
      },
      {
        "key": "OcppMeterEnergy",
        "readonly": true,
        "value": "0"
      },
      {
        "key": "PowerBoardSerialNumber",
        "readonly": true,
        "value": ""
      },
      {
        "key": "ComBoardSerialNumber",
        "readonly": true,
        "value": "<REDACTED>"
      },
      {
        "key": "PowerBoardHardwareVersion",
        "readonly": true,
        "value": "1281"
      },
      {
        "key": "ComBoardHardwareVersion",
        "readonly": true,
        "value": "13"
      },
      {
        "key": "PowerBoardSoftwareVersion",
        "readonly": true,
        "value": "2.39.0"
      },
      {
        "key": "ComBoardSoftwareVersion",
        "readonly": true,
        "value": "3.41.13"
      },
      {
        "key": "VendorSerialNumber",
        "readonly": true,
        "value": "MK3AC-WS100723"
      },
      {
        "key": "ManufacturerSerialNumber",
        "readonly": true,
        "value": ""
      },
      {
        "key": "SupplyPhasesMaxLimit",
        "readonly": true,
        "value": "0"
      },
      {
        "key": "SupplyPhases",
        "readonly": true,
        "value": "0"
      },
      {
        "key": "ModelVariant",
        "readonly": true,
        "value": "WB_MK3_EU_16A_3P_CABLE_EICH"
      },
      {
        "key": "VendorName",
        "readonly": true,
        "value": "Webasto"
      },
      {
        "key": "ChargeBoxSerialNumber",
        "readonly": true,
        "value": ""
      },
      {
        "key": "ChargePointIdentity",
        "readonly": true,
        "value": "MK3AC-WS100723"
      },
      {
        "key": "ManufacturerName",
        "readonly": true,
        "value": "Webasto"
      },
      {
        "key": "ModelName",
        "readonly": true,
        "value": "MK3AC"
      },
      {
        "key": "ErrorCounter",
        "readonly": true,
        "value": "0"
      },
      {
        "key": "ActiveIssueIDs",
        "readonly": true,
        "value": "['CB03']"
      },
      {
        "key": "AvailableExternalMeterModules",
        "readonly": true,
        "value": "['Carlo Gavazzi - EM24 (TCP/IP)', 'TQ - EM420 (TCP/IP)', 'Eastron - SDM630/MCT (TCP/IP)', 'Siemens - 7KM2200-XXX (TCP/IP)']"
      },
      {
        "key": "publicKey",
        "readonly": true,
        "value": "<REDACTED>"
      },
      {
        "key": "ConfiguredBootNotificationInterval",
        "readonly": false,
        "value": "20"
      },
      {
        "key": "MaximumQueueLimit",
        "readonly": false,
        "value": "10000"
      },
      {
        "key": "BackendConnectionTimeout",
        "readonly": false,
        "value": "60"
      },
      {
        "key": "OcppQueueFullAsErrorState",
        "readonly": false,
        "value": "0"
      },
      {
        "key": "SSLModeClient",
        "readonly": false,
        "value": "1"
      },
      {
        "key": "ModBusMode",
        "readonly": false,
        "value": "0"
      },
      {
        "key": "ModBusPort",
        "readonly": false,
        "value": "502"
      },
      {
        "key": "ModBusCommunicationTimeOut",
        "readonly": false,
        "value": "60"
      },
      {
        "key": "ModBusConnection",
        "readonly": false,
        "value": "0"
      },
      {
        "key": "ModBusSafeCurrent",
        "readonly": false,
        "value": "[6, 6, 6]"
      },
      {
        "key": "FreeCharging",
        "readonly": false,
        "value": "False"
      },
      {
        "key": "ConnectionType",
        "readonly": false,
        "value": "5"
      },
      {
        "key": "OCPPBackendJSONURL",
        "readonly": false,
        "value": "ws://192.168.178.47:8887"
      },
      {
        "key": "OperatorCurrentLimit",
        "readonly": false,
        "value": "16.0"
      },
      {
        "key": "TcpWatchdogTimeout",
        "readonly": false,
        "value": "10"
      },
      {
        "key": "TimeUntilFreeChargingEnabled",
        "readonly": false,
        "value": "0"
      },
      {
        "key": "AsymmetricCurrentLimit",
        "readonly": false,
        "value": "0"
      },
      {
        "key": "GridType",
        "readonly": false,
        "value": "0"
      },
      {
        "key": "NtpServerUri",
        "readonly": false,
        "value": ""
      },
      {
        "key": "TimeZone",
        "readonly": false,
        "value": "UTC"
      },
      {
        "key": "TimeSource",
        "readonly": false,
        "value": "HeartBeat,NTP"
      },
      {
        "key": "ExternalMeterIp",
        "readonly": false,
        "value": "None"
      },
      {
        "key": "ExternalMeterPort",
        "readonly": false,
        "value": "502"
      },
      {
        "key": "CurrentLimitExternalMeter",
        "readonly": false,
        "value": "[16, 16, 16]"
      },
      {
        "key": "DlmFreeBuffer",
        "readonly": false,
        "value": "10"
      },
      {
        "key": "DlmRecalculationInterval",
        "readonly": false,
        "value": "30"
      },
      {
        "key": "RegisterRefreshInterval",
        "readonly": false,
        "value": "10"
      },
      {
        "key": "ExternalMeterModule",
        "readonly": false,
        "value": "Eastron - SDM630/MCT (TCP/IP)"
      },
      {
        "key": "PersistentLogLevel",
        "readonly": false,
        "value": "err"
      },
      {
        "key": "VolatileLogLevel",
        "readonly": false,
        "value": "err"
      },
      {
        "key": "OffPeakCharging",
        "readonly": false,
        "value": "False"
      },
      {
        "key": "OffPeakChargingWeekend",
        "readonly": false,
        "value": "False"
      },
      {
        "key": "OffPeakPeriod1Start",
        "readonly": false,
        "value": "09:00"
      },
      {
        "key": "OffPeakPeriod1Stop",
        "readonly": false,
        "value": "11:00"
      },
      {
        "key": "OffPeakPeriod2Start",
        "readonly": false,
        "value": "15:00"
      },
      {
        "key": "OffPeakPeriod2Stop",
        "readonly": false,
        "value": "17:00"
      },
      {
        "key": "ChargePointSerialNumber",
        "readonly": false,
        "value": "MK3AC-WS100723"
      }
    ],
    "unknownKey": []
  }
]

ElZetto avatar Nov 30 '25 21:11 ElZetto

Ok I can now reproduce the issue. As soon as you unplug the EV (can only test for ID.Buzz) the log gets spammed with the error. It does not matter if you use the key, the VW App, the car's media center, re-tagging your RFID or evcc to stop the charging. Everything's fine until you unplug. The only way to get the wallbox out of this spamming state is a hard reset. I can't test if it is still happening without RFID authorization, because if I deactivate RFID authorization in the Sonnen App, I still need to authenticate via RFID tag to start charging as soon as I switch back to evcc which is a weird behaviour on its own.

Guess it's more of a Sonnen-problem, which is unfortunate because until now their support was not really helpful, but I'll try my luck once again. If you chose to implement the wallbox, I'd be happy to support with testing, though.

ElZetto avatar Dec 01 '25 20:12 ElZetto

We could deactivate this validation if necessary.

andig avatar Dec 01 '25 21:12 andig

I don't think you should start violating standards just because other people do. I will simply set the log level higher to save my raspi's SD card. I learned a lot in the last days and it's very likely a firmware issue on wallbox site. Sorry for the inconvenience.

Edit: If you need any more support from my side for adding the charger2, let me know. Although it's working without phase switching as generic OCPP already.

ElZetto avatar Dec 04 '25 22:12 ElZetto

I need to bother you guys again. I figured out that the loop actually is not triggered by the wallbox alone, but also by evcc sending an error message and therefore requesting the data over and over again. The loop actually prevents further charging sessions so it's not sufficient to ignore the logs. Although you can sometimes restart the charging by selecting "schnell" option, the meter will always display 0.0 kW.

ElZetto avatar Dec 08 '25 22:12 ElZetto

https://github.com/evcc-io/evcc/issues/25708#issuecomment-3598924841

The error is due to violation of the ocpp spec. How about vendor dixing the problem?

andig avatar Dec 09 '25 06:12 andig

Yes, I'm in discussion with them. However, I'm almost sure they will not fix it. And even if they do, it's probably going to take a long time. They definitely need to fix their own app and backend first.

Anyway, I seem to have managed to get rid of the error with a minor change in the code that stops the min=1 validation of the sampledValue struct in types.go file in occp-go module. If everything's running smoothly in the next days, I'll close here.

ElZetto avatar Dec 10 '25 23:12 ElZetto

We‘re already using a fork of the ocpp module for this reason- happy to take a PR there if it works for you.

andig avatar Dec 11 '25 07:12 andig

Done. You can close here if/when PR 5 will be merged.

ElZetto avatar Dec 12 '25 20:12 ElZetto

Merged, need to update the version here- do you want to open PR for that?

andig avatar Dec 13 '25 12:12 andig

Sure, done.

ElZetto avatar Dec 13 '25 21:12 ElZetto

Fwiw: this was fixed

andig avatar Dec 25 '25 23:12 andig