This gist is intended to help you deal with the following error conditions:
Error: appkey is incorrect 'er_invalid_appkeyError: unknown error 'Request is not encrypted'- nil pointer exceptions while fetching battery information
- missing device_type arguments
This gist has a number of parts which, because of the way in which this gist has grown over time, are not necessarily in a logical order.
The instructions you should follow depend on what you want to do:
| Part | Explains how to |
|---|---|
| Part 1 | recompile GoSungrow from its source code. This includes the patches that solve all the error conditions listed above. |
| Part 2 | install a patched version of GoSungrow in Home Assistant. |
| Part 3 | use a pre-compiled patched binary outside of Home Assistant. This lets you run GoSungrow from your Terminal command line. |
| Part 4 | use a pre-built Docker image outside of Home Assistant. |
| Part 5 | patch the broken Docker add-on for use in Home Assistant. |
Parts 2, 3 and 4 are independent do not require you to follow the steps in Part 1 and recompile GoSungrow yourself. The instructions in these parts assume you are using one of the triamazikamno images as your starting point. However, the final result only deals with the "appkey is incorrect" and "request is not encrypted" errors.
Part 5 depends on you first recompiling GoSungrow yourself by following the steps in Part 1. Part 5 then explains how to construct a new add-on image for Home Assistant which includes the recompiled binary. The result deals with all four error conditions listed above.
The reason this gist has a multi-part structure is historical.
The first version of this gist answered the question, "how do I recompile GoSungrow from its source code?" That material became Part 1.
Part 2 went through several revisions including using a Dockerfile plus the results of recompiling as per Part 1 to produce a new local image for Home Assistant. When triamazikamno provided patched Docker images, Part 2 was replaced with simpler (!) instructions.
Part 3 was added following a suggestion by xpufx which further leverages the work done by triamazikamno and avoids the need for recompiling GoSungrow from its source code.
Part 4 was added following a comment by Lmecano which identified a use-case for deploying the Docker images outside of the confines of Home Assistant.
Part 1 was amended to explain how to include pull requests 108, 137 and 138, alongside the fixes from the triamazikamno encryption branch.
Part 5 was added so that the "fully patched" binary could be used in Home Assistant, effectively replacing Part 2.
So long as you do not encounter either the nil pointer exceptions while fetching battery information or missing device_type arguments problems, Parts 2, 3 and 4 remain valid.
These instructions have been tested on macOS (Darwin) and Raspberry Pi OS (Debian). The Go compiler can be installed on Windows but I don't have any way of testing that.
gitis installed.wgetis installed.
If you are recompiling GoSungrow so that you can then proceed to Part 5 and rebuild the Home Assistant GoSungrow add-on, you can follow these Part 1 instructions on either a support host (Linux, macOS, Windows), or your Home Assistant instance using the Advanced SSH & Web Terminal.
The advantages of compiling on your HA instance are:
- the Go compiler will compile for the correct hardware architecture automatically. You will not have to worry about cross-compiling to account for any differences between your support host and the hardware on which your Home Assistant instance is running; and
- the compiled binary will already be on your HA instance so there will be no need to try to figure out how to copy the binary from your support host onto your HA instance.
The disadvantages are:
- the specs for support hosts tend to be "big and beefy" whereas Home Assistant is typically deployed on Watts-conserving hardware. This means that compilation will be fairly slow (minutes); and
- the "scaffolding" you put in place (the Go compiler and the GoSungrow source tree) will disappear the next time the Advanced SSH & Web Terminal add-on is re-created.
Given that you are unlikely to be doing this every day, the advantages may well outweigh the disadvantages. It's up to you to decide.
-
Create the "go" sub-directory in your home directory:
$ mkdir -p ~/go -
Add the following lines to your
~/.bashrcor~/.profileas is your preference:#======================================================================= # Senses if the go compiler is installed #======================================================================= GO_BIN=/usr/local/go/bin if [ -x "$GO_BIN/go" ] ; then export GOPATH="$HOME/go" export PATH="$PATH:$GO_BIN:$GOPATH/bin" fi unset GO_BIN
Tips:
- If you copy/paste into a Windows text editor, make sure your editor saves with Unix (
␊: 0x0A) line endings, rather than Windows (␍␊0x0D 0x0A). Alternatively, use a tool likedos2unixto post-process the file. - If you are doing all this on your Home Assistant instance, you must use
~/.profile.
- If you copy/paste into a Windows text editor, make sure your editor saves with Unix (
-
Open your browser at the Go downloads page.
-
Choose an appropriate image. Example:
$ URL=https://go.dev/dl/go1.25.5.linux-arm64.tar.gz $ TARGZ=$(basename $URL)
-
Also make a note of the SHA256 checksum and assign it to a variable. Example:
$ HASH=b00b694903d126c588c378e72d3545549935d3982635ba3f7a964c9fa23fe3b9 -
Download the image:
$ wget $URL -
Verify the checksum:
$ shasum -a 256 -c <<< "$HASH *$TARGZ" go1.25.5.linux-arm64.tar.gz: OK
-
Install the compiler (replacing any older version):
$ sudo rm -rf /usr/local/go $ sudo tar -C /usr/local -xzf $TARGZ
- Open your browser at the Go download and install page.
- Click the "Download" button, then pick the correct installer (
ARM64for Apple Silicon,x86-64for Intel silicon). - Run the installer package from your Downloads folder. This installs/updates as appropriate.
Tip:
-
If you have an older version of Go installed via HomeBrew, you can remove it with:
$ brew uninstall goHomeBrew does not install the Go compiler in
/usr/local/go/bin. You will need to adapt the login script commands if you want to use HomeBrew to install/update Go.
See download and install page.
-
Logout and login again so the new login script commands run.
-
Confirm that GOPATH returns a sensible result:
$ echo $GOPATH /home/pi/go
-
Confirm that the compiler is present:
-
Linux:
$ go version go version go1.25.5 linux/arm64
-
macOS:
$ go version go version go1.25.5 darwin/amd64
-
-
Check that Git knows who you are:
$ git config user.name $ git config user.email
If you get null or silly answers (eg the second command returns
user.name) then please run the following commands, substituting appropriate values for your name and email address:$ git config --global user.name "«yourNameHere»" $ git config --global user.email "«yourEmailAddressHere»"
The values you supply here do not have to be valid. They do not get sent anywhere. What these commands do is initialise
~/.gitconfig. If you have been using Git for any length of time, that file will almost certainly exist already. -
Construct the following directory structure:
$ mkdir -p ~/go-projects/MickMake -
Clone the GoUnify repository:
$ cd ~/go-projects $ git clone https://github.com/MickMake/GoUnify.git
-
Clone the GoSungrow repository:
$ cd MickMake $ git clone https://github.com/MickMake/GoSungrow.git
-
Move into the GoSungrow directory:
$ cd GoSungrow -
-
Point to the
triamazikamnofork of the GoSungrow repository and fetch theencryptionbranch from that fork:$ git remote add -t encryption triamazikamno https://github.com/triamazikamno/GoSungrow.git $ git fetch triamazikamno encryption
-
Fetch various Pull Request branches which have been submitted to the GoSungrow repository:
$ git fetch origin pull/108/head:PR108 $ git fetch origin pull/137/head:PR137 $ git fetch origin pull/138/head:PR138
-
Create a local branch to hold the results of merging the various patches
$ git checkout -b patch-set -
Merge the patches in date order:
$ git merge -m "apply PR108" PR108 $ git merge -m "apply triamazikamno/encryption" triamazikamno/encryption $ git merge -m "apply PR137" PR137 $ git merge -X theirs -m "apply PR138" PR138
PR138 causes a conflict (with some comment lines) so the
-X theirsoption tells Git to prefer the incoming pull request.
-
-
Compile GoSungrow for your native architecture:
$ go mod tidy $ go build
The time it takes Go to compile GoSungrow depends on the clock speed of your hardware and the number of CPU cores available. Be patient!
If the hardware architecture of your support host differs from that of the host where you want to deploy GoSungrow then you will need to cross-compile for your final target platform. One example might be where your support host uses an Intel chip while your Home Assistant instance is running on an ARM chip (eg Raspberry Pi). Cross-compiling is explained later.
The next three steps tell you to run GoSungrow like this:
./GoSungrowThe ./ prefix means "run the just-recompiled binary from the working directory". Please do not make the mistake of omitting the ./ prefix because that risks executing an older version of GoSungrow that does not have any of the patches.
$ ./GoSungrow version
GoSungrow v3.0.7
Self-manage this executable.
Usage:
GoSungrow version
GoSungrow version [command]
Examples:
GoSungrow version
Available Commands:
check Version - Check and show any version updates.
list Version - List available versions.
info Version - Info on current version.
latest Version - Info on latest version.
update Version - Update version of this executable.
Flags: Use "GoSungrow help flags" for more info.
Additional help topics:
Use "GoSungrow version help [command]" for more information about a command.If you followed the optional step to apply the patches, you will also need to update the APPKey on any system where you intend to run GoSungrow. See APPKey configuration.
Follow the instructions to set your iSolarCloud gateway configuration.
You can confirm everything is working by running:
$ ./GoSungrow api login
Email: [email protected]
Create Date: Thu Feb 09 13:14:55 CST 2023
Login Last Date: 2023-12-07 12:42:57
Login Last IP:
Login State: 1
User Account: something
User Id: 999999
User Name: someone
Is Online: false
Token: 999999_99999999999999999999999999999999
Token File: /home/pi/.GoSungrow/AppService_login.jsonThis section is optional. If you don't need to cross-compile, skip down to using the recompiled binary.
I want to run GoSungrow on a Raspberry Pi. Although I can install the Go compiler (as above) and compile GoSungrow on the Pi, it is much faster to do the work on macOS. All these commands are run on macOS:
-
Cross-compile for 64-bit Raspberry Pi OS:
$ GOOS=linux GOARCH=arm64 go build -o GoSungrow-linux-arm64I am told that the Windows
powershellequivalent of the above is:$env:GOOS="linux"; $env:GOARCH="arm64"; go build -o GoSungrow-linux-arm64 -
Copy compiled binary to target Raspberry Pi system ("iot-hub"):
$ scp GoSungrow-linux-arm64 iot-hub:./GoSungrow GoSungrow-linux-arm64 100% 90MB 90.0MB/s 00:01
-
Check result:
$ ssh iot-hub file GoSungrow GoSungrow: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=T7VxiW_Bb7zpmTzK5Gjk/ek581bp4wUYxRJpI4LW7/67TEDExnbLJooHJ3cURP/8Pi_onP5w88QBDpLdkcP, with debug_info, not stripped
-
Comparison with "native" compile on macOS:
$ file GoSungrow GoSungrow: Mach-O 64-bit executable x86_64
Copy the script below and paste into a file named build-all.sh:
#!/usr/bin/env bash
compile_for() {
echo "Compiling for $1/$2"
GOOS=$1 GOARCH=$2 go build -o GoSungrow-${1}-${2}
}
go clean
compile_for darwin amd64
compile_for darwin arm64
compile_for linux amd64
compile_for linux arm64
if [ -n "$(which lipo)" ] ; then
echo "Constructing universal binary for macOS"
lipo -create -output GoSungrow-mac GoSungrow-darwin-amd64 GoSungrow-darwin-arm64
fiThe build-all.sh script should be at the path:
~/go-projects/MickMake/GoSungrow/build-all.sh
Give the file execute permission and run it:
$ cd ~/go-projects/MickMake/GoSungrow
$ chmod +x build-all.sh
$ ./build-all.shThe result of running the script is four binaries:
GoSungrow-darwin-amd64for macOS on Intel chipsGoSungrow-darwin-arm64for macOS on Apple siliconGoSungrow-linux-amd64for Linux on Intel chipsGoSungrow-linux-arm64for Raspberry Pi
If the lipo tool is available, the script also assembles the first two binaries into:
GoSungrow-macmacOS "universal" binary
There are many ways to use the recompiled binary. About the simplest is to include it in a directory that is in your Unix PATH. The most common pattern for home directories is:
$ mkdir -p ~/.local/bin
$ cp ./GoSungrow ~/.local/bin/.If the
~/.local/bindirectory did not already exist, you may need to logout and login to give your.profileor.bashrca chance to discover it and add it to your PATH.
Once the binary is in a directory that is in your PATH, you can execute it just by typing the command name (ie without the ./ prefix). For example:
$ GoSungrow api loginThis is based on material I added to MickMake/GoSungrow Issue 101.
Notes:
-
There seems to be a common misconception that Supervised Home Assistant does not use Docker images. You may not be aware of it but that doesn't mean Home Assistant isn't using Docker.
-
At the time of writing, the
triamazikamnoimage referred to in this part only contains thetriamazikamno/encryptionpatch. It does not include the patches associated with the following pull requests:PR108 is (largely) cosmetic and what it achieves can be accomplished by following the steps in APPKey configuration. Nevertheless, PR108 will set the correct default APPKey for those GoSungrow users who need to use the so-called "ANDROID" key.
PRs 137 and 138 may offer solutions for those users encountering those problems (which is not everyone).
Now, here is the important point. If you need either or both PR137 or PR138 then you can not follow Part 2. You must follow Part 1 and then Part 5.
triamazikamno has provided patched images for GoSungrow on DockerHub. To use the correct image for your instance of Home Assistant, proceed as follows:
-
Refer to Advanced SSH and Web Terminal for instructions on:
- installing the required add-on;
- configuring the add-on;
- starting the add-on; and
- the conventions this gist adopts when instructing you to use the add-on.
-
You should be able to see the existing (broken) image:
# docker images | grep -e REPOSITORY -e gosungrow REPOSITORY TAG IMAGE ID CREATED SIZE ba22da74/amd64-addon-gosungrow 3.0.7 2f8714749ba2 3 months ago 161MB
Your output may be slightly different but you should at least be able to identify a line with "gosungrow" and version 3.0.7.
Note:
-
If you can't find at least one GoSungrow image then it means something else is wrong with your system. You won't be able to complete these instructions. I recommend deleting and reinstalling the GoSungrow add-on. That will install the broken version but, once that is in place, you should be able to complete these instructions. You may also find it helpful to run the following command:
# docker system prune -f
-
-
Construct the required variables:
# old_image=$(docker images | grep gosungrow | awk '{print $1 ":" $2}') # echo $old_image ba22da74/amd64-addon-gosungrow:3.0.7 # new_image=$(echo $old_image | awk -F/ '{print"triamazikamno/"$2}') # echo $new_image triamazikamno/amd64-addon-gosungrow:3.0.7
You should get sensible responses to the
echocommands. Your exact output may differ but you should be able to see that the earlier output fromdocker imageshas turned up in the firstechocommand, and that the first part of the image name (ieba22da74) has been replaced withtriamazikamnoin the secondechocommand.Note:
- If you don't get sensible responses to the
echocommands then it means something is wrong. Go back and re-check your work.
- If you don't get sensible responses to the
-
Retag the old image. This prevents it from being removed:
# docker tag $old_image ${old_image}-backupConfirm that that has worked by re-running the
imagescommand:# docker images | grep -e REPOSITORY -e gosungrow REPOSITORY TAG IMAGE ID CREATED SIZE ba22da74/amd64-addon-gosungrow 3.0.7 2f8714749ba2 3 months ago 161MB ba22da74/amd64-addon-gosungrow 3.0.7-backup 2f8714749ba2 3 months ago 161MB
You can see both repository+tag combinations point to the same ImageID.
Note:
- An ImageID is a hash of the image file so two repository+tag combinations pointing to the same ImageID means they are both pointing to the same image file on disk.
-
Pull the replacement image from DockerHub:
# docker pull $new_image 3.0.7: Pulling from triamazikamno/amd64-addon-gosungrow 659d66d51139: Already exists 7c0ba91aad39: Pull complete fb2a01b55562: Pull complete 4425acca1925: Pull complete d50c5eb93aa0: Pull complete adde5526d152: Pull complete Digest: sha256:216c20966785878ccae85b48e45f31fc5e38295f04589d0b2377a7c8b564c867 Status: Downloaded newer image for triamazikamno/amd64-addon-gosungrow:3.0.7 docker.io/triamazikamno/amd64-addon-gosungrow:3.0.7
Again, the actual details may vary but
imageswill confirm the result:# docker images | grep -e REPOSITORY -e gosungrow REPOSITORY TAG IMAGE ID CREATED SIZE triamazikamno/amd64-addon-gosungrow 3.0.7 f2cbc9418287 11 hours ago 161MB ba22da74/amd64-addon-gosungrow 3.0.7 2f8714749ba2 3 months ago 161MB ba22da74/amd64-addon-gosungrow 3.0.7-backup 2f8714749ba2 3 months ago 161MB
Three repository+tag combinations but now we have two distinct images.
-
Now we change the middle tag to point to the new image:
# docker tag $new_image $old_imageAnd confirm that again with
images:# docker images | grep -e REPOSITORY -e gosungrow REPOSITORY TAG IMAGE ID CREATED SIZE ba22da74/amd64-addon-gosungrow 3.0.7 f2cbc9418287 11 hours ago 161MB triamazikamno/amd64-addon-gosungrow 3.0.7 f2cbc9418287 11 hours ago 161MB ba22da74/amd64-addon-gosungrow 3.0.7-backup 2f8714749ba2 3 months ago 161MB
Note:
- This step of using the old repository+tag combination to point to the new ImageID is what causes Home Assistant to load the new patched image rather than the old broken image.
-
Go back to the Home Assistant GUI:
- Follow the steps to set your iSolarCloud gateway configuration.
- Follow the steps to set your APPKey configuration.
- Switch to the "Info" tab and click "START" or "RESTART" as seems appropriate.
-
If HA seems to freeze, try quitting your browser and reconnecting to the GUI. Worst case you may need to restart HA, and then start GoSungrow again.
triamazikamno has provided patched versions of GoSungrow on GitHub. If you want to obtain a patched version of GoSungrow for use outside of Home Assistant but you do not want to recompile GoSungrow yourself, proceed as follows:
-
Use your browser to open the following URL:
-
Scroll down to "Assets" and expand the disclosure triangle if necessary.
-
Identify the asset which is appropriate to your platform. Examples:
- macOS on Intel =
GoSungrow-darwin_amd64.tar.gz - macOS on Apple silicon =
GoSungrow-darwin_arm64.tar.gz - Linux on Intel =
GoSungrow-linux_amd64.tar.gz - Linux on 64-bit Raspberry Pi =
GoSungrow-linux_arm64.tar.gz
- macOS on Intel =
-
Download the asset to your system. You can either do that from within your browser or you can copy the asset URL to your clipboard, then paste it into a
wgetcommand. Something like this would get the job done:$ mkdir ~/GoSungrow-patched $ cd ~/GoSungrow-patched $ wget https://github.com/triamazikamno/GoSungrow/releases/download/v3.0.7/GoSungrow-linux_arm64.tar.gz
Just make sure you use the correct asset URL in the
wgetcommand. -
Unpack the
.tar.gz(a tape archive – sometimes called a "tarball" – with gzip compression):-
On macOS (assuming you asked your browser to do the download), the asset will be in your Downloads folder. Double-clicking the downloaded asset creates a folder of the same base name as the asset and extracts the asset's contents into that folder.
-
On Linux (assuming you have just done the
wgetas above and your working directory is still~/GoSungrow-patched), you can extract the asset's contents into the working directory like this:$ tar -xzf *.tar.gz
Either way, you wind up with a folder containing the
GoSungrowbinary plus some other odds and ends which you can ignore. -
-
Complete the following steps from Part 1:
triamazikamno has provided patched images for GoSungrow on DockerHub. Although the images were intended for use with Home Assistant, they are just Docker images and can also be used outside of Home Assistant.
-
Create a directory to hold the GoSungrow configuration and its runtime artifacts. These instructions assume the following but the actual directory can have any name and can be located anywhere:
$ mkdir -p $HOME/GoSungrow -
Use the following JSON as a template:
{ "sungrow_host": "«Host URL»", "sungrow_user": "«USERNAME»", "sungrow_password": "«PASSWORD»", "sungrow_appkey": "«APPKEY»", "mqtt_host": "localhost", "mqtt_port": "1883", "mqtt_user": "", "mqtt_password": "", "debug": false, "sungrow_timeout": 60 } -
Edit the JSON:
"sungrow_host": see iSolarCloud gateway configuration and replace«Host URL»with the appropriate Host URL."sungrow_user"and"sungrow_password": replace both«USERNAME»and«PASSWORD»with your iSolarCloud credentials."sungrow_appkey": see APPKey configuration and replace«APPKEY»with the appropriate key."mqtt_host": the default value of"localhost"assumes the broker is running on the same host as the GoSungrow container but this field can contain a hostname, domain name or IP address."mqtt_port": the default port for MQTT is 1883 so only change this if you know your broker is running on a non-standard port."mqtt_user"and"mqtt_password": default to null strings, which assumes your broker does not check credentials. Set appropriate values if your broker authenticates messages."debug"and"sungrow_timeout": should be left as is.
-
Save the edited JSON to the path:
$HOME/GoSungrow/options.json
-
From the following list, choose the image which is appropriate for your host's architecture:
Image Typical Platform triamazikamno/armhf-addon-gosungrow:3.0.7Raspberry Pi 3 triamazikamno/armv7-addon-gosungrow:3.0.7Raspberry Pi 4 in 32-bit user mode (kernel mode is irrelevant) triamazikamno/aarch64-addon-gosungrow:3.0.7Raspberry Pi 4/5 in full 64-bit mode triamazikamno/amd64-addon-gosungrow:3.0.7Debian guest on Proxmox-VE running on Intel -
In the following command, replace
«IMAGE»with the image you chose in the previous step:$ docker run -d --name gosungrow --net=host \ -v "/etc/ssl/certs:/etc/ssl/certs:ro" \ -v "$HOME/GoSungrow:/data" \ «IMAGE»
-
Execute the command. For example, on a Raspberry Pi 4 running full 64-bit Bullseye or Bookworm, the command would be:
$ docker run -d --name gosungrow --net=host \ -v "/etc/ssl/certs:/etc/ssl/certs:ro" \ -v "$HOME/GoSungrow:/data" \ triamazikamno/aarch64-addon-gosungrow:3.0.7
Notes:
-
--net=hostis only needed to facilitate the use of"mqtt_host": "localhost"in theoptions.jsonfile. If you run the GoSungrow container as part of a stack in which Mosquitto is also running, you can employ non-host mode and change"localhost"to"mosquitto". -
The first
-vmaps the host's SSL certificates into the container. The container will inherit any changes made by routine updates to your operating system. -
When you execute the
docker runcommand on a non-Intel platform, you may see the following message:WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requestedYou can ignore that message. See GoSungrow Issue 32 for more information.
This part explains how to use the result of Part 1 to patch the existing (broken) GoSungrow add-on:
-
Assumptions:
-
The (broken) GoSungrow 3.0.7 add-on has already been installed on your Home Assistant instance;
-
When you try to start the GoSungrow 3.0.7 add-on, it aborts;
-
You have used Home Assistant's UI controls to stop the add-on. In other words, the:
Settings » Add-ons » GoSungrow » Info tabshows "Start". Please do not proceed if the add-on is constantly restarting.
-
You have not followed these instructions before. If you are following these instructions for a second or subsequent time, you will need to "undo" the effects of the previous run, like this:
# docker tag ba22da74/amd64-addon-gosungrow:3.0.7-backup ba22da74/amd64-addon-gosungrow:3.0.7 # docker rmi patched/amd64-addon-gosungrow:3.0.7 ba22da74/amd64-addon-gosungrow:3.0.7-backup # docker system prune -f
-
You do not have any other add-ons installed which have
gosungrowin the name. In particular, the presence of GoSungrow2MQTT will cause a mess so please don't proceed if you have that installed.
-
-
Refer to Advanced SSH and Web Terminal for instructions on:
- installing the required add-on;
- configuring the add-on;
- starting the add-on; and
- the conventions this gist adopts with respect to the add-on (in particular, that
#indicates a command).
-
You should be able to see the existing (broken) image:
# docker images | grep -e REPOSITORY -e gosungrow REPOSITORY TAG IMAGE ID CREATED SIZE ba22da74/amd64-addon-gosungrow 3.0.7 2f8714749ba2 2 years ago 161MB
Your output may be slightly different but you should at least be able to identify a line with "gosungrow" and version 3.0.7.
-
Construct the required variables:
# old_image=$(docker images | grep gosungrow | awk '{print $1 ":" $2}') # echo $old_image ba22da74/amd64-addon-gosungrow:3.0.7 # new_image=$(echo $old_image | awk -F/ '{print"patched/"$2}') # echo $new_image patched/amd64-addon-gosungrow:3.0.7
Please make sure those two
echocommands produce sensible results. They do not need to be identical to the examples here but they should show a similar pattern. -
Retag the old image. This prevents it from being removed:
# docker tag $old_image ${old_image}-backupConfirm that the tagging has worked by re-running the
imagescommand:# docker images | grep -e REPOSITORY -e gosungrow REPOSITORY TAG IMAGE ID CREATED SIZE ba22da74/amd64-addon-gosungrow 3.0.7 2f8714749ba2 2 years ago 161MB ba22da74/amd64-addon-gosungrow 3.0.7-backup 2f8714749ba2 2 years ago 161MB
You can see both repository+tag combinations point to the same ImageID. An ImageID is a hash of the image file so two repository+tag combinations pointing to the same ImageID means they are both pointing to the same image file on disk.
-
Create a context directory and make it your working directory:
# mkdir context # cd context
-
Here is where things get slightly complicated. Your goal is to copy the compiled binary that you produced in Part 1 so that it winds up in this
contextdirectory. The result also needs to be calledGoSungrow:-
If you compiled GoSungrow on your HA instance, you only need to move the compiled binary into the context directory. This command should get the job done:
# mv ~/go-projects/MickMake/GoSungrow/GoSungrow . -
If you compiled GoSungrow on your support host, you may be able to use SCP to copy the binary. Here is an example:
# scp «user»@«hostOrIP»:go-projects/MickMake/GoSungrow/GoSungrow-linux-amd64 GoSungrow Password: GoSungrow-linux-amd64 100% 100MB 73.8MB/s 00:01
Notes:
-
My Home Assistant instance is running as a Proxmox-VE guest on an old Intel MacBook Pro with so the
linux-amd64variant is what I need. You need to pick the GoSungrow variant that matches your Home Assistant's hardware platform. -
The Advanced SSH and Web Terminal doesn't support running the SCP in the other direction (pushing from your support host to your Home Assistant instance).
-
-
-
Make sure the Unix permissions are set correctly:
# chmod 755 GoSungrowCheck the result:
# ls -l total 102572 -rwxr-xr-x 1 root root 105029473 Dec 8 12:11 GoSungrowThe permission flags on the left hand side need to be
-rwxr-xr-x. This step is particularly important if you recompiled GoSungrow on a Windows platform. -
Create a Dockerfile:
# echo -e "FROM ${old_image}\nCOPY GoSungrow /usr/local/bin/GoSungrow\n" >DockerfileConfirm the result:
# cat Dockerfile FROM ba22da74/amd64-addon-gosungrow:3.0.7 COPY GoSungrow /usr/local/bin/GoSungrow
-
Build a new image (which replaces the broken
GoSungrowbinary with the patched version):# docker build -t ${new_image} . -
Inspect the result:
# docker images | grep -e REPOSITORY -e gosungrow REPOSITORY TAG IMAGE ID CREATED SIZE patched/amd64-addon-gosungrow 3.0.7 ffa9f14cf3b6 34 seconds ago 266MB ba22da74/amd64-addon-gosungrow 3.0.7 2f8714749ba2 2 years ago 161MB ba22da74/amd64-addon-gosungrow 3.0.7-backup 2f8714749ba2 2 years ago 161MB
Three repository+tag combinations but now we have two distinct images (ie different ImageIDs).
-
Change the middle tag to point to the new image:
# docker tag $new_image $old_imageConfirm the result:
# docker images | grep -e REPOSITORY -e gosungrow REPOSITORY TAG IMAGE ID CREATED SIZE ba22da74/amd64-addon-gosungrow 3.0.7 ffa9f14cf3b6 4 minutes ago 266MB patched/amd64-addon-gosungrow 3.0.7 ffa9f14cf3b6 4 minutes ago 266MB ba22da74/amd64-addon-gosungrow 3.0.7-backup 2f8714749ba2 2 years ago 161MB
This step of using the old repository+tag combination to point to the new ImageID is what causes Home Assistant to load the new patched image rather than the old broken image.
-
Go back to the Home Assistant GUI:
- Follow the steps to set your iSolarCloud gateway configuration.
- Follow the steps to set your APPKey configuration.
- Switch to the "Info" tab and click "START".
-
If HA seems to freeze, try quitting your browser and reconnecting to the GUI. Worst case you may need to restart HA, and then start the GoSungrow add-on again.
To run commands on your Home Assistant instance, you must use the "Advanced SSH & Web Terminal" add-on:
To prepare the add-on for use, go to Settings » Add-ons » Advanced SSH & Web Terminal. In the:
-
"Configuration" tab:
- you need to set a username and password. This example uses "hassio" as the username. It turns up in the
sshcommand below.
- you need to set a username and password. This example uses "hassio" as the username. It turns up in the
-
"Info" tab:
- "Show in sidebar" should be turned ON.
- "Protection mode" needs to be turned OFF.
- if you changed any settings in either tab, click "RESTART". If you don't see "RESTART" then click "START".
To use the add-on, do one of the following:
-
Either – from your support host (Linux, macOS, Windows), replace
hassiowith the username you set in the "Configuration" tab above and connect to your HA instance:$ ssh [email protected]The prompt you get is:
~ #The
#indicates you are running as root and the~indicates that your working directory is root's home directory. -
Or – from the HomeAssistant web GUI, click "Terminal". A terminal window opens and the prompt you get is:
~ $Although the Unix convention is that a
$prompt means "running unprivileged" while#means "running as root", the HA Terminal window is in fact running as root and the working directory is root's home directory.
Whenever this gist gives you commands that should be executed in the Advanced SSH and Web Terminal add-on, the convention is:
- a line starting with "#" means "copy/paste everything except the
#and press return". - a line that does not start with "#" indicates the expected response from the preceding command.
Any directories or local files that you create via the Advanced SSH and Web Terminal will disappear when the Advanced SSH and Web Terminal add-on restarts. This includes any automatic restart when you reboot your Home Assistant instance. This is the expected behaviour (think of it like a student lab at a university).
Conversely, any Docker images that you install or patch while using the Advanced SSH and Web Terminal add-on will persist.
Sungrow appears to operate the iSolarCloud servers shown in the table below. There may be more. If you discover another server then please add a comment to this gist and I will update the list.
Clicking a link in the "Web URL" column will take you to a web portal where you can login. The "Host URL" column is the URL you need to use for GoSungrow.
URLs marked with "†" are guesses based on the .eu pattern. Each domain name resolves in the Domain Name System but I have no way of testing whether any gateway other than the Australian host works in practice. If you use one of these servers and are able to confirm the Host URL is correct, please let me know in the comments below.
| "Server" | Web URL | Host URL |
|---|---|---|
| Chinese | www.isolarcloud.com.cn | https://gateway.isolarcloud.com.cn † |
| European | www.isolarcloud.eu | https://gateway.isolarcloud.eu |
| International | www.isolarcloud.com.hk | https://gateway.isolarcloud.com.hk † |
| Australian | au.isolarcloud.com | https://augateway.isolarcloud.com |
To apply a "Host URL":
-
If you are using the GoSungrow add-on in Home Assistant:
- Open the Home Assistant GUI.
- Click "Settings".
- Click "Add-ons".
- Click "GoSungrow".
- Click the "Configuration" tab.
- Enter the Host URL from the table into the
sungrow_hostfield. - Click "Save" then follow your nose.
-
If you are using the GoSungrow binary, run:
$ ./GoSungrow config write --host "«Host URL»"Example:
$ ./GoSungrow config write --host "https://augateway.isolarcloud.com" -
If you are editing a JSON configuration file, replace the
«Host URL»field with the value from the table:{ "sungrow_host": "«Host URL»", }Example:
{ "sungrow_host": "https://augateway.isolarcloud.com", }
The situation with APPKeys is confusing. Some people report success with one key, other people another key. Below is a list of known keys. Try them in order until you find one that works:
B0455FBE7AA0328DB57B59AA729F05D8ANDROIDE13EC118BD7892FE7AB5A3F20
If you discover new APPKeys, please let me know and I'll add them to this list.
To apply an "APPKey":
-
If you are using the GoSungrow add-on in Home Assistant:
- Open the Home Assistant GUI.
- Click "Settings".
- Click "Add-ons".
- Click "GoSungrow".
- Click the "Configuration" tab.
- Enter the APPKey from the table into the
sungrow_appkeyfield. - Click "Save" then follow your nose.
-
If you are using the GoSungrow binary, run:
$ ./GoSungrow config write --appkey «APPKey»Example:
$ ./GoSungrow config write --appkey B0455FBE7AA0328DB57B59AA729F05D8 -
If you are editing a JSON configuration file, replace the
«APPKEY»field with the value from the table:{ "sungrow_appkey": "«APPKEY»", }Example:
{ "sungrow_appkey": "B0455FBE7AA0328DB57B59AA729F05D8", }
-
2025-12-08
- Incorporate comments from @51iMM - thanks!
- Adds confirmation that recompilation can be done on the HA instance.
-
2025-12-08
-
2024-05-02
- Evidence now suggests there is no correlation between iSolarCloud servers and AppKeys. Text adjusted.
-
2024-05-01
- Consolidate all information about iSolarCloud gateways and APPKeys into a new section and cross-reference existing sections to the consolidated material.
-
2024-03-15
- Adds Part 4 to leverage existing updated DockerHub images for anyone who wants to run GoSungrow in a Docker container outside of Home Assistant.
-
2024-03-13
- Adds Part 3 to leverage existing recompiled binaries (which are inputs to the updated DockerHub images) for anyone who simply wants to obtain a patched version of GoSungrow without having to recompile it themselves.
-
2024-02-28
- Includes reminder to click SAVE when changing settings.
-
2024-01-30
- Adds reminder to set cloud gateway for non-AU systems.
-
2024-01-22
- Move
go mod tidybeforego build.
- Move
-
2024-01-14
- Emphasise need to use
./prefix when testing the recompiled binary. - Add short section on using GoSungrow from
~/.local/bin.
- Emphasise need to use
-
2023-12-24 - restructure to make clear the distinction between recompiling and using replacement images in Home Assistant.
-
2023-12-06 - revise "hack" to clarify that the hack can be applied without opening a connection via SSH.
-
2023-12-09 - revise "hack" to use images provided by triamazikamno on DockerHub.
-
2023-12-07 - add steps to recompile from triamazikamno fork to resolve
er_invalid_appkeyproblem:- Additional step during compilation
- Update the APPKey
-
2023-11-29 - re-tested using
go 1.21.4on:- M2 MacBook Pro running macOS Ventura 13.6.2
- Intel Mac Mini running Debian Bookworm guest on Proxmox VE
- Raspberry Pi 4B running Raspberry Pi OS Bullseye
- Raspberry Pi 4B running Raspberry Pi OS Bookworm
-
2023-09-18 - satisfy GoUnify dependency.

Just to be sure that nothing had changed under the hood, I recompiled GoSungrow with the latest Go compiler and otherwise followed Part 1. I had no trouble.
The only places E914 has been mentioned are issue 101 and earlier in this gist's comments.
The person who made the issue 101 comment never made any other contributions to that issue so I don't know whether they fixed it themselves or just gave up.
Although I've been able to cause E914 by switching to the other AppKey, I've always wondered whether E914 might be a generic error that means "I don't like the totality of your credentials".
Aside from some people needing
B0...while others need theANDROID...AppKey, I've never been too clear on what is "correct" when it comes to identifying yourself as a user. When I run:I get a display that includes:
The credentials I actually login with are the User Account and password. I have no idea whether
EmailorUser IDwould work as synonyms forUser Account(User Nameis clearly non-unique so that won't work).Maybe it's as simple as that.
Otherwise, dunno. Sorry.