openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.58k forks source link

[goecharger] new hardware version v3 and new firmware v2 seem to be unstable or not supported #10791

Closed ako-3004 closed 1 year ago

ako-3004 commented 3 years ago

I changed the v2 hardware go-e charger to the brand new v3 hardware which I got these days. v2 charger worked very fine in openhab. had may working rules.

v3 Hardware: Removed the old openhab "thing", deinstalled and reinstalled the goecharger binding and added the new charger by ip. seemed to work a few seconds first, then "java.lang.IllegalStateException" is shown in thing configuration and openhab log. the api shoud be the same as the older charger has, but there may be some changes which affect the error:

Current Behavior

Thing configuration in openhab 3 switches between "online" and "communication error" in a loop. few seconds "online", few seconds "communication error". Status: OFFLINE COMMUNICATION_ERROR java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

Logfile repeats this lines in a loop: `2021-06-02 00:31:01.142 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'goecharger:goe:413602c5bf' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

2021-06-02 00:31:01.151 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_MaxCurrent' changed from 6 to UNDEF

2021-06-02 00:31:01.156 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_PwmSignal' changed from WAITING_FOR_CAR to UNDEF

2021-06-02 00:31:01.159 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_Error' changed from NONE to UNDEF

2021-06-02 00:31:01.173 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_CurrentL1' changed from 0.0 A to UNDEF

2021-06-02 00:31:01.175 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_CurrentL2' changed from 0.0 A to UNDEF

2021-06-02 00:31:01.176 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_CurrentL3' changed from 0.0 A to UNDEF

2021-06-02 00:31:01.177 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_PowerL1' changed from 0 W to UNDEF

2021-06-02 00:31:01.178 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_PowerL2' changed from 0 W to UNDEF

2021-06-02 00:31:01.179 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_PowerL3' changed from 0 W to UNDEF

2021-06-02 00:31:01.179 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_Phases' changed from 0 to UNDEF

2021-06-02 00:31:01.180 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_SessionChargeEnergyLimit' changed from 1 to UNDEF

2021-06-02 00:31:01.182 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_TotalChargedEnergy' changed from 0.0 kWh to UNDEF

2021-06-02 00:31:01.183 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_AllowCharging' changed from OFF to UNDEF

2021-06-02 00:31:01.184 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_CableCurrent' changed from 32 A to UNDEF

2021-06-02 00:31:01.184 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_Firmware' changed from 050 to UNDEF

2021-06-02 00:31:01.185 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoECharger_AccessConfiguration' changed from OPEN to UNDEF

2021-06-02 00:31:03.217 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'goecharger:goe:413602c5bf' changed from OFFLINE (COMMUNICATION_ERROR): java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ to UNINITIALIZED`

Your Environment

goe charger new hardware v3, new firmware 050 Important: the new firmware has a new api ("v2") but it is also possible to use and enable the old ("v1") api which I did. old v1 api is the same as in the past: http://192.168.1.8/status, http://192.168.1.8/mqtt?payload=amp=10 (works as it did in older hardware) (new v2 api: http://192.168.1.8/api/status)

I already had a look at the goecharger java files and found out that the v1 api is used. Unfortunately I am not experienced in Java. If I can support any developer by giving more information and testing please ask me.

chilobo commented 3 years ago

I have the same configuration and get the same error message. My programming experience doesn't include java either, but I am willing to help too.

In https://community.openhab.org/t/go-e-charger-wallbox-binding/93338/46 you can find a comparison of old and new responses to goe-ip/status

I looked at the fields in the api-response to status and compared them to the file GoEStatusResponseDTO.jave in \org.openhab.binding.goecharger\src\main\java\org\openhab\binding\goecharger\internal\api

There is a field "tmp" - temperature but no corresponding match in the json answer to IP/status:

