MickMake / GoSungrow

GoLang implementation to access the iSolarCloud API updated by SunGrow inverters.
https://mickmake.com/
GNU General Public License v2.0
179 stars 46 forks source link

JSON error with type of struct field ResultData.result_data.org_id #74

Closed sungrow-firmware closed 1 year ago

sungrow-firmware commented 1 year ago

I'm getting the following error when I try to log in: ERROR: json: cannot unmarshal number in go struct field ResultData.result_data.org_id of type string.

In the file iSolarCloud\AppService\login\data.go I had to change the type of the struct field OrgId from string to valueTypes.Integer. This solved the problem for me.

sungrow-firmware commented 1 year ago

Here a PR for the change: #75

copadewe commented 1 year ago

Here a PR for the change: #75

Same here today morning. Sorry noob question, where to change it to "valueTypes.Integer"

Coketrd commented 1 year ago

Here a PR for the change: #75

Same here today morning. Sorry noob question, where to change it to "valueTypes.Integer"

yes same here. i cant find the file where i can change this. would be great if someone could explain this to me the newbie.

sungrow-firmware commented 1 year ago

Go to the file iSolarCloud\AppService\login\data.go, line 78 https://github.com/MickMake/GoSungrow/blob/db9e0bf6c6d124a8e7b18bdc6fa9391246c38cec/iSolarCloud/AppService/login/data.go#L78 There exchange string to valueTypes.Integer, simmilar to line 81. Or you can use this file as a reference: https://github.com/sungrow-firmware/GoSungrow/blob/patch-1/iSolarCloud/AppService/login/data.go

Coketrd commented 1 year ago

Go to the file iSolarCloud\AppService\login\data.go, line 78

https://github.com/MickMake/GoSungrow/blob/db9e0bf6c6d124a8e7b18bdc6fa9391246c38cec/iSolarCloud/AppService/login/data.go#L78

There exchange string to valueTypes.Integer, simmilar to line 81. Or you can use this file as a reference: https://github.com/sungrow-firmware/GoSungrow/blob/patch-1/iSolarCloud/AppService/login/data.go

