Kostal Inverter - function to change settings

Hi,
so far so good.
So we just left deviceLocalBatterySmartBatteryControlIqSet as it is.

Regarded:
deviceLocalBatteryUsageAsOfGridDemandSet, this one now changed, so it will be possible to send values to it. As in PLENTICORE-plus_BA_EN.pdf , Ch.6.3 S.121, Ch.6.4 S.139 should it be possible to see this value here.

deviceLocalMinChargingStatusSet, this one now changed, so it will be possible to send values to it. As in PLENTICORE-plus_BA_EN.pdf , Ch.6.4 S.141 should it be possible to see this value here.

deviceLocalTimecontrolledBatteryUsageSet, this one is now changed so it will behavior as deviceLocalBatterySmartBatteryControlIqSet ( with ON and OFF )

I think we leave the others so far, there are some more parameters I have found in different documents also but they can be so far, we can have a look later on.

I have just uploaded the latest, but as always Please, no hurry. I will be in Germany visiting my girlfriends relatives over the weekend. Btw, We live in Sweden.

Br Basse

Hi,
I just tested your last version, but I can’t see any different in the behaviour to my last post :thinking:. I take a look to the docs and tried to set “deviceLocalBatteryUsageAsOfGridDemandSet” and “deviceLocalMinChargingStatusSet”, but nothing changed in the frontend of my kostal. Perhaps I’m still sending the wrong values?! Do you have any hint for me, what values are expected?

Chris

Hi, sorry for the delay, I have been in bed with a flue the last week.
I will have a look asap and let you know.
Basse

Hi,
I have just uploaded a new version with some changes regarded to the Json’s sent to inverter.
If you have possibilities to capture with Ex. Wireshark, should the Json’s look like: ( Of course with your own choosen values except for Smart Battery Control which are hardcoded)

MinHomeConsumption = [{“moduleid”:“devices:local”,“settings”:[{“id”:“Battery:MinHomeConsumption”,“value”:“42”}]}]

Min Soc = [{“moduleid”:“devices:local”,“settings”:[{“id”:“Battery:MinSoc”,“value”:“5”}]}]

Smart Batt ON = [{“moduleid”:“devices:local”,“settings”:[{“id”:“Battery:SmartBatteryControl:Enable”,“value”:“1”}]}]

Smart Batt OFF = [{“moduleid”:“devices:local”,“settings”:[{“id”:“Battery:SmartBatteryControl:Enable”,“value”:“0”}]}]

I have tested with Rules as:
Name of Rule: Min. Home Consumption Set

configuration: {}
triggers:

  • id: “1”
    configuration:
    cronExpression: 1 * * * * * *
    type: timer.GenericCronTrigger
    conditions: []
    actions:
  • inputs: {}
    id: “2”
    configuration:
    itemName: KOSTALPLENTICOREPlus85withBattery_BatteryUsageAsOfGridDemandSet
    command: “42”
    type: core.ItemCommandAction

Name of Rule: Min. Home Consumption Set

configuration: {}
triggers:

  • id: “1”
    configuration:
    cronExpression: 1 * * * * * *
    type: timer.GenericCronTrigger
    conditions: []
    actions:
  • inputs: {}
    id: “2”
    configuration:
    itemName: KOSTALPLENTICOREPlus85withBattery_MinChargingStatusSet
    command: “5”
    type: core.ItemCommandAction

Name of Rule: Smart Battery Control ON

configuration: {}
triggers:

  • id: “1”
    configuration:
    cronExpression: 1 * * * * * *
    type: timer.GenericCronTrigger
    conditions: []
    actions:
  • inputs: {}
    id: “2”
    configuration:
    itemName: KOSTALPLENTICOREPlus85withBattery_SmartBatteryControlPikoIQSet
    command: ON
    type: core.ItemCommandAction

Name of rule: Smart Battery Control OFF

configuration: {}
triggers:

  • id: “1”
    configuration:
    cronExpression: 30 * * * * * *
    type: timer.GenericCronTrigger
    conditions: []
    actions:
  • inputs: {}
    id: “2”
    configuration:
    itemName: KOSTALPLENTICOREPlus85withBattery_SmartBatteryControlPikoIQSet
    command: OFF
    type: core.ItemCommandAction

I have in the rules used Cron as a trigger, this is just for test. I have tested the rules by manually run them.
Please try and let me know!

I wish you a Very Nice Christmas,
Br Basse

Hey @Basse_03,

Did you meanwhile further process in bringing some of the settings channel to kostal inverters of thrid generation? I have a PlentiCore 10 with Battery and would like to implement some own rules to control battery usage.
I’m already using openHAB 4. Would be awesome to get those additional changes into the addon. If I can help with testing or similar let me know.

Cheers,

As there is no real documentation on the REST API, does it offer endpoints for BatteryChargeDischarge, BatteryMaxDischarte, BatteryMaxCharge, and MinSoC/maxSoC?

I use the Modbus registers for accessing those (after activating “external batterycontrol” via the installator login)

As far as I have seen their webinterface uses the API as well. When changing the Battery settings (as a normal user) it sends data to api/v1/settings like