{"version":"B","tme":"0406212051","rbc":"17","rbt":"92613673","car":"1","amx":"10","amp":"10","err":"0","ast":"0","alw":"1","stp":"0","cbl":"0","pha":"56","fsp":"0","tma":[25,29.375],"dws":"0","dwo":"180","adi":"1","uby":"0","eto":"0","wst":"3","fwv":"050","nrg":[240,239,241,0,0,0,0,0,0,0,0,0,0,0,0,0],"sse":"050080","wss":"K-300","wke":"********","wen":"1","cdi":"0","tof":"101","tds":"1","lbr":"10","aho":"0","afi":"6","azo":"0","ama":"16","al1":"6","al2":"10","al3":"12","al4":"14","al5":"16","cid":"255","cch":"65535","cfi":"65280","lse":"1","ust":"0","wak":"********","r1x":"2","dto":"0","nmo":"0","sch":"AAAAAAAAAAAAAAAA","sdp":"0","eca":"0","ecr":"0","ecd":"0","ec4":"0","ec5":"0","ec6":"0","ec7":"0","ec8":"0","ec9":"0","ec1":"0","rca":"1","rcr":"","rcd":"","rc4":"","rc5":"","rc6":"","rc7":"","rc8":"","rc9":"","rc1":"","rna":"User 1","rnm":"User 2","rne":"User 3","rn4":"User 4","rn5":"User 5","rn6":"User 6","rn7":"User 7","rn8":"User 8","rn9":"User 9","rn1":"User 10","loe":0,"lot":32,"lom":6,"lop":50,"log":"","lof":0,"loa":0,"lch":0}

At its place in the new answer is a field fsp of unknown meaning (between "pha" and "tma"). A search for "temperature" shows that this field is only used in 4 files, in GoEChargerHandler.java the option == null is handled.

So a quick and dirty solution could be to check if there is a field "tmp" in the API response and set temperatur to NULL if there isn't.

openhab-bot commented 3 years ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/go-e-charger-wallbox-binding/93338/46

chilobo commented 3 years ago

Well, I installed all the necessary software, did a fork and deleted (I still have to learn how to uncomment lines in .xml and .java ) all the lines with temperature, TEMPERATURE and the corrseponding case-statements in GoEChargerHandler.java.java.

My first successful compile with java!

I copied the org.openhab.binding.goecharger-3.1.0-SNAPSHOT.jar file to /usr/share/openhab/add-ons ....

It's working!

So - now I need feedback how I (or better somebody more experienced) changes the code for the binding and submits it on github. We should discuss if omitting temperature will cause problems in existing installations.

I did some further tests and it seems that only part of the binding is working. I get messages like:

2021-06-05 19:04:41.257 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'GoeCharger_MaximumCurrent' predicted to become 16

2021-06-05 19:04:41.265 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GoeCharger_MaximumCurrent' changed from 6 A to 16

2021-06-05 19:04:41.326 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'goecharger:goe:treppe' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

It would be interesting to find out if the binding is working on the old version of GO-E without these errors.

chilobo commented 3 years ago

To change the current the binding uses the field amp of the GO-E. Support recommends to use amx instead because amx is not written to the EEPROM, so using it instead prolongs the life of the box.

Drazhar commented 3 years ago

I also plan to modify the code for the goecharger to add the overall power (nrg[11]). My wallbox is still on V1, so I could test your modifications. Did you create a branch which I can pull?

chilobo commented 3 years ago

I think I am just not (yet) expierenced enough to give out the branch. Well, I managed to replace amp with amx. But I think this field is not available in V1. I managed to use the fields in tma. Because those fields just do not exist in V2 (and V1 ?) testing it against V1 would only be useful if I added code which is valid for all three versions. That seems to be too difficult for me at the moment.

chilobo commented 3 years ago

@Drazhar wrote:

I also plan to modify the code for the goecharger to add the overall power (nrg[11]).

I guess I could try to add this, note the changes I have to do in the 4 files which are used and then you could do a fork and add them. Should I try this?

Drazhar commented 3 years ago

@Drazhar wrote:

I also plan to modify the code for the goecharger to add the overall power (nrg[11]).

I guess I could try to add this, note the changes I have to do in the 4 files which are used and then you could do a fork and add them. Should I try this?

Would be great! I currently have a lot on my plate and I'm not sure when I find the time to do it :)

chilobo commented 3 years ago

