openhab-addons: [kostal-inverter] Cannot connect to PLENTICORE PLUS 10.0
Hello everyone,
I’ve got an openHAB instance running as a docker container and want to connect to my Kostal inverter (model: PLENTICORE PLUS 10.0). The connection to other “things” in the LAN works, so I assume that it’s not a network issue, but rather an authentication error. And I’m also sure that the password is correct as I can log into the scb website as well.
Have you already tested this code explicitly for my device? I’ve tried to debug into your code, but the last authentication step /auth/create_session always seems to fail. I’m getting 400 BadRequest. The previous steps /auth/start and /auth/finish seem to work fine.
Thanks for you help in advance!
Best wishes Marco
Expected Behavior
openHAB should be able to establish connections to Kostal PLENTICORE PLUS 10.0 devices using the kostal-inverter binding
Current Behavior
As you can see from the event log, I’ve been installing a thing using the kostal-inverter binding. The thing first goes into INITIALIZING state, then into UNKNOWN state and after creating several links it finally goes into OFFLINE (COMMUNICATION_ERROR) state. The message also tells that there is an authentication error which support my former suggestions when debugging the code. Althouh I had to restart the container because it showed me 503 No connection error.
event log:
2020-04-27 22:29:28.971 [thome.event.ExtensionEvent] - Extension 'package-standard' has been installed.
2020-04-27 22:29:47.414 [thome.event.ExtensionEvent] - Extension 'ui-homebuilder' has been installed.
2020-04-27 22:29:47.415 [thome.event.ExtensionEvent] - Extension 'ui-basic' has been installed.
2020-04-27 22:29:47.415 [thome.event.ExtensionEvent] - Extension 'ui-habpanel' has been installed.
2020-04-27 22:29:47.415 [thome.event.ExtensionEvent] - Extension 'ui-paper' has been installed.
2020-04-27 22:30:59.166 [thome.event.ExtensionEvent] - Extension 'binding-kostalinverter' has been installed.
2020-04-27 22:44:56.946 [hingStatusInfoChangedEvent] - 'kostalinverter:PLENTICOREPLUS100WITHBATTERY:06b8746e' changed from UNINITIALIZED to INITIALIZING
2020-04-27 22:44:56.955 [hingStatusInfoChangedEvent] - 'kostalinverter:PLENTICOREPLUS100WITHBATTERY:06b8746e' changed from INITIALIZING to UNKNOWN
2020-04-27 22:44:58.164 [hingStatusInfoChangedEvent] - 'kostalinverter:PLENTICOREPLUS100WITHBATTERY:06b8746e' changed from UNKNOWN to OFFLINE (COMMUNICATION_ERROR): Error during the initialisation of the authentication
2020-04-27 22:45:07.082 [hingStatusInfoChangedEvent] - 'kostalinverter:PLENTICOREPLUS100WITHBATTERY:06b8746e' changed from OFFLINE (COMMUNICATION_ERROR): Error during the initialisation of the authentication to OFFLINE (COMMUNICATION_ERROR): HTTP communication error: No response from device
Possible Solution
- Reproduce error with a build of the current source code
- Try to make the authentication work with a Java implementation
- Determine differences between both implementations (which hopefully leads to a possible fix)
- Implement the fix and review it
Steps to Reproduce (for Bugs)
- Have a Kostal inverter PLENTICORE PLUS 10.0 plugged to your LAN
- Find out the IP of the inverter and make sure it can be pinged
- Install an openHAB server using docker-compose with standard composition from docs (I’m using Ubuntu 18.04 as host OS)
version: '2.2'
services:
openhab:
image: "openhab/openhab:2.5.4"
restart: always
network_mode: host
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"
- "./openhab_addons:/openhab/addons"
- "./openhab_conf:/openhab/conf"
- "./openhab_userdata:/openhab/userdata"
environment:
OPENHAB_HTTP_PORT: "8080"
OPENHAB_HTTPS_PORT: "8443"
EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Berlin"
- (Wait about 10-20 seconds) -> open http://localhost:8080 into your webbrowser
- Choose Standard Setup -> (Wait for completion, THIS IS IMPORTANT!!!)
- Choose PaperUI
- Addons -> Bindings -> Kostal Inverter Binding -> install -> (Wait for completion)
- Configuration -> Things -> + -> Kostal Inverter Binding -> Kostal PLENTICORE PLUS 10.0 (with Battery)
- put IP address and master key, keep refresh interval at 30sec -> confirm
Context
I just want to retrieve sensor data from my Kostal inverter and combine it with weather data to send notifications when to e.g. switch on the wasching machine etc. to increase my self-sufficiency (and hopefully save money). This is just a freetime project, so nothing critical.
Your Environment
- Version used: 2.5.4 (both openHAB and kostal-inverter binding)
- Environment name and version (e.g. Chrome 76, Java 8, Node.js 12.9, …): Firefox browser (75.0 64-Bit)
- Operating System and version (desktop or mobile, Windows 10, Raspbian Buster, …): official docker image with Ubuntu 18.04 as host machine
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20
I just did a little research on the 2.5.4 openHAB docker image that may help enabling the unlimited security setting. The entrypoint.sh file (see https://github.com/openhab/openhab-docker/blob/master/2.5.4/debian/entrypoint.sh) checks for an environment variable CRYPTO_POLICY. If this variable is set to ‘unlimited’ then the Java security policy is enabled automatically.
Hello everyone,
I just managed to fix the kostal-inverter binding’s authentication issue. You just need to change the $JAVA_HOME/jre/lib/security/java.security file. There is a line crypto.policy=limited which needs to be changed to crypto.policy=unlimited. (you need to scroll quite a bit down to find it) After restarting the service, the authentication worked fine. But as I pointed out before there may be collateral damage doing so as other Java applications may require the limited setting …
I’m just wondering why the official openHAB docker image has this setting set to limited even though all java 8 versions greater than 161 have the unlimited setting by default. This means they changed it back to limited on purpose. I don’t know whether there is another component of openHAB that requires the value to be set to limited. Maybe I should ask the docker image team why.
Anyways … thank you for your participation in this issue.
Best wishes Marco