thankyou. but where i can find this file`? how can i reach the installation directory

grf692 commented 1 year ago

I have the same problem and I am not sure where to do the change. I can ssh to my home assistant box but from there I only have the "ha [command]" commands. I am not sure how / where to enter the addons (or container ?) to do actual changes. Help will be much appreciated : )

copadewe commented 1 year ago

Go to the file iSolarCloud\AppService\login\data.go, line 78

Like Coketrd - where is this file :-)?

grf692 commented 1 year ago

I gitcloned the repo on my HA, edited the file to make the change described above. Now how do I start the container correctly without breaking my HA and with the right config etc. please ?

Bartleby1980 commented 1 year ago

Go to the file iSolarCloud\AppService\login\data.go, line 78

Like Coketrd - where is this file :-)?

Die Datei ist unter der folgenden URL zu finden. https://github.com/sungrow-firmware/GoSungrow/tree/master/iSolarCloud/AppService/login

Ich hab auch das gesamte Projekt heruntergeladen und nach Github-Desktop importiert. Dann kann ich zwar ein neues Projekt mit der geänderten Datei erstellen, bekomme das in HomeAssistant aber nicht ersetzt.

Coketrd commented 1 year ago

Go to the file iSolarCloud\AppService\login\data.go, line 78

Like Coketrd - where is this file :-)?

Die Datei ist unter der folgenden URL zu finden. https://github.com/sungrow-firmware/GoSungrow/tree/master/iSolarCloud/AppService/login

Ich hab auch das gesamte Projekt heruntergeladen und nach Github-Desktop importiert. Dann kann ich zwar ein neues Projekt mit der geänderten Datei erstellen, bekomme das in HomeAssistant aber nicht ersetzt.

ich meinte wo finde ich die file in HA dass ich die direkt editieren kann. Die Datei selbst habe ich schon heruntergeladen, aber wie bekomm ich die dahin wo sie hinsoll. das ist hier die große Frage :(

TaxmanNo1 commented 1 year ago

@MickMake maybe here´s some work for you here...

oleg-d commented 1 year ago

@MickMake please merge #75

jrbconsulting commented 1 year ago

I have the same problem and I am not sure where to do the change. I can ssh to my home assistant box but from there I only have the "ha [command]" commands. I am not sure how / where to enter the addons (or container ?) to do actual changes. Help will be much appreciated : )

Try 'login' when you get to that point. Should drop you to a shell

copadewe commented 1 year ago

I have the same problem and I am not sure where to do the change. I can ssh to my home assistant box but from there I only have the "ha [command]" commands. I am not sure how / where to enter the addons (or container ?) to do actual changes. Help will be much appreciated : )

Try 'login' when you get to that point. Should drop you to a shell

and than? grafik

grf692 commented 1 year ago

Yes, I managed to get login already but it does not help much because then I would have to somehow modify what's inside the addons, that is the docker images or containers and I don't know how to do or if it's even possible : )

image

draoZA commented 1 year ago

Same error here. I'm happy to update the source. But I'm not familiar with Go. So not sure how I compile again. Or run from source?

Bartleby1980 commented 1 year ago

Mick Make apparently I and a few others can't make the change. Changing the file on the local PC is not a problem, but exchanging it with the installed version (3.0.3) in HomeAssistant is a problem.

So it would be great if a new version could be made to allow the change to be made in HomeAssistant when there is an addon update.

Thank you.

jrbconsulting commented 1 year ago

I have the same problem and I am not sure where to do the change. I can ssh to my home assistant box but from there I only have the "ha [command]" commands. I am not sure how / where to enter the addons (or container ?) to do actual changes. Help will be much appreciated : )

Try 'login' when you get to that point. Should drop you to a shell

and than? grafik

Looks like the answer might be 'root' with no password - https://community.home-assistant.io/t/default-password-for-the-pi-account/23432

copadewe commented 1 year ago

Mick Make apparently I and a few others can't make the change. Changing the file on the local PC is not a problem, but exchanging it with the installed version (3.0.3) in HomeAssistant is a problem.

So it would be great if a new version could be made to allow the change to be made in HomeAssistant when there is an addon update.

Thank you.

Think we need to wait until it is fixed in a new version :-///

copadewe commented 1 year ago

no is not working

copadewe commented 1 year ago

Looks like the answer might be 'root' with no password - https://community.home-assistant.io/t/default-password-for-the-pi-account/23432

no is not working

Paraphraser commented 1 year ago

OK everyone. I believe I have found a workaround.

Please see this gist.

I'd appreciate feedback.

wermerb commented 1 year ago

OK everyone. I believe I have found a workaround.

Please see this gist.

I'd appreciate feedback.

Hi @Paraphraser,

Much appreciate your gist its very well put together. I've just went over it and it works like a charm. I had only one issue, I had to add one more line to the docker file:

FROM gosungrow:base
USER root
COPY GoSungrow /usr/local/bin/GoSungrow
RUN chmod +x /usr/local/bin/GoSungrow

Otherwise i got a permission denied.

Thanks again for your gist saved me a lot of trouble :).

grf692 commented 1 year ago

Not sure if I am doing something wrong (probably) but it does not work for me:

image

Paraphraser commented 1 year ago

@wermerb Thanks for the feedback. I've updated the gist to include a chmod 755 step (setting it in the context directory rather than in the Dockerfile - but that's just my personal preference).

copadewe commented 1 year ago

Thx for this, but not work, stopped for me at point 3. I will and need to wait for an update of the original. BUT THANK YOU for your kind work!!!

TaxmanNo1 commented 1 year ago

New Update 3.0.7. ist out.

The Add-on works again.

Thank you @MickMake

MickMake commented 1 year ago

Here a PR for the change: #75

Thanks mate. Yup, Sungrow have changed things yet again.

I might make these strings that keep flip-flopping between integers and strings more generic.