I added my code as a pull request: https://github.com/openhab/openhab-addons/pull/10861 The jar can be found at: https://www.dropbox.com/s/fzx819g2skgem0m/org.openhab.binding.goecharger-3.1.0-SNAPSHOT.jar?dl=0

Please try this jar: To use it I had to copy it to /usr/share/openhab/addons, delete the old thing in the UI, restart the server, add a new thing, connect the channels to my UI

chilobo commented 3 years ago

Just an update: The original contributor Sebastian B. suggested to keep possible usage of amp because amp offers the possibility to change the permanent current value for charging. amx doesn't. I agree, but struggle to incorporate both. Right now I can replace the occurences of "amp" by "amx", but adding code to read (!) and write values auf amx do not show up. Strange - but I am just learning to code!

chilobo commented 3 years ago

I compiled and tested a new version https://github.com/chilobo/openhab-addons/commit/0bffd0347196dc5e51aed90734c1c7004b34d025

Still not working on V3. I am not shure if I did this Push - and Commit process right.

chilobo commented 3 years ago

I guess I found a solution. I had to change the method to submit the mqtt-request from POST to GET.

https://github.com/chilobo/openhab-addons/commit/dfbedc25c316345847f2eb9b4eed1c73e1bddbc2

The jar: https://www.dropbox.com/s/ifjty0t95eff2g7/org.openhab.binding.goecharger-3.1.0-SNAPSHOT-sources.jar?dl=0

In this jar the value of SESSION_CHARGE_CONSUMPTION / Current_session_charged_energy was adjusted to the new units, it now shows the value in kWh, so there is no factor of 3600 neede any more.

chilobo commented 3 years ago

Changed the handling of Current_session_charged_energy back to its original handling because GOE changed its output back. https://github.com/openhab/openhab-addons/pull/10903

ako-3004 commented 2 years ago

Charger hardware version 3 now comes with a firmware that supports MQTT. So you don't necessarily need the binding anymore.

lsiepel commented 1 year ago

V3 compatibility has been added by: https://github.com/openhab/openhab-addons/pull/12733 Can you confirm all is fine since openhab 3.3.0?

ako-3004 commented 1 year ago

Unfortunately I switched to another system for Managing the goe charger long time ago. It is not included in my openhab anymore. Maybe https://github.com/chilobo still uses openhab with goe and can confirm this fix... ?

lsiepel commented 1 year ago

@chilobo would be nice if you can confirm it. Otherwise i would opt to close this issue and if you ever switch back, we can re-open it.

chilobo commented 1 year ago

I was using the binding until 3 days ago with Hardware version 3 and Firmware 054.11 with openhab 3..0.0 -> 3.4.0

Unfortunately I did an update and upgrade on openhab 3.4.0 and got stuck with a not working 4.0.0. Seems to be a problem with Java 17, raspi is booting, openhab is not starting. So give me some days to find out what went wrong an I'll come back. BTW: I do not wish to switch to MQTT, accessing the API via a binding seems to offer more possibilities of integration in the openhab UI.

Cross-reference: https://github.com/openhab/openhab-addons/issues/12551#issuecomment-1356144442

lsiepel commented 1 year ago

openHAB 4.0.0 snapshots are very unstable at the moment, the PR has been merged before the 3.4.0 releast, so it would be enough to test 3.4.0. It saves you from a lot of hassle for 4.0.0

chilobo commented 1 year ago

I tried to use my backup of 3.4.0 - didn't work on the installed upgraded 4.0.0-version. How do I get back? Install a fresh 3.4.0 and try restoring the backup?

lsiepel commented 1 year ago

Hard to give any advice with the available information , but i guess it would be a good idea to install a fresh 3.4.0 and restore your backup.

ako-3004 commented 1 year ago

@lsiepel You can leave this bug open, I will add the binding and test it...

chilobo commented 1 year ago

I guess you can close this bug. I reinstalled openhab, restored my backup, bundle:list shows 3.4.0 on the GO-eCharger Binding and all the parts I am using seem to work fine.

lsiepel commented 1 year ago

Thanks, you can always create a new issue if necessary

openhab-bot commented 2 months ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/go-e-charger-wallbox-binding/93338/125