evcc icon indicating copy to clipboard operation
evcc copied to clipboard

Zendure SolarFlow: grid charge command fails with 401 (Unauthorized), other battery mode writes unaffected

Open FuZzz22 opened this issue 2 months ago • 9 comments

Description

When enabling "Netzladen" (grid charge / force-charge from grid) for a Zendure SolarFlow 800 Pro2 battery configured via evcc's native Zendure template, evcc fails to write the command to the local API. Every write attempt to /properties/write while grid charge is active returns 401 (Unauthorized).

Important: this appears specific to the grid charge command. When "Netzladen" is disabled, no 401 errors occur — reading meter values (PV power, battery power, SOC) works without errors. The "hold discharge" command (triggered when a fast/planned EV charge starts) also works correctly without any 401 errors. The error only appears while the grid charge feature is toggled on and evcc attempts to enforce it.

Additional context ruling out a device-side/auth-pairing issue:

The device was correctly paired for local API access via the Zendure app (added to HEMS, then removed again, as documented in evcc's setup instructions). The serial parameter is correctly configured in evcc.yaml. Restarting evcc, and repeating the HEMS add/remove pairing cycle in the Zendure app, does not resolve the issue. A separate, unofficial Home Assistant integration (Zendure-HA, using zenSDK) can successfully write arbitrary commands (including output power) to the same device's local API without authentication errors — ruling out a device-side/firmware auth problem in general.

This suggests the issue is specific to how evcc constructs/authenticates the grid-charge write request for this device template, not a general auth or pairing problem.

Steps to Reproduce

  1. Configure a Zendure SolarFlow 800 Pro2 as a battery meter using the native Zendure template (host + serial set, paired via HEMS add/remove as documented).

  2. Confirm normal operation: reading works, no errors in log; "hold discharge" during EV fast charge also works without errors.

  3. Enable "Netzladen" (grid charge) in the evcc UI for this battery.

  4. Observe the logs — 401 errors appear repeatedly, roughly every control cycle (~27–30s), for as long as grid charge is enabled.

  5. Disable "Netzladen" again — errors stop.

⚠️ RETURN TO EVCC TAB → COPY STEP 2 → PASTE HERE

Version

v0.316.0

System

linux/amd64, CEST +02:00

Configuration (YAML)

# open evcc at http://evcc.local:7070
network:
  schema: http
  host: evcc.local # .local suffix announces the hostname on MDNS
  port: 7070
log: debug
levels:
  cache: error
# unique installation id
plant: *****
interval: 30s # control cycle interval
sponsortoken: *****
# sponsors can set telemetry: true to enable anonymous data aggregation
# see https://github.com/evcc-io/evcc/discussions/4554
telemetry: false
meters:
- name: grid1
  type: template
  template: shelly-pro-3em
  usage: grid
  host: 192.168.178.37 # IP-Adresse oder Hostname
  user: *****
  password: *****
- type: template
  template: fritzdect 
  usage: pv  
  uri: *****
  user: *****
  password: *****
  ain: *****
  name: pv1
chargers:
- type: template
  template: heidelberg 
  id: 1  
  device: /dev/ttyUSB0  
  baudrate: 19200  
  comset: 8E1  
  modbus: rs485serial  
  name: wallbox4
vehicles:
- name: mini
  type: template
  template: cardata
  title: Cooper SE # Titel, Wird in der Benutzeroberfläche angezeigt (optional)
  capacity: 32 # Akkukapazität (kWh), optional
  vin: *****
  clientid: af0e841f-e78a-43fe-bb6f-d9e1f8fbece7 # Client ID
loadpoints:
- title: Zu Hause
  charger: wallbox4
  vehicle: mini
  mode: pv
  mincurrent: 6
  maxcurrent: 16
site:
  title: Mein Zuhause
  meters:
    grid: grid1
    pv:
    - pv1
tariffs:
  grid:
    type: template
    template: tibber
    token: *****
    homeid: b3470004-4ee9-45a4-b48e-481f2a28f3ba
  solar:
    type: template
    template: forecast-solar
    lat: *****
    lon: *****
    dec: 60 # 0 = horizontal, 90 = vertikal
    kwp: 0.8
    az: -36 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden
  co2:
    type: template
    template: electricitymaps-free
    token: *****
    zone: DE # siehe https://api.electricitymap.org/v3/zones

Configuration (UI)

{
  "charger": [],
  "experimental": true,
  "influx": {"database":"","insecure":false,"org":"","password":"","token":"","url":"","user":""},
  "interval": 30,
  "loadpoints": [],
  "meter": [
    {"id":2,"name":"db:2","type":"template","config":{"template":"zendure-solarflow-pro","cache":1000000000,"host":"192.168.178.76","maxacpower":"800","usage":"pv"},"deviceProduct":"Zendure Solarflow 800 Pro","deviceTitle":"Zendure PV"},
    {"id":11,"name":"db:11","type":"template","config":{"template":"zendure-solarflow-battery","cache":"1s","capacity":1.92,"host":"192.168.178.76","serial":"***","usage":"battery"},"deviceProduct":"Zendure Solarflow AC / Pro","deviceTitle":"Batterie"}
  ],
  "mqtt": {"broker":"","caCert":"","clientCert":"","clientID":"","clientKey":"","insecure":false,"password":"","topic":"evcc","user":""},
  "residualPower": 0,
  "shm": {"deviceId":"","deviceSerial":"","vendorId":""},
  "site": {"aux":null,"battery":["db:11"],"consumer":null,"curtail":null,"ext":null,"grid":"grid1","pv":["pv1","db:2"],"title":"Mein Zuhause"},
  "tariffRefs": {"co2":"","feedIn":"","grid":"","planner":"","solar":null,"temperature":""},
  "vehicle": []
}

System State

{
  "apiReady": true,
  "authProviders": {"BMW/Mini (Cooper SE)":{"id":"af0e841f-e78a-43fe-bb6f-d9e1f8fbece7-ed99f3dd","authenticated":true}},
  "aux": [],
  "battery": {
    "capacity": 1.92,
    "devices": [{"name":"db:11","capacity":1.92,"controllable":true,"power":-118,"soc":9,"title":"Batterie"}],
    "power": -118,
    "soc": 9.000000000000002
  },
  "batteryDischargeControl": true,
  "batteryGridChargeActive": true,
  "batteryGridChargeLimit": 0.346,
  "batteryGridDischarge": false,
  "batteryGridDischargeActive": false,
  "batteryMode": "unknown",
  "bufferSoc": 100,
  "bufferStartSoc": 0,
  "config": "/config/evcc.yaml",
  "currency": "EUR",
  "database": "/data/evcc.db",
  "deviceColors": [],
  "eebus": {"config":{"certificate":{"private":"***","public":"-----BEGIN CERTIFICATE-----
MIIBvDCCAWKgAwIBAgIQe8UgSxLy2yR2nuarGygpLTAKBggqhkjOPQQDAjA+MQsw
CQYDVQQGEwJERTENMAsGA1UEChMERVZDQzEJMAcGA1UECxMAMRUwEwYDVQQDDAxF
VkNDX0hFTVNfMDEwHhcNMjYwNTA1MTQyNDE4WhcNMzYwNTAyMTQyNDE4WjA+MQsw
CQYDVQQGEwJERTENMAsGA1UEChMERVZDQzEJMAcGA1UECxMAMRUwEwYDVQQDDAxF
VkNDX0hFTVNfMDEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS3PDZzqwxNJ/eA
NsKVh7NzNDxcichJ5ye85uaOYQjGvtqH2jwEzkOA2iuZHpUdxZH4W1QNRcH8w5dO
TFYdWPhxo0IwQDAOBgNVHQ8BAf8EBAMCB4AwDwYDVR0TAQH/BAUwAwEB/zAdBgNV
HQ4EFgQUpAf6l5FhvDTEALQsCVC+O+CV/mEwCgYIKoZIzj0EAwIDSAAwRQIgMfvi
NvCEgW/+jo40og45Aw2HafVQYfM7gYcewtIbaZoCIQDTXah0UUkXCpaltbRQNQZk
lxD/pKmDpTvWwLOOmyPbgg==
-----END CERTIFICATE-----
"},"port":4712,"shipid":"EVCC-3238366166626235"},"status":{"qr":"SHIP;SKI:a407fa979161bc34c400b42c0950be3be095fe61;ID:EVCC-3238366166626235;BRAND:EVCC;TYPE:EnergyManagementSystem;MODEL:HEMS;SERIAL:EVCC-3238366166626235;CAT:2;FPH256:9FD5C1E549C2F6C681BDB6DE461BD6E35675ABAA7CC03866AFD6DCD41A86EE0D;SPSEC:B301ECA568AC42657FF8B224C8555BA4;ENDSHIP;","ski":"a407fa979161bc34c400b42c0950be3be095fe61"}},
  "experimental": true,
  "ext": [],
  "forecast": {
    "co2": [[1790236800,1790237700,270],[1790237700,1790238600,270],[1790238600,1790239500,270],[1790239500,1790240400,270],[1790240400,1790241300,270],[1790241300,1790242200,270],[1790242200,1790243100,270],[1790243100,1790244000,270],[1790244000,1790244900,270],[1790244900,1790245800,270],[1790245800,1790246700,270],[1790246700,1790247600,270],[1790247600,1790248500,270],[1790248500,1790249400,270],[1790249400,1790250300,270],[1790250300,1790251200,270],[1790251200,1790252100,270],[1790252100,1790253000,270],[1790253000,1790253900,270],[1790253900,1790254800,270],[1790254800,1790255700,270],[1790255700,1790256600,270],[1790256600,1790257500,270],[1790257500,1790258400,270],[1790258400,1790259300,270],[1790259300,1790260200,270],[1790260200,1790261100,270],[1790261100,1790262000,270],[1790262000,1790262900,270],[1790262900,1790263800,270],[1790263800,1790264700,270],[1790264700,1790265600,270],[1790265600,1790266500,270],[1790266500,1790267400,270],[1790267400,1790268300,270],[1790268300,1790269200,270],[1790269200,1790270100,270],[1790270100,1790271000,270],[1790271000,1790271900,270],[1790271900,1790272800,270],[1790272800,1790273700,270],[1790273700,1790274600,270],[1790274600,1790275500,270],[1790275500,1790276400,270],[1790276400,1790277300,270],[1790277300,1790278200,270],[1790278200,1790279100,270],[1790279100,1790280000,270],[1790280000,1790280900,270],[1790280900,1790281800,270],[1790281800,1790282700,270],[1790282700,1790283600,270],[1790283600,1790284500,270],[1790284500,1790285400,270],[1790285400,1790286300,270],[1790286300,1790287200,270],[1790287200,1790288100,270],[1790288100,1790289000,270],[1790289000,1790289900,270],[1790289900,1790290800,270],[1790290800,1790291700,270],[1790291700,1790292600,270],[1790292600,1790293500,270],[1790293500,1790294400,270],[1790294400,1790295300,270],[1790295300,1790296200,270],[1790296200,1790297100,270],[1790297100,1790298000,270],[1790298000,1790298900,270],[1790298900,1790299800,270],[1790299800,1790300700,270],[1790300700,1790301600,270],[1790301600,1790302500,270],[1790302500,1790303400,270],[1790303400,1790304300,270],[1790304300,1790305200,270],[1790305200,1790306100,270],[1790306100,1790307000,270],[1790307000,1790307900,270],[1790307900,1790308800,270],[1790308800,1790309700,270],[1790309700,1790310600,270],[1790310600,1790311500,270],[1790311500,1790312400,270],[1790312400,1790313300,270],[1790313300,1790314200,270],[1790314200,1790315100,270],[1790315100,1790316000,270],[1790316000,1790316900,270],[1790316900,1790317800,270],[1790317800,1790318700,270],[1790318700,1790319600,270],[1790319600,1790320500,270],[1790320500,1790321400,270],[1790321400,1790322300,270],[1790322300,1790323200,270],[1790323200,1790324100,270],[1790324100,1790325000,270],[1790325000,1790325900,270],[1790325900,1790326800,270],[1790326800,1790327700,270],[1790327700,1790328600,270],[1790328600,1790329500,270],[1790329500,1790330400,270],[1790330400,1790331300,270],[1790331300,1790332200,270],[1790332200,1790333100,270],[1790333100,1790334000,270],[1790334000,1790334900,270],[1790334900,1790335800,270],[1790335800,1790336700,270],[1790336700,1790337600,270],[1790337600,1790338500,270],[1790338500,1790339400,270],[1790339400,1790340300,270],[1790340300,1790341200,270],[1790341200,1790342100,270],[1790342100,1790343000,270],[1790343000,1790343900,270],[1790343900,1790344800,270],[1790344800,1790345700,270],[1790345700,1790346600,270],[1790346600,1790347500,270],[1790347500,1790348400,270],[1790348400,1790349300,270],[1790349300,1790350200,270],[1790350200,1790351100,270],[1790351100,1790352000,270],[1790352000,1790352900,270],[1790352900,1790353800,270],[1790353800,1790354700,270],[1790354700,1790355600,270],[1790355600,1790356500,270],[1790356500,1790357400,270],[1790357400,1790358300,270],[1790358300,1790359200,270],[1790359200,1790360100,270],[1790360100,1790361000,270],[1790361000,1790361900,270],[1790361900,1790362800,270],[1790362800,1790363700,270],[1790363700,1790364600,270],[1790364600,1790365500,270],[1790365500,1790366400,270],[1790366400,1790367300,270],[1790367300,1790368200,270],[1790368200,1790369100,270],[1790369100,1790370000,270],[1790370000,1790370900,270],[1790370900,1790371800,270],[1790371800,1790372700,270],[1790372700,1790373600,270],[1790373600,1790374500,270],[1790374500,1790375400,270],[1790375400,1790376300,270],[1790376300,1790377200,270],[1790377200,1790378100,270],[1790378100,1790379000,270],[1790379000,1790379900,270],[1790379900,1790380800,270],[1790380800,1790381700,270],[1790381700,1790382600,270],[1790382600,1790383500,270],[1790383500,1790384400,270],[1790384400,1790385300,270],[1790385300,1790386200,270],[1790386200,1790387100,270],[1790387100,1790388000,270],[1790388000,1790388900,270],[1790388900,1790389800,270],[1790389800,1790390700,270],[1790390700,1790391600,270],[1790391600,1790392500,270],[1790392500,1790393400,270],[1790393400,1790394300,270],[1790394300,1790395200,270],[1790395200,1790396100,270],[1790396100,1790397000,270],[1790397000,1790397900,270],[1790397900,1790398800,270],[1790398800,1790399700,270],[1790399700,1790400600,270],[1790400600,1790401500,270],[1790401500,1790402400,270],[1790402400,1790403300,270],[1790403300,1790404200,270],[1790404200,1790405100,270],[1790405100,1790406000,270],[1790406000,1790406900,270],[1790406900,1790407800,270],[1790407800,1790408700,270],[1790408700,1790409600,270]],
    "grid": [[1790200800,1790201700,0.3225],[1790201700,1790202600,0.3367],[1790202600,1790203500,0.3294],[1790203500,1790204400,0.328],[1790204400,1790205300,0.318],[1790205300,1790206200,0.3148],[1790206200,1790207100,0.3165],[1790207100,1790208000,0.3126],[1790208000,1790208900,0.3137],[1790208900,1790209800,0.3108],[1790209800,1790210700,0.3101],[1790210700,1790211600,0.3065],[1790211600,1790212500,0.304],[1790212500,1790213400,0.3025],[1790213400,1790214300,0.3007],[1790214300,1790215200,0.2982],[1790215200,1790216100,0.3006],[1790216100,1790217000,0.3007],[1790217000,1790217900,0.2997],[1790217900,1790218800,0.3059],[1790218800,1790219700,0.3146],[1790219700,1790220600,0.3152],[1790220600,1790221500,0.3187],[1790221500,1790222400,0.3269],[1790222400,1790223300,0.3215],[1790223300,1790224200,0.3439],[1790224200,1790225100,0.3605],[1790225100,1790226000,0.3737],[1790226000,1790226900,0.366],[1790226900,1790227800,0.3729],[1790227800,1790228700,0.3795],[1790228700,1790229600,0.3773],[1790229600,1790230500,0.3953],[1790230500,1790231400,0.3833],[1790231400,1790232300,0.3794],[1790232300,1790233200,0.3651],[1790233200,1790234100,0.3796],[1790234100,1790235000,0.3673],[1790235000,1790235900,0.3459],[1790235900,1790236800,0.3288],[1790236800,1790237700,0.3363],[1790237700,1790238600,0.3201],[1790238600,1790239500,0.3004],[1790239500,1790240400,0.271],[1790240400,1790241300,0.2914],[1790241300,1790242200,0.2679],[1790242200,1790243100,0.2454],[1790243100,1790244000,0.217],[1790244000,1790244900,0.2038],[1790244900,1790245800,0.192],[1790245800,1790246700,0.1905],[1790246700,1790247600,0.1859],[1790247600,1790248500,0.1907],[1790248500,1790249400,0.1859],[1790249400,1790250300,0.1887],[1790250300,1790251200,0.186],[1790251200,1790252100,0.1846],[1790252100,1790253000,0.187],[1790253000,1790253900,0.2026],[1790253900,1790254800,0.2157],[1790254800,1790255700,0.22],[1790255700,1790256600,0.2476],[1790256600,1790257500,0.2871],[1790257500,1790258400,0.3025],[1790258400,1790259300,0.2655],[1790259300,1790260200,0.3036],[1790260200,1790261100,0.3313],[1790261100,1790262000,0.3558],[1790262000,1790262900,0.3425],[1790262900,1790263800,0.3774],[1790263800,1790264700,0.4039],[1790264700,1790265600,0.4292],[1790265600,1790266500,0.3959],[1790266500,1790267400,0.4345],[1790267400,1790268300,0.4549],[1790268300,1790269200,0.4867],[1790269200,1790270100,0.4707],[1790270100,1790271000,0.4879],[1790271000,1790271900,0.4929],[1790271900,1790272800,0.517],[1790272800,1790273700,0.4985],[1790273700,1790274600,0.4903],[1790274600,1790275500,0.4757],[1790275500,1790276400,0.4692],[1790276400,1790277300,0.46],[1790277300,1790278200,0.4477],[1790278200,1790279100,0.4398],[1790279100,1790280000,0.4235],[1790280000,1790280900,0.437],[1790280900,1790281800,0.4174],[1790281800,1790282700,0.4132],[1790282700,1790283600,0.4037],[1790283600,1790284500,0.4084],[1790284500,1790285400,0.3981],[1790285400,1790286300,0.3949],[1790286300,1790287200,0.3896]],
    "planner": [[1790200800,1790201700,0.3225],[1790201700,1790202600,0.3367],[1790202600,1790203500,0.3294],[1790203500,1790204400,0.328],[1790204400,1790205300,0.318],[1790205300,1790206200,0.3148],[1790206200,1790207100,0.3165],[1790207100,1790208000,0.3126],[1790208000,1790208900,0.3137],[1790208900,1790209800,0.3108],[1790209800,1790210700,0.3101],[1790210700,1790211600,0.3065],[1790211600,1790212500,0.304],[1790212500,1790213400,0.3025],[1790213400,1790214300,0.3007],[1790214300,1790215200,0.2982],[1790215200,1790216100,0.3006],[1790216100,1790217000,0.3007],[1790217000,1790217900,0.2997],[1790217900,1790218800,0.3059],[1790218800,1790219700,0.3146],[1790219700,1790220600,0.3152],[1790220600,1790221500,0.3187],[1790221500,1790222400,0.3269],[1790222400,1790223300,0.3215],[1790223300,1790224200,0.3439],[1790224200,1790225100,0.3605],[1790225100,1790226000,0.3737],[1790226000,1790226900,0.366],[1790226900,1790227800,0.3729],[1790227800,1790228700,0.3795],[1790228700,1790229600,0.3773],[1790229600,1790230500,0.3953],[1790230500,1790231400,0.3833],[1790231400,1790232300,0.3794],[1790232300,1790233200,0.3651],[1790233200,1790234100,0.3796],[1790234100,1790235000,0.3673],[1790235000,1790235900,0.3459],[1790235900,1790236800,0.3288],[1790236800,1790237700,0.3363],[1790237700,1790238600,0.3201],[1790238600,1790239500,0.3004],[1790239500,1790240400,0.271],[1790240400,1790241300,0.2914],[1790241300,1790242200,0.2679],[1790242200,1790243100,0.2454],[1790243100,1790244000,0.217],[1790244000,1790244900,0.2038],[1790244900,1790245800,0.192],[1790245800,1790246700,0.1905],[1790246700,1790247600,0.1859],[1790247600,1790248500,0.1907],[1790248500,1790249400,0.1859],[1790249400,1790250300,0.1887],[1790250300,1790251200,0.186],[1790251200,1790252100,0.1846],[1790252100,1790253000,0.187],[1790253000,1790253900,0.2026],[1790253900,1790254800,0.2157],[1790254800,1790255700,0.22],[1790255700,1790256600,0.2476],[1790256600,1790257500,0.2871],[1790257500,1790258400,0.3025],[1790258400,1790259300,0.2655],[1790259300,1790260200,0.3036],[1790260200,1790261100,0.3313],[1790261100,1790262000,0.3558],[1790262000,1790262900,0.3425],[1790262900,1790263800,0.3774],[1790263800,1790264700,0.4039],[1790264700,1790265600,0.4292],[1790265600,1790266500,0.3959],[1790266500,1790267400,0.4345],[1790267400,1790268300,0.4549],[1790268300,1790269200,0.4867],[1790269200,1790270100,0.4707],[1790270100,1790271000,0.4879],[1790271000,1790271900,0.4929],[1790271900,1790272800,0.517],[1790272800,1790273700,0.4985],[1790273700,1790274600,0.4903],[1790274600,1790275500,0.4757],[1790275500,1790276400,0.4692],[1790276400,1790277300,0.46],[1790277300,1790278200,0.4477],[1790278200,1790279100,0.4398],[1790279100,1790280000,0.4235],[1790280000,1790280900,0.437],[1790280900,1790281800,0.4174],[1790281800,1790282700,0.4132],[1790282700,1790283600,0.4037],[1790283600,1790284500,0.4084],[1790284500,1790285400,0.3981],[1790285400,1790286300,0.3949],[1790286300,1790287200,0.3896]],
    "solar": {"dayAfterTomorrow":{"complete":false,"energy":0},"scale":1.1305048335123522,"timeseries":[[1790236800,149],[1790237700,151.5],[1790238600,154],[1790239500,156.5],[1790240400,159],[1790241300,158.25],[1790242200,157.5],[1790243100,156.75],[1790244000,156],[1790244900,153],[1790245800,150],[1790246700,147],[1790247600,144],[1790248500,140],[1790249400,136],[1790250300,132],[1790251200,128],[1790252100,122.5],[1790253000,117],[1790253900,111.5],[1790254800,106],[1790255700,99],[1790256600,92],[1790257500,85],[1790258400,78],[1790259300,70.75],[1790260200,63.5],[1790261100,56.25],[1790262000,49],[1790262900,43],[1790263800,37],[1790264700,31],[1790265600,25],[1790266500,21],[1790267400,17],[1790268300,13],[1790269200,9],[1790270100,7],[1790271000,5],[1790271900,3],[1790272800,1],[1790273700,0.75],[1790274600,0.5],[1790275500,0.25],[1790276400,0],[1790277300,0],[1790278200,0],[1790279100,0],[1790280000,0],[1790280900,0],[1790281800,0],[1790282700,0],[1790283600,0],[1790284500,0],[1790285400,0],[1790286300,0],[1790287200,0],[1790288100,0],[1790289000,0],[1790289900,0],[1790290800,0],[1790291700,0],[1790292600,0],[1790293500,0],[1790294400,0],[1790295300,0],[1790296200,0],[1790297100,0],[1790298000,0],[1790298900,0],[1790299800,0],[1790300700,0],[1790301600,0],[1790302500,0],[1790303400,0],[1790304300,0],[1790305200,0],[1790306100,0.5],[1790307000,1],[1790307900,1.5],[1790308800,2],[1790309700,6.75],[1790310600,11.5],[1790311500,16.25],[1790312400,21],[1790313300,33.75],[1790314200,46.5],[1790315100,59.25],[1790316000,72],[1790316900,89],[1790317800,106],[1790318700,123],[1790319600,140],[1790320500,156],[1790321400,172],[1790322300,188],[1790323200,204],[1790324100,216.5],[1790325000,229],[1790325900,241.5],[1790326800,254],[1790327700,258.5],[1790328600,263],[1790329500,267.5],[1790330400,272],[1790331300,269.5],[1790332200,267],[1790333100,264.5],[1790334000,262],[1790334900,255],[1790335800,248],[1790336700,241],[1790337600,234],[1790338500,220.75],[1790339400,207.5],[1790340300,194.25],[1790341200,181],[1790342100,164.5],[1790343000,148],[1790343900,131.5],[1790344800,115],[1790345700,100.5],[1790346600,86],[1790347500,71.5],[1790348400,57],[1790349300,48.75],[1790350200,40.5],[1790351100,32.25],[1790352000,24],[1790352900,20],[1790353800,16],[1790354700,12],[1790355600,8],[1790356500,6.25],[1790357400,4.5],[1790358300,2.75],[1790359200,1],[1790360100,0.75],[1790361000,0.5],[1790361900,0.25],[1790362800,0],[1790363700,0],[1790364600,0],[1790365500,0],[1790366400,0],[1790367300,0],[1790368200,0],[1790369100,0],[1790370000,0],[1790370900,0],[1790371800,0],[1790372700,0],[1790373600,0],[1790374500,0],[1790375400,0],[1790376300,0]],"today":{"complete":true,"energy":920.8498728373613},"tomorrow":{"complete":true,"energy":1847}}
  },
  "greenShareHome": 0.342,
  "greenShareLoadpoints": 0,
  "grid": {"name":"grid1","currents":[0.21,1.553,0.254],"power":344.678,"powers":[24,297.2,23.6]},
  "gridConfigured": true,
  "gridExportLimit": 0,
  "hems": {"config":{"configured":false}},
  "historyUpdated": "2026-09-24T09:45:00+02:00",
  "homePower": 344.678,
  "influx": {"database":"","insecure":false,"org":"","password":"","token":"","url":"","user":""},
  "interval": 30,
  "loadpoints": [
    {"name":"lp-1","alwaysCharge":"off","batteryBoost":false,"batteryBoostLimit":100,"chargeCurrents":[0,0,0],"chargedEnergy":0,"chargeDuration":0,"chargePower":0,"chargeRemainingEnergy":10917.647,"chargerFeatureAutodetectDisabled":false,"chargerFeatureAverage":false,"chargerFeatureCacheable":false,"chargerFeatureClimaterDisabled":false,"chargerFeatureCoarseCurrent":false,"chargerFeatureContinuous":false,"chargerFeatureDemandTemperature":false,"chargerFeatureDemandWeekday":false,"chargerFeatureHeating":false,"chargerFeatureIntegratedDevice":false,"chargerFeatureOffline":false,"chargerFeatureRetryable":false,"chargerFeatureStreaming":false,"chargerFeatureSwitchDevice":false,"chargerFeatureWakeUpDisabled":false,"chargerFeatureWelcomeCharge":false,"chargerIcon":null,"chargerPhases1p3p":false,"chargerSinglePhase":false,"chargeTotalImport":2571.451,"chargeVoltages":[238,237,239],"charging":false,"connected":true,"connectedDuration":0,"disableDelay":180,"disableThreshold":0,"effectiveLimitSoc":80,"effectiveMaxCurrent":12,"effectiveMinCurrent":6,"effectiveMinSoc":20,"effectivePlanId":0,"effectivePlanSoc":0,"effectivePlanStrategy":{"continuous":false,"precondition":0},"effectivePlanTime":null,"effectivePriority":0,"enabled":false,"enableDelay":60,"enableThreshold":0,"last24hEnergy":4359,"last7dEnergy":41883,"limitEnergy":0,"limitSoc":0,"maxCurrent":12,"minCurrent":6,"minSoc":0,"minSocNotReached":false,"mode":"smart","offeredCurrent":0,"phaseAction":"inactive","phaseRemaining":0,"phasesActive":3,"phasesConfigured":3,"plan":null,"planActive":false,"planEnergy":15,"planOverrun":0,"planProjectedEnd":null,"planProjectedStart":null,"planStrategy":{"continuous":false,"precondition":0},"planTime":"2025-12-08T03:00:00Z","priority":0,"pvAction":"inactive","pvRemaining":0,"sessionCo2PerKWh":null,"sessionEnergy":0,"sessionPrice":null,"sessionPricePerKWh":null,"sessionSolarPercentage":0,"smartCostActive":false,"smartCostLimit":0.186,"smartCostNextStart":"2026-09-24T12:45:00+02:00","smartFeedInPriorityActive":false,"smartFeedInPriorityLimit":null,"smartFeedInPriorityNextStart":null,"solarShare":0,"suggestion":null,"title":"Zu Hause","todayEnergy":392,"ui":{"maxTemp":0,"minTemp":0},"vehicleClimaterActive":null,"vehicleDetectionActive":false,"vehicleLimitSoc":100,"vehicleName":"mini","vehicleOdometer":27697,"vehicleRange":84,"vehicleSoc":51,"vehicleTitle":"Cooper SE","vehicleWelcomeActive":false}
  ],
  "mcp": true,
  "messaging": {},
  "messagingEvents": null,
  "modbusproxy": null,
  "mqtt": {"broker":"","caCert":"","clientCert":"","clientID":"","clientKey":"","insecure":false,"password":"","topic":"evcc","user":""},
  "network": {"externalUrl":"","host":"evcc.local","internalUrl":"http://192.168.178.21:7070","port":7070,"schema":"http"},
  "ocpp": {"config":{"port":8887},"status":{"stations":[]}},
  "ocppforwarder": {"config":[],"status":[]},
  "optimizer": false,
  "optimizerChargingStrategies": ["charge_before_export","attenuate_demand_peaks","attenuate_feedin_peaks","attenuate_grid_peaks","none"],
  "optimizerChargingStrategy": "charge_before_export",
  "prioritySoc": 95,
  "profilePercentile": null,
  "pv": [
    {"name":"pv1","power":0},
    {"name":"db:2","power":118,"title":"Zendure PV"}
  ],
  "pvEnergy": 0,
  "pvPower": 118,
  "remote": {"config":{"enabled":false},"status":{"connected":false,"loginBlocked":false}},
  "residualPower": 0,
  "setupRequired": false,
  "shm": {"deviceId":"","deviceSerial":"","vendorId":""},
  "siteTitle": "Mein Zuhause",
  "smartCostAvailable": true,
  "smartCostType": "priceforecast",
  "smartFeedInPriorityAvailable": false,
  "solarAdjusted": true,
  "sponsor": {"status":{"name":"FuZzz22","expiresAt":"2067-01-23T14:00:00Z","token":"eyJhbG.......aiN1BA"}},
  "startupCompleted": true,
  "statistics": {"30d":{"avgCo2":137.04072902766836,"avgPrice":0.1812127437038373,"chargedKWh":132.72800000000052,"solarPercentage":0.8023843648103625},"365d":{"avgCo2":243.57619195529722,"avgPrice":0.205791314815391,"chargedKWh":1470.7800000000013,"solarPercentage":1.2645928015100658},"thisYear":{"avgCo2":230.89540318413646,"avgPrice":0.20083788474805214,"chargedKWh":1187.2730000000001,"solarPercentage":1.4371628731384287},"total":{"avgCo2":224.32285261156164,"avgPrice":0.1897671338187563,"chargedKWh":1969.5150000000015,"solarPercentage":2.147126695673547}},
  "system": "linux/amd64",
  "tariffCo2": 270,
  "tariffCo2Home": 177.5659020883259,
  "tariffCo2Loadpoints": 270,
  "tariffGrid": 0.336,
  "tariffPriceHome": 0.22116819582334815,
  "tariffPriceLoadpoints": 0.3363,
  "tariffs": {"yamlSource":"file"},
  "tariffSolar": 149,
  "telemetry": true,
  "timezone": "CEST +02:00",
  "vehicles": {"mini":{"capacity":32,"icon":"car","limitSoc":80,"minSoc":20,"planStrategy":{"continuous":false,"precondition":0},"repeatingPlans":[],"title":"Cooper SE"}},
  "version": "0.316.0"
}

Logs

[lp-1  ] DEBUG 2026/09/24 10:03:28 vehicle soc (estimator): 51%
[lp-1  ] DEBUG 2026/09/24 10:03:28 !! plan: plan time zero
[lp-1  ] DEBUG 2026/09/24 10:03:28 pv charge current: 0A = 0A + -0.644A (445W @ 3p)
[site  ] ERROR 2026/09/24 10:03:28 battery mode: power: unexpected status: 401 (Unauthorized) POST http://192.168.178.76/properties/write
[site  ] DEBUG 2026/09/24 10:03:56 ----
[lp-1  ] DEBUG 2026/09/24 10:03:56 charge power: 0W
[lp-1  ] DEBUG 2026/09/24 10:03:56 charge currents: [0 0 0]A
[site  ] DEBUG 2026/09/24 10:03:56 battery 1 power: -119W
[site  ] DEBUG 2026/09/24 10:03:56 battery 1 soc: 9%
[site  ] DEBUG 2026/09/24 10:03:56 pv 2 power: 119W
[site  ] DEBUG 2026/09/24 10:03:56 grid power: 345W
[site  ] DEBUG 2026/09/24 10:03:56 grid powers: [24 296 25]W
[site  ] DEBUG 2026/09/24 10:03:56 grid currents: [0.207 1.56 0.256]A
[site  ] DEBUG 2026/09/24 10:03:57 pv power: 119W
[site  ] DEBUG 2026/09/24 10:03:57 battery has priority at soc 9% (< 95%)
[site  ] DEBUG 2026/09/24 10:03:57 site power: 445W
[lp-1  ] DEBUG 2026/09/24 10:03:58 charge voltages: [238 237 239]V
[lp-1  ] DEBUG 2026/09/24 10:03:58 detected connected phases: 3p
[lp-1  ] DEBUG 2026/09/24 10:03:58 charge total import: 2571.451kWh
[lp-1  ] DEBUG 2026/09/24 10:03:58 charger status: B
[lp-1  ] DEBUG 2026/09/24 10:03:58 soc extrapolated: 51.00%
[lp-1  ] DEBUG 2026/09/24 10:03:58 vehicle soc (estimator): 51%
[lp-1  ] DEBUG 2026/09/24 10:03:58 !! plan: plan time zero
[lp-1  ] DEBUG 2026/09/24 10:03:58 pv charge current: 0A = 0A + -0.645A (445W @ 3p)
[site  ] ERROR 2026/09/24 10:03:58 battery mode: power: unexpected status: 401 (Unauthorized) POST http://192.168.178.76/properties/write

Originally posted by @FuZzz22 in https://github.com/evcc-io/evcc/discussions/34011

FuZzz22 avatar Sep 24 '26 11:09 FuZzz22

Thanks for the detailed report and logs.

What's likely happening

Netzladen (grid charge) maps to case: 3 (charge) in templates/definition/meter/zendure-solarflow-battery.yaml, which POSTs a body with "acMode":1 (AC input / force charge from grid):

{"sn":"...","properties":{"smartMode":1,"acMode":1,"outputLimit":0,"inputLimit":<chargeMaxLimit>}}

hold (case: 2) and discharge (case: 5), which you report work fine, both use "acMode":2 instead. So the one property that differs between the working and failing writes is acMode: 1.

This exact charge/acMode:1 code path was explicitly called out as "Not tested on hardware" in both PRs that shaped its current form (#33801, #33803, merged 2026-09-17, likely in v0.316.0). So it's plausible the device firmware requires a separate local-API permission for AC-input/grid-charge that isn't needed for output/discharge writes — similar to how this same template's requirements note that forced discharge additionally needs "Energy Export" enabled in the Zendure app. It's also possible the write body evcc sends for this case is missing something the device expects. I can't tell which from the code alone.

To narrow this down, could you check:

  1. Did the working Zendure-HA/zenSDK test specifically exercise the AC-input/force-charge-from-grid command (acMode:1), or only output power / discharge (acMode:2)? Those appear to be different device-side permissions.
  2. Can you reproduce the 401 by POSTing the exact same body evcc sends directly, e.g.:
    curl -v -X POST http://<host>/properties/write -H 'content-type: application/json' \
      -d '{"sn":"<serial>","properties":{"smartMode":1,"acMode":1,"outputLimit":0,"inputLimit":<some-value>}}'
    
    If this also 401s outside of evcc, it confirms a device-side restriction on this specific command rather than something evcc constructs incorrectly.
  3. What firmware version is the device on?

🤖 Generated with Claude Code

github-actions[bot] avatar Sep 24 '26 11:09 github-actions[bot]

/cc @404GamerNotFound

andig avatar Sep 24 '26 11:09 andig

/cc @404GamerNotFound

@andig I’ll have a look at it at the weekend!

404GamerNotFound avatar Sep 24 '26 12:09 404GamerNotFound

Re Frage 1: Ja, gezielt getestet. Über die ZHA-Integration (zenSDK) habe ich den SolarFlow direkt auf "AC-Eingangsmodus" mit 1000W gestellt (acMode:1, also genau der Netzlade-Befehl) – das funktioniert einwandfrei, der Akku lädt sichtbar mit ~1000W aus dem Netz, keine 401-Fehler. Das bestätigt, dass das Gerät diesen Befehl grundsätzlich akzeptiert, wenn er korrekt authentifiziert/formatiert ist – es ist also keine geräteseitige Sperre für diesen Befehlstyp.

Re Frage 3: Firmware-Version des SolarFlow 800 Pro2: V2.0.2 (aktuell, kein Update verfügbar laut Zendure App).

Re Frage 2: Kann ich noch nachreichen, falls mir jemand sagt, wie ich am einfachsten an den exakten Request-Body komme, den evcc sendet (TRACE-Logging o. ä.)?

FuZzz22 avatar Sep 24 '26 12:09 FuZzz22

Works for me:

./evcc meter -c zendure.yaml --battery-mode charge --log trace

[zendure] TRACE 2026/09/24 14:27:09 POST http://192.168.0.36/properties/write
[zendure] TRACE 2026/09/24 14:27:09 {"sn":"xx","properties":{"smartMode":1,"acMode":1,"outputLimit":0,"inputLimit":2400}}
--
{"timestamp":1790252829,"messageId":218,"success":true,"code":200,"sn":"xx"}

andig avatar Sep 24 '26 12:09 andig

Pls check if your serial is correct. Verify with curl on command line.

andig avatar Sep 24 '26 12:09 andig

After updating to the latest version, I also encountered the following error:

Fehler beim Starten. Überprüfe deine Konfiguration und starte neu. meter: [db:52] cannot create template 'db:52': cannot create meter type 'template:zendure-solarflow-pro': invalid key: maxchargepower

Could it have something to do with the fact that AC and Pro are now in the same template?

https://github.com/evcc-io/evcc/pull/33272#issuecomment-5538057138

Before folding it up, or rather after releasing the battery controls, everything was still working.

404GamerNotFound avatar Sep 27 '26 06:09 404GamerNotFound

OT @404GamerNotFound zendure-solarflow-pro no longer has a battery option- pls. remove it.

andig avatar Sep 27 '26 12:09 andig

Closing since the requested feedback was not provided. You can still comment with requested feedback and we'll reopen.

github-actions[bot] avatar Oct 04 '26 13:10 github-actions[bot]