Hi Paul, Iāve just tested your latest jar but couldnāt get charging/discharging to work.
Iāve linked the batteryChargeRate channel to a Number:Power item and sent 5000W, then issued ON to the switch item for the batteryChargingFromGrid channel.
It remained ON then switched back after some seconds.
I think the following error Iām seeing at times is key. Looks like the binding cannot properly access the battery with a POST because of an issue with the HTTP header.
Iām not seeing this on every command but on quite some. Guess thereās some sort of caching or similar involved resulting in not a full answer to every command.
2026-03-01 20:00:53.606 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Executing batteryDischargingToGrid command
2026-03-01 20:00:53.609 [DEBUG] [hab.binding.sonnen.internal.communication.SonnenJSONCommunication] - Error processing Put request http://192.168.170.45/api/v2/configurations: java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
The command had no visible effect. Logging see below, it does nowhere show the 5000W I commanded.
2026-03-01 20:04:31.642 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel batteryChargingFromGrid with state ON
2026-03-01 20:04:31.758 [WARN ] [org.openhab.io.openhabcloud.internal.CloudClient ] - Error connecting to the openHAB Cloud instance: not authorized. Reconnecting after 60000 ms.
2026-03-01 20:04:36.116 [DEBUG] [org.openhab.core.model.script.Energiemanagement ] - SE-PV-1 errechne PVErzeugungsleistung = 0.0
2026-03-01 20:04:36.117 [DEBUG] [org.openhab.core.model.script.Energiemanagement ] - SE-PV-1 errechne PVErzeugungsleistung = 0.0
2026-03-01 20:04:39.736 [DEBUG] [hab.binding.sonnen.internal.communication.SonnenJSONCommunication] - BatteryData = {"Apparent_output":443,"BackupBuffer":"0","BatteryCharging":false,"BatteryDischarging":true,"Consumption_Avg":430,"Consumption_W":474,"Fac":49.95,"FlowConsumptionBattery":true,"FlowConsumptionGrid":true,"FlowConsumptionProduction":false,"FlowGridBattery":false,"FlowProductionBattery":false,"FlowProductionGrid":false,"GridFeedIn_W":-27.0,"IsSystemInstalled":1,"OperatingMode":"2","Pac_total_W":444,"Production_W":0,"RSOC":92,"RemainingCapacity_Wh":19063,"Sac1":443,"Sac2":null,"Sac3":null,"SystemStatus":"OnGrid","Timestamp":"2026-03-01 20:04:39","USOC":91,"Uac":230.0,"Ubat":211.0,"dischargeNotAllowed":false,"generator_autostart":false}
2026-03-01 20:04:39.737 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel batteryChargingState with state OFF
2026-03-01 20:04:39.738 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel batteryDischargingState with state ON
2026-03-01 20:04:39.739 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel batteryCharging with state 0 W
2026-03-01 20:04:39.739 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel batteryDischarging with state 444 W
2026-03-01 20:04:39.740 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel batteryChargingFromGrid with state OFF
2026-03-01 20:04:39.740 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel batteryDischargingToGrid with state OFF
2026-03-01 20:04:39.741 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel batteryOperationMode with state Automatic
2026-03-01 20:04:39.741 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel consumption with state 474 W
2026-03-01 20:04:39.742 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel gridFeedIn with state 0 W
2026-03-01 20:04:39.742 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel gridConsumption with state 27 W
2026-03-01 20:04:39.743 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel solarProduction with state null
2026-03-01 20:04:39.743 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel batteryLevel with state 91 %
2026-03-01 20:04:39.744 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel flowConsumptionBatteryState with state null
2026-03-01 20:04:39.744 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel flowConsumptionGridState with state null
2026-03-01 20:04:39.744 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel flowConsumptionProductionState with state null
2026-03-01 20:04:39.744 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel flowGridBatteryState with state null
2026-03-01 20:04:39.745 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel flowProductionBatteryState with state null
2026-03-01 20:04:39.745 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel flowProductionGridState with state null
2026-03-01 20:04:39.745 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel energyImportedStateProduction with state null
2026-03-01 20:04:39.745 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel energyExportedStateProduction with state null
2026-03-01 20:04:39.746 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel energyImportedStateConsumption with state null
2026-03-01 20:04:39.746 [DEBUG] [org.openhab.binding.sonnen.internal.SonnenHandler ] - Update channel energyExportedStateConsumption with state null