Kostal Inverter - function to change settings

Hi everybody,
I really like this binding, but I miss the function to change settings e.g. the “Min. state of charge (SoC) [%]” of the Battery of the third generation devices. Is something like this on the feature list? I’m not really familiar with java development, thats why i’m asking :innocent:. Or does somebody know another way to do this, perhaps directly through the http binding?
thank you very much

Hi,
I have done the part regarded to Second Generation with possibilities to change settings. I have an ongoing project to do the very same for Third Generation inverters. I will do my very best but right now there is another project in the pipe.
But you can help me so far, if you can capture the JSON strings sent/received to/from the inverter for the different settings available.
Please, use Wireshark and capture the packets sent/received when you do this operations from Web-Browser.

Br Basse

use Modbus register 1042/1044 for min/max SoC

@Basse_03: That sounds good :). I will try to capture the packets. But i could take some time, I’ve never done this before and also have some other projects.

@mstormi: Can you help me, how to configure this with the modbus binding in Openhab? I also never done anything with Modbus before :smiley: and some hints would be great :slight_smile:

I’m selling a commercial energy management system Energie Managen: Effektiv & Flexibel » Storm.house to work with Kostals, too.

If you mean the configuration on how far the Kostal can be depleted (if you login on your local Kostal webserver and then under “service” - “battery” - this information is AFAIR not changeable via Modbus and thus also not via the Binding.
if you want to change this without manually logging into the Kostal local webserver, you could use this script, which can do this - and all the other stuff you can reach in the local webserver with your end user login:

@chris3: Please take your time, and just let me know if I can be for any help. My problem is that I have an Inverter of type 3 available but no battery connected to it. I have so far found out how to set some parameter from the Kostal Binding, but I cant see how to set the others, regared to the missing battery.

@Basse_03: I found some time, installed wireshark and captured the request. I hope this snippet is enough. Let me know if you need another format or data (but then you need tell me exactly what I have to do :innocent: )

Hypertext Transfer Protocol
    PUT /api/v1/settings HTTP/1.1\r\n
    Host: 192.168.1.199\r\n
    Connection: keep-alive\r\n
    Content-Length: 80\r\n
    Accept: application/json, text/javascript, */*; q=0.01\r\n
    Authorization: Session XXXXXXXXXXXXXXXXX\r\n
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36\r\n
    Content-Type: application/json\r\n
    Origin: http://192.168.1.199\r\n
    Referer: http://192.168.1.199/\r\n
    Accept-Encoding: gzip, deflate\r\n
    Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7\r\n
    \r\n
    [Full request URI: http://192.168.1.199/api/v1/settings]
    [HTTP request 5/17]
    [Prev request in frame: 115]
    [Response in frame: 123]
    [Next request in frame: 126]
    File Data: 80 bytes
JavaScript Object Notation: application/json
    Array
        Object
            Member: moduleid
                [Path with value: /[]/moduleid:devices:local]
                [Member with value: moduleid:devices:local]
                String value: devices:local
                Key: moduleid
                [Path: /[]/moduleid]
            Member: settings
                Array
                    Object
                        Member: id
                            [Path with value: /[]/settings/[]/id:Battery:MinSoc]
                            [Member with value: id:Battery:MinSoc]
                            String value: Battery:MinSoc
                            Key: id
                            [Path: /[]/settings/[]/id]
                        Member: value
                            [Path with value: /[]/settings/[]/value:10]
                            [Member with value: value:10]
                            String value: 10
                            Key: value
                            [Path: /[]/settings/[]/value]
                Key: settings
                [Path: /[]/settings]

Payload captured from chrome:

[{"moduleid":"devices:local","settings":[{"id":"Battery:MinSoc","value":"10"}]}]

I keep my fingers crossed that your battery will arrive soon. thank you very much :slight_smile:

@binderth : thank you for the informations and the link. I already saw this python script but it throws a lot of error (in my case). Also I like the idea to do everything done through openhab and not to have another place, with password ,…

Hi, Thank’s a lot. This is what I have been looking for, the Payload tells me about the syntax for sending info. to the inverter.
I will try asap and let you know, it might take some time due to another ongoing project, but we keep in touch.
Br Basse

Take the time you need. I’m very happy for your support. :slight_smile:

Hi @chris3 and @frieso,
I have today uploaded a version of Kostal Inverter to GitHub - basse04/Kostal-Inverter-3.4.0 trying to have config-changes to Plenticore inverter working. Please try with Plenticore85 with battery, and let me know.
Br Basse

Hi @Basse_03,
oh wow, thank you. I’ve done a quick test, but i currently get the following error:

10:21:39.809 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/openhab/addons/org.openhab.binding.kostalinverter-3.4.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.kostalinverter [308]
Unresolved requirement: Import-Package: org.jsoup; version=“[1.15.0,2.0.0)”

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

I’m using the docker version of openhab3.3.

Hi, I have just uploaded a new, Please try with this one.
Br Basse

Hi @Basse_03
just downloaded your new File and I’m getting the same Error:

2022-11-14 21:16:31.314 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.kostalinverter-3.4.0-SNAPSHOT.jar

org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.kostalinverter [297]
Unresolved requirement: Import-Package: org.jsoup; version=“[1.15.0,2.0.0)”

    at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.200.jar:?]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1845) ~[org.eclipse.osgi-3.16.200.jar:?]
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136) ~[org.eclipse.osgi-3.16.200.jar:?]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1838) ~[org.eclipse.osgi-3.16.200.jar:?]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1781) ~[org.eclipse.osgi-3.16.200.jar:?]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1743) ~[org.eclipse.osgi-3.16.200.jar:?]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1665) ~[org.eclipse.osgi-3.16.200.jar:?]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) ~[org.eclipse.osgi-3.16.200.jar:?]
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) [org.eclipse.osgi-3.16.200.jar:?]
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345) [org.eclipse.osgi-3.16.200.jar:?]

I’m using Openhab 3.1.1

KR
Frieso

Hi,
I think I found the reason, actually I’m sure but still not convinced why this "Unresolved requirement " happened. What is strange is that jsoup version 1.15.0 is not a version at all as far I can see, 1.15.1 is available, but we like to use 1.14.3.

The problem is that org.jsoup is of wrong version for the binding.
I have uploaded a new binding and also jsoup-1.14.3.
But Please try first to put jsoup-1.14.3 in /usr/share/openhab/addons and see if it works, with the binding you already have there.

I had the very same problem as you on my test-OH3 running with 3.3.0-1.
I then installed 3.4.0 M4-1 and use the just uploaded binding and everything works.

238 │ Active │ 80 │ 1.14.3 │ jsoup Java HTML Parser
239 │ Resolved │ 80 │ 3.4.0.M4 │ openHAB Add-ons :: Bundles :: Kostal Binding
240 │ Active │ 80 │ 3.4.0.202211151638 │ openHAB Add-ons :: Bundles :: Kostal Binding

239 is the one distributed, 240 is the new one

Best luck!
Br Basse

hi @Basse_03,
I was just able to test the new version and no errors were shown :slight_smile: It only shows the following warning:
11:00:31.382 [WARN ] [org.apache.felix.fileinstall ] - A bundle with the same symbolic name (org.jsoup) and version (1.14.3) is already installed. Updating this bundle instead.

To the function of the plugin:
I was trying to set the min State of Charge (SoC), but it was always set to “10”. Is there perhaps a hardcoded value or fallback?

Chris

Hi,
You can try (if you had as described abow, put jsoup-1.14.3 in /usr/share/openhab/addons), to take it away.
And you are very sure about the value 10, it’s hardcoded just for to have the binding tested, the other values are like:
Battery discharge as of grid demand of [W], “id”:“Battery:MinHomeComsumption” is hardcoded to 50.0
Battery use strategy, “id”:“Battery:Strategy” is hardcoded to 0
Time-controlled battery usage, “id”:“Battery:TimeControle:Enable” is hardcoded to 0
‘I have not found this in document’, id":"Battery:DynamicSoc:Enable is hardcoded to 0

You should be able to set Smart battery control, “id”:“Battery:SmartBatteryControl:Enable”. This one has possibilities to catch ON and should then set Smart Battery Control to 1 and also with OFF but then to 0.

Please, try this, and when hopefully things work as we like, will we have to take a deep dive into what parameters that should be setable and to what. Some are not setable without Servicecode but I think we will do ours best to find those who is interesting and setable.

Br Basse

Hi @Basse_03 ,
Ahh OK, thank you for this information. I can test the other Parameters, but it will take some time. I think I can start in 2-3 weeks, to much other things to do :confused:.

I will contact you as soon as I have News.
Chris

Hi,
Oki, let it take all the time you need.
We keep in touch!!
Br Basse

Hi @Basse_03,
i just tested the battery settings and here is my result:

  • deviceLocalBatteryUsageAsOfGridDemandSet: didnt worked in my case, is not set to the 50.0 (no errors shown). Perhaps i send the wrong string?!
  • deviceLocalBatteryUseStrategyIqSet: I couldn’t find this option on my Kostal Inverter
  • deviceLocalBatterySmartBatteryControlIqSet: works as expected :slight_smile:
  • deviceLocalMinChargingStatusSet: works, but always set to “10”
  • deviceLocalTimecontrolledBatteryUsageSet: didn’t worked in my case, but i didn’t know what string it should have
  • deviceLocalBatteryDynamicSocSet: I couldn’t find this option on my Kostal Inverter

Chris