[{"moduleid": "devices:local","settings": [{"id": "Battery:Type","value": "4"}]}
[{"moduleid": "devices:local","settings": [{"id": "Battery:MinHomeComsumption","value": "50"}]}
[{"moduleid": "devices:local","settings": [{"id": "Battery:MinSoc","value": "5"}]}
[{"moduleid": "devices:local","settings": [{"id": "Battery:SmartBatteryControl:Enable","value": "0"}]}
[{"moduleid": "devices:local","settings": [{"id": "Battery:ComMonitor:Time","value": "3"}]}
[{"moduleid": "devices:local","settings": [{"id": "Battery:TimeControl:Enable","value": "1"}]}
[{"moduleid": "devices:local","settings": [{"id": "Battery:TimeControl:ConfMon","value": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}]}
[{"moduleid": "devices:local","settings": [{"id": "Battery:TimeControl:ConfTue","value": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}]}

… same for ConfWed, ConfThu, ConfFri, ConfSat, ConfSun

The long numbers seem to represent the whole day, were each number represent 15 minutes. The values can be 0 (no restriction), 1 (don’t charge, but use battery), 2 (don’t use, but charge battery)

So guess it might be enough to define such channels in the binding maybe. Didn’t yet have a deeper look at the code.

Hi,
I have an ongoing process, but it’s put to hold for the moment.
I will be glad to start it up, but in the meantime am I busy with another binding.
I have possibilities to test against an Plenticore, but without battery, so your help will be perfect.
I will try to have a look asap, will remember that there will be not so much left to do, but I have to upgrade it to OH4.x so we will see.
I let you know.
Br Basse

1 Like

If you like to control your battery externally, you mostly want to change the charge/discharge power and or the limits of charging/discharging. Sometimes minimum and maximum SoC.

but you can’t set these parameters via the Web-Interface - even if external battery management is active, that’s why I asked:

  • Modbus #1034: Battery charge power (DC) setpoint in W (negative: charge, positive: discharge)
  • Modbus #1038: Battery max. charge power limit in W (positive: limit)
  • Modbus #1040: Battery max. discharge power limit (postive: limit)
  • Modbus #1044: Maximum SOC

what you can set is the “minimum SoC”, which should correspond to Modbus #1042: Minimum SOC.

PS: you can access the modbus registers and read/write - if the “external battery management” was activated.

So are you using the Modbus binding to control your battery then?
Do you maybe have a working configuration for that?

I don’t use the Modbus binding for it, but node-red from that template (hope you understand german):

Ah. thanks for that. Not sure if I want to set up an additional NodeRed. But I’ll check if I can extract the required modbus settings there maybe…

No need. There’s a PDF with all registers to download at the Website. With all the relevant infos

Hi,
I have just uploaded a new version, this one is with the channels as you described above.
Have a look and maybe even try it. And of course, Please let me know how things went out.

Br Basse

Hi Basse_03,

Thanks for your effort :heart:

I just tried to give it a try on my installation.
I’m running openhAB 4.0.4, but it doesn’t seem to work correctly there.
The following error appears in the log.

2023-11-24 21:57:20.111 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: 

file:/openhab/addons/org.openhab.binding.kostalinverter-4.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.kostalinverter [303]
  Unresolved requirement: Import-Package: com.google.gson; version="[2.10.0,3.0.0)"

    at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.18.0.jar:?]
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:445) ~[org.eclipse.osgi-3.18.0.jar:?]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) ~[?:?]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) ~[?:?]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) ~[?:?]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) ~[?:?]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) ~[?:?]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) ~[?:?]

Maybe the build for 4.1.0 has other requirements? :thinking:
Are you able to build a release for openHAB 4.0 maybe?
Not sure when I would have some time to set up a new box using the latest dev release in order to test it with openHaAB 4.1

Hi, no problems, this is just what I like to do as retired.
I see the problem and it’s about ( as very often, dependencies and in this case, Gson).
I will have a look asap, and let you know!
Br Basse

Hi,
I have just uploaded an 4.0 version, GitHub - basse04/kostalinverter_20231204
The easiest for me was to also add jsoup-1.14.3 to mine /usr/share/openhab/addons or to your addons folder.
There are other dependencies regarded to Kostal First Generation inverters that needs this one.
So Please, try, and we keep in touch.
Br Basse

Hi Basse_03,

I’m using openhab 4.1.1 Release build and would also like to try your new version of the binding in order to try the new channels.
Unfortunately I’m receiving the following error when trying to install your JAR file:

openhab> bundle:install https://github.com/basse04/kostalinverter_20231204/blob/main/org.openhab.binding.kostalinverter-4.0.0-SNAPSHOT.jar
Bundle IDs:
Error executing command: Error installing bundles:
        Unable to install bundle https://github.com/basse04/kostalinverter_20231204/blob/main/org.openhab.binding.kostalinverter-4.0.0-SNAPSHOT.jar: org.osgi.framework.BundleException: Error occurred installing a bundle.

Do you have any idea?
thanks, Oliver

Hi,
I like that you are intrested in the binding. I my self has an Kostal Piko 10-20.
I have not tried to install the binding as you try to. I use to do it like:
Download the jar and put it in /usr/share/openhab/addons, don’t forget to put jsoup-1.14.3.jar there also.

You should then see it in karaf
openhab> bundle:list
as:
xxx Active 80 4.0.0.202312041635 openHAB Add-ons :: Bundles :: Kostal Binding

If you can see it and it is like Resolved, do as:
openhab> bundle:start xxx

Please try, and let me know!

Br Basse

Hi, I had already tried the manual method by putting both jar files in /usr/share/openhab/addons without success. The kostal binding was not showing up in the bundle list and I was not able to register a new thing via file. As there was no error in openhab.log I tried the alternative installation method via karaf bundle:install
Do you have any idea how I can debug the issue why your binding cannot be deployed in my openhab instance?