MickMake / GoSungrow

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

Error 'er_invalid_appkey' / 'Request is not encrypted' #101

Open rob3r7 opened 10 months ago

rob3r7 commented 10 months ago

Since tonight I get with https://gateway.isolarcloud.eu in HA the following error:

ERROR: appkey is incorrect 'er_invalid_appkey

Checking with https://portaleu.isolarcloud.com/ I realized that the appkey could have changed to B0455FBE7AA0328DB57B59AA729F05D8 (at least I find this key when searching for the term appkey) .

When doing a direct request at /v1/userService/login at least I don't get any more an invalid_appkey error but now an Request is not encrypted error.

When looking at the source of https://portaleu.isolarcloud.com/#/dashboard there is the following function:

e.data.set("appkey", a.a.encryptHex(e.data.get("appkey"), h))

Did Sungrow changed the API access? How to deal with this change?

Paraphraser commented 8 months ago

@DanelRod see this gist

Paraphraser commented 8 months ago

@iuliusmaximilian The only place I needed go mod tidy was in the original compile for the native platform. I also don't believe it is necessary to set those vars in your login scripts.

I've included some output below in case it helps you figure out why you needed to do all that.


Starting (on an Apple M2 MacBook Pro) with:

and then following the gist "as written" to compile for the native platform:

[flint-air Sun Jan 21 23:45:33 GoSungrow] $ go build
go: downloading github.com/MickMake/GoUnify
    […snip…]
go: downloading github.com/lucasb-eyer/go-colorful v1.0.3
go: updates to go.mod needed; to update it:
    go mod tidy

[flint-air Sun Jan 21 23:45:57 GoSungrow] $ go mod tidy
go: downloading github.com/agrison/go-tablib v0.0.0-20160310143025-4930582c22ee
    […snip…]
go: downloading github.com/chzyer/logex v1.1.10

[flint-air Sun Jan 21 23:46:09 GoSungrow] $ go build

[flint-air Sun Jan 21 23:46:33 GoSungrow] $ ./GoSungrow version
GoSungrow v3.0.7
    […snip…]

A "one-liner" cross-compile for a specific platform:

[flint-air Sun Jan 21 23:47:02 GoSungrow] $ GOOS=linux GOARCH=arm64 go build -o GoSungrow_linux_arm64

Running the multi-platform cross-compile script supplied in the gist:

[flint-air Sun Jan 21 23:48:11 GoSungrow] $ ./build-all.sh 
Compiling for darwin/amd64
Compiling for darwin/arm64
Compiling for linux/amd64
Compiling for linux/arm64
Constructing universal binary for macOS

Testing the universal binary on the Mac:

[flint-air Sun Jan 21 23:58:16 GoSungrow] $ file GoSungrow-mac 
GoSungrow-mac: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64]
GoSungrow-mac (for architecture x86_64):    Mach-O 64-bit executable x86_64
GoSungrow-mac (for architecture arm64): Mach-O 64-bit executable arm64

[flint-air Sun Jan 21 23:58:21 GoSungrow] $ ./GoSungrow-mac version
GoSungrow v3.0.7
    […snip…]

Testing the cross-compiled version for the Raspberry Pi:

[flint-air Mon Jan 22 00:00:31 GoSungrow] $ scp GoSungrow-linux-arm64 sec-dev:.
GoSungrow-linux-arm64                                                                     100%  101MB  46.0MB/s   00:02    
[flint-air Mon Jan 22 00:00:58 GoSungrow] $ ssh sec-dev ./GoSungrow-linux-arm64 version
GoSungrow v3.0.7
    […snip…]

And, for the record, I don't have those environment variables set in my .bashrc/.profile etc:

[flint-air Mon Jan 22 00:04:47 GoSungrow] $ echo "GOARCH=$GOARCH, GOOS=$GOOS, GOHOSTARCH=$GOHOSTARCH"
GOARCH=, GOOS=, GOHOSTARCH=
Paraphraser commented 8 months ago

@iuliusmaximilian Turns out it's possible to stick the go mod tidy before the first go build. Then you don't get the prompt to run that command. I've updated the gist accordingly.

b1ackh34rt commented 8 months ago

@b1ackh34rt Short answer: yes!

Longer answer…

I'm also very new to HA. I have it running as a Proxmox guest but I don't use it for anything other than tinkering.

It's also well over a decade since I used Windows for anything and, even then, it was in a corporate environment where "problems" just became helpdesk tickets. Although I can surmise that "Windows server", "Hyper-V" and everything else in that sentence sounds like a Windows approximation of what I'm running with Proxmox, I can't be certain about any of it. Sorry.

Not that it makes any difference to what I'm about to say but my guess is that your HA system is indeed using Docker containers and you just haven't discovered that yet.

I agree that the installation instructions for GoSungrow rely a bit too much on "assumed knowledge".

A good example is this question of Mosquitto. I agree that is not really explained anywhere, either that you need a Mosquitto broker, or how to install one. It's simply implied.

How is it implied? It's implied anywhere you see a reference to MQTT and, in particular, under the heading of What does it do?, item 2 is "MQTT client to push to HomeAssistant".

My guess is that MickMake assumed that anyone with some Internet-of-Things background would be able to look at item 2 and reason like this:

  1. GoSungrow publishes metrics using MQTT". That, in turn, means,
  2. I will need need an MQTT broker somewhere. That, in turn, means,
  3. Home Assistant will need to subscribe to the same broker in order to receive the metrics from GoSungrow.

Of course, anyone who hasn't reached just the right point on the IoT learning-curve finds themselves up the proverbial creek.

An MQTT broker is just something which can receive and distribute messages using the MQTT protocol. The most commonly-used example of a broker is Mosquitto.

You can provide a Mosquitto broker service in a variety of ways:

  1. You can install it "natively" (ie as a system service rather than in a Docker container). I've done that on macOS and Linux. I assume it's possible for Windows.
  2. You can install it as a Docker container.
  3. You can do it as a Home Assistant "add-on".

There's no "correct" answer. There's also nothing stopping you from having multiple MQTT brokers running in your network.

However, if you're going to run GoSungrow as a Home Assistant add-on then you may as well also install Mosquitto as a Home Assistant add-on.

Hold that thought.

Think about how computers reach each other (eg a ping). You can use the IP address or a host-name or a domain name.

When two or more Docker containers run on the same host, Docker tells the containers to use 127.0.0.11 for DNS queries. Docker augments the normal recursive DNS query process so that each container is able to be reached via the container's hostname (this makes sense if you think of containers as small self-contained computers).

Although this is working backwards, if you install the Mosquitto add-on for Home Assistant and go to its "Info" tab, it will tell you its hostname is "core-mosquitto".

Which brings us to your error message:

ERROR: network Error : dial tcp: lookup core-mosquitto on 127.0.0.11:53: no such host

So, the GoSungrow add-on is trying to find the IP address of a host named core-mosquitto. Because GoSungrow is a container, the /etc/resolv.conf inside the container tells the container's resolver to send queries to port 53 on 127.0.0.11 which is the special Docker resolver that gets in between the Docker containers and the host system on which the containers are running.

The word "host" has to do a lot of work

The Mosquitto add-on container isn't running so the special Docker resolver can't answer. It forwards the query to the host system's resolver which, in turn, may forward the query elsewhere.

Ultimately, nothing can provide an answer to "what's the IP address of core-mosquitto" so the query fails and you get "no such host".

Does that make more sense?

In terms of trying to build a mental map of how it all hangs together, this diagram might help:

mqttbroker

The question that comes after this is, how do you go from HA receiving MQTT messages that are coming to it from GoSungrow via the Mosquitto broker, to the fancy charts shown in the GoSungrow doco?

🤷‍♂️

Hi Mate Sorry for the late reply, xmas and all that! Thanks for the good explanation. I was able to get it all functioning. Your right though, i'm stuck on the next part, getting info into the nice graphs. I can see a lot of sensor.gosungrow options etc now, I tried following the sungrow instructions but none of the named options exist.. I tried adding some off the sensors to match to solar production etc but no luck, any ideas? Cheers!! Happy NYE

alissonzima commented 8 months ago

Just an addendum to the discussion. My requests need to be made to https://gateway.isolarcloud.hk/. When making this request, I was receiving the error 'Failed to establish a new connection: [Errno 11001] getaddrinfo failed.' By making the request directly to the IP, I was able to retrieve the data.

Paraphraser commented 8 months ago

"getaddrinfo" indicates a DNS failure. Consider:

$ dig gateway.isolarcloud.hk +short
$ dig gateway.isolarcloud.com.hk +short
47.56.232.116

The silence in response to the first query suggests that domain name doesn't exist so are you sure you didn't mean the second hostname (with the .com in it)?

I'll add that while there's no particular reason why you shouldn't use an IP address in a URL, you are trusting that the administrators at the other end will never change the server's IP address.

alissonzima commented 8 months ago

"getaddrinfo" indicates a DNS failure. Consider:

$ dig gateway.isolarcloud.hk +short
$ dig gateway.isolarcloud.com.hk +short
47.56.232.116

The silence in response to the first query suggests that domain name doesn't exist so are you sure you didn't mean the second hostname (with the .com in it)?

I'll add that while there's no particular reason why you shouldn't use an IP address in a URL, you are trusting that the administrators at the other end will never change the server's IP address.

I knew the end-of-year break would leave traces. You're absolutely right. In fact, when I performed an external test, I used the correct link:

response = requests.get('https://gateway.isolarcloud.com.hk')

However, when I tried to modify it in your code, I overlooked the '.com.' I spent a couple of hours trying to understand why it wasn't working with the link. Now everything makes sense. The code works perfectly for the '.hk' link too. Thank you.

Skysurfer-14 commented 8 months ago

I have installed the Addon today and get the error message:

[21:10:37] INFO: Login to iSolarCloud using gateway https://gateway.isolarcloud.eu ... Error: appkey is incorrect 'er_invalid_appkey'

Is there hope that someone will fix the problem?

Paraphraser commented 8 months ago

@Skysurfer-14 Please see part 2 of this gist.

The problem (adapting to the change in the Sungrow API, and associated change to the API key) has been fixed, just not in the way you would normally expect (ie as part of the normal Home Assistant update process).

The gist explains the workaround you need to use. The gist covers the two most-common situations:

We (everyone here) hope that, eventually, the fix will become part of the normal Home Assistant update process and we can dispense with the workaround. It just hasn't happened yet.

Paraphraser commented 8 months ago

@alissonzima

However, when I tried to modify it in your code, …

I've been wondering what you meant by that.

Are you saying you searched the code for:

https://augateway.isolarcloud.com

and changed it to:

https://gateway.isolarcloud.com.hk

and then recompiled with that URL string hard-coded?

If "yes", did you try just changing the config settings:

$ GoSungrow config write --host "https://gateway.isolarcloud.com.hk"

Did that work? When I run that command, it definitely updates the JSON file but I don't have any means of testing whether a different server actually works or not.

Skysurfer-14 commented 8 months ago

@Skysurfer-14 Please see part 2 of this gist.

Thanks a lot! The instructions are perfect!

oleg-d commented 8 months ago

If this repo is not being updated with the fix does anyone have a fork made that works or know of one?

triamazikamno commented 8 months ago

If this repo is not being updated with the fix does anyone have a fork made that works or know of one?

See https://github.com/MickMake/GoSungrow/issues/101#issuecomment-1843334457

illuzn commented 8 months ago

Have they changed the protocol again? I'm getting this error when starting the addon (with the triamazikamno fixed build).

PsId: required
JSON request:   {"ps_id":1133554}

2024/02/05 06:14:35 ERROR: unknown error 'Repeated request'
Error: unknown error 'Repeated request'
Paraphraser commented 8 months ago

I've just run

$ GoSungrow api login
$ GoSungrow show ps list

and everything worked as expected so I'd say the answer to your question is "no".

oleg-d commented 8 months ago

@Paraphraser https://gist.github.com/Paraphraser/cad3b0aa6428c58ee87bc835ac12ed37

Thank you so much for making these instructions, I thought they were intimidating at first but I followed Part 2 and took like 10 mins to get the add-on up and running again. Thank you so much!

@triamazikamno See #101 (comment)

I ended up following the gist which uses your docker image has made it a breeze to get me back up and running... Thank you very much too! Now just waiting for the snow to melt.

allocater2 commented 7 months ago

I am trying to make a php version of the go and python scripts, but I did not get far:

$public_key_data = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCkecphb6vgsBx4LJknKKes-eyj7-RKQ3fikF5B67EObZ3t4moFZyMGuuJPiadYdaxvRqtxyblIlVM7omAasROtKRhtgKwwRxo2a6878qBhTgUVlsqugpI_7ZC9RmO2Rpmr8WzDeAapGANfHN5bVr7G7GYGwIrjvyxMrAVit_oM4wIDAQAB"; $decoded_public_key_data = base64_decode($public_key_data); echo $decoded_public_key_data; $key = RSA::loadFormat('PKCS1', $decoded_public_key_data);

leads to

phpseclib3\Exception\RuntimeException: Unable to decode BER

edit: I found out that this public key is not in the correct format, and you have to do:

$public_key_data = str_replace(['-', '_'], ['+', '/'], $public_key_data);

anyway I could not build the request in a way that isolarcloud would accept, so now I am using php to call the python script from above and read the values that way with:

userService/login powerStationService/getPsListNova (to learn the ps_id) powerStationService/getPowerStatistics (this does not distinguish between PV and battery) powerStationService/getPsDetailWithPsType (to get PV specifically)

millesm commented 7 months ago

followed the instructions in the gist part 2 and works perfectly on the Pi.

Big question for me now is how do I directly access GoSungrow from the HA CLI? I have advanced SSH terminal installed but cannot find where it's running from.

Paraphraser commented 7 months ago

It's running inside a docker container. Once you have a terminal session, you can use docker ps to figure out the container ID. Once you have the container ID, you can use the following command to open an interactive shell into the container:

$ docker exec -it «containerID» bash

Once you're inside the container, you can run GoSungrow commands.

RunGoSungrowFromContainer

When you're finished, press control+d to exit (or just type "exit").

Containers are ephemeral. Each time the container is re-created its ID will change.

Plus, anything you do which modifies anything inside the container will almost certainly disappear (it actually depends on whether activity inside the container is mapped to persistent storage outside the container but, in the case of GoSungrow, I think the answer is "no"). This is actually a good thing. If, during your experimentation, you stuff something up and interfere with the normal operation of the container, all you have to do is go back to the HA GUI and stop/start the container.

millesm commented 7 months ago

@Paraphraser thanks heaps - everything makes sense now and I have access to do what I need.

allocater2 commented 7 months ago

Ok, after 20h I finally got a php version to work.

# account config
$login = "xxx";
$pw = "xxx";
$user_id = 123456;
$ps_id = 1234567;

# global config
$public_key_data = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCkecphb6vgsBx4LJknKKes-eyj7-RKQ3fikF5B67EObZ3t4moFZyMGuuJPiadYdaxvRqtxyblIlVM7omAasROtKRhtgKwwRxo2a6878qBhTgUVlsqugpI_7ZC9RmO2Rpmr8WzDeAapGANfHN5bVr7G7GYGwIrjvyxMrAVit_oM4wIDAQAB";
#test key
#$public_key_data = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCSOVbs1WzT2BqRuF3UiL8jtQ9LXMNTZJBmnv113Id3Eizkkrjc+3U1Z06kuP8NB14K8zpX3RJKEBye9N4sE3YeUTcCsp+ORfrW7sQJCt2NGsOKVp3DizjW9zNDPEhfcvdUR1s+CxSwE2nAFr34Lh9g5XTnHTEb56K+8rrD8uTkcQIDAQAB";
$public_key_data = str_replace(['-', '_'], ['+', '/'], $public_key_data);

require_once 'vendor/autoload.php';

error_reporting(E_ALL);

use phpseclib3\Crypt\AES;
use phpseclib3\Crypt\RSA;
use phpseclib3\Crypt\Crypt_RSA;
use phpseclib3\Crypt\Random;
use phpseclib3\Math\BigInteger;
use phpseclib3\File\ASN1;
use phpseclib3\Crypt\PublicKeyLoader;
use phpseclib3\Crypt\Common\Formats\Keys\PKCS1;

if (class_exists('phpseclib3\Crypt\RSA')) {
    echo "RSA class is available.";
} else {
    echo "RSA class is not available.";
}

function encrypt_hex($data_str, $key) {

    #die("ö".AES::MODE_ECB."ö");

    $aes = new AES("ecb");
    $aes->setKey($key);
    $date_byte = $aes->encrypt($data_str);
    return bin2hex($date_byte);
}

function decrypt_hex($data_hex_str, $key) {
    $aes = new AES("ecb");
    $aes->setKey($key);
    $text = $aes->decrypt(hex2bin($data_hex_str));
    return json_decode($text, true);
}

#echo "private key: ";
#$private_key = "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAJI5VuzVbNPYGpG4XdSIvyO1D0tcw1NkkGae/XXch3cSLOSSuNz7dTVnTqS4/w0HXgrzOlfdEkoQHJ703iwTdh5RNwKyn45F+tbuxAkK3Y0aw4pWncOLONb3M0M8SF9y91RHWz4LFLATacAWvfguH2DldOcdMRvnor7yusPy5ORxAgMBAAECgYAHvf16QLqoZNLTUF23eR4Vt+p9ZQX6jmKO7HAjI3AQv+ecmqArIy1LjJK/agQnHnK+Ra6bJFtpjHzXdcOltcoVMD8dtrHQLZkr55YccMeUsLOgRDFLRLyDnRsHsZG8dzoE3voJW79x8T5usCKrhHSjUGDJ7ATgqyW+cmX1dDSNIQJBANff1fY/HIncg4huyqRTKkGBFNcBq5Fz5LfbrLvByrna70HTIxgpn8RjLc8FSGj9+bfustpssBoxrgSk9in+5N0CQQCtZ0K8HdWrfkUt0ewAbyDfbvKids2bpe9TEP/01mc03rYZ06BZs5uLpCkI6Y0pArrDk1BiIvNAgCVt1XuWScqlAkBDUxywkpg86pfe+eaa/xDjovUz5OJ0F3fSW2FwoQyvj/ckSUvdokWggunrcZNWoza5RWlkM5dsY+gIrMXU7RjFAkAOY2kYLumR51JaMPcCOjZiE9SyQmVhKu2m2NxENp4ttuUpU3QUvWCEv8Rf5vE9m+pfXBPpcLj6eyef63zrxYe5AkBk4q9rQWT4BR003qOjnFhFr+LwOjOkauaMLO5s81fwTzK9dPIjUBsmyoeOVXZwCocHNjPj57rC4Gp51kjJfkEB";
#$pkey = PublicKeyLoader::load($private_key);
#echo $pkey;
#print_r($pkey);
#echo $pkey->decrypt(base64_decode($encrypted));

echo "\ncreating cipher object\n";

echo "\nloading key\n";

$key = PublicKeyLoader::load($public_key_data);
$key = $key->withPadding(RSA::ENCRYPTION_PKCS1);

echo "key = $key\n";

# print_r($key);

$cipher = $key;

function encrypt_RSA($data_str, $cipher) {
    #ciphertext = cipher.encrypt(data_str.encode("UTF-8"))
    #return b64encode(ciphertext).decode("UTF-8")
    $utf = utf8_encode($data_str);
    #echo $utf."\n";
    $ciphertext = $cipher->encrypt($utf);
    #echo $ciphertext."\n";
    $b64 = base64_encode($ciphertext);
    #echo $b64."\n";
    $utf8c = utf8_decode($b64);
    #echo $utf8c."\n";
    #exit;
    return $utf8c;
}

function random_word($length) {
    $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
    $random_word = '';
    for ($i = 0; $i < $length; $i++) {
        $random_word .= $characters[rand(0, strlen($characters) - 1)];
        #$random_word .= $characters[$i % 50];
    }
    return $random_word;
}

function get_data($url, $data, $cipher) {
    global $user_id;
    #$data["appkey"] = "3A51762ED80A39AD3DF3DB3CE6767884"; #app
    $data["appkey"] = "B0455FBE7AA0328DB57B59AA729F05D8"; #web
    $data["api_key_param"] = ["timestamp" => round(microtime(true) * 1000),"nonce" => random_word(32),];

    $data_str = json_encode($data);
    $data_str = utf8_encode($data_str);

    $random_key = "web" . random_word(13);
    $data_hex = encrypt_hex($data_str, $random_key);

    $headers = [
        "content-type: text/plain",
        "sys_code: 200",
        "x-access-key: 9grzgbmxdsp3arfmmgq347xjbza4ysps", #web
        # "x-access-key: kme8xdq4fp88wps563qd5d57vw6jxrf4", #app
        "x-limit-obj: ".encrypt_RSA($user_id, $cipher),
        "x-random-secret-key: ".encrypt_RSA($random_key, $cipher),
    ];
    #echo $random_key."\n";
    #echo $random_key."\n";

    #print_r($headers);
    #echo "\n\n";

    #print_r($data);
    #echo "\n\n";

    #print_r($data_str);
    #echo "\n";

    #print_r($data_hex);
    #echo "\n\n";

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_hex);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 

    $response = curl_exec($ch);
    curl_close($ch);

    #print_r(curl_getinfo($ch));

    #die(strlen($random_key));

    #print_r($response);

    #exit; 

    $response = decrypt_hex($response, $random_key);

    #print_r($response);

    return $response;
}

echo "\n\nconnecting....\n\n";

$token = get_data(
    "https://gateway.isolarcloud.eu/v1/userService/login",
    [
        "user_account" => $login,
        "user_password" => $pw,
    ],
    $cipher
)["result_data"]["token"];

echo "login token: $token\n";

/*
get_data(
    "https://gateway.isolarcloud.eu/v1/commonService/queryMutiPointDataList",
    [
        "ps_key" => "XXXXXXX_14_1_2",
        "points" => "p13003",
        "start_time_stamp" => "20231108000000",
        "end_time_stamp" => "20231109000000",
        "token" => $token,
    ],
    $cipher
);

*/
$result = get_data(
    "https://gateway.isolarcloud.eu/v1/powerStationService/getPsDetailWithPsType",
    [
        "token" => $token,
        "ps_id" => $ps_id,
    ],
    $cipher
);

#print_r($result);

print_r($result['result_data']['pv_power_map']);
print_r($result['result_data']['today_energy']);
illuzn commented 7 months ago

Why are you posting off-topic and 3 pages of code here? Use a gist...

For that matter, any body who has (un)intentionally updated their firmware so that neither this nor SunGather works (because Modbus is closed and websocket API is now on port 80) check out https://github.com/liamcottle/sungrow-eyem4-api

Barny6 commented 7 months ago

This stuff is very hard for me to understand. Is it possible to create a simple instruction to overcome the "er_invalid_appkey" topic?

Paraphraser commented 7 months ago

@Barny6 I agree that reading all the posts in this issue can leave you more confused than when you started - a lot of the comments confuse me too.

Everything you need to do to get GoSungrow running again is explained in this gist.

The gist may seem daunting but it isn't. It boils down to you answering one key question:

Are you using the GoSungrow add-on in Home Assistant? Yes or no?

If yes then skip part 1 of the gist and do everything in part 2 of the gist.

If no then doing everything in part of the gist will get you to the point where you have a working binary, after which you are on your own figuring out what to do next (eg put it in your PATH if you are running GoSungrow from the command line; rebuild your container if you are using Docker and a custom Dockerfile).

Barny6 commented 7 months ago

@Paraphraser : thanks for summary. To be honest, too high Level for me. I'm using the add-on in HA operating system.... I think I have to live without the implementation ;-)

baylf2000 commented 6 months ago

I follow the instructions in the gist and was able to get a lot further than initially. It does seem to be able to log in to sungrow, as the logs show some information from the sungrow account, however it eventually stops at "Error: not Authorized" during startup. I'm not sure where the "not authorized" is coming from, as it doesn't say, despite having maximum debug enabled.

Image of the log output is attached. Any help would be appreciated. image

grf692 commented 6 months ago

Hi @baylf2000

I had the same, if I am right it means the mqtt settings (username and/or password) are probably wrong in your GoSungrow configuration.

Do you confirm you have a mqtt broker up and running and "discovered" in HA? Have you set some user+password for it and have you configured them in GoSungrow config?

Cheers, Gaetan

baylf2000 commented 6 months ago

Hi @baylf2000

I had the same, if I am right it means the mqtt settings (username and/or password) are probably wrong in your GoSungrow configuration.

Do you confirm you have a mqtt broker up and running and "discovered" in HA? Have you set some user+password for it and have you configured them in GoSungrow config?

Cheers, Gaetan

Thanks, yes it was a typo in the mqtt details.

However now I'm getting another error ERROR: unknown error 'Repeated request'

One step closer I guess :)

Paraphraser commented 6 months ago

@baylf2000 have you tried explicitly stopping and starting the GoSungrow add-on?

I haven't worked through what happens if the container chucks up an error and the watchdog restarts it but if it is the equivalent of a docker restart then it could be inheriting the same runtime environment as when it was having problems. Stopping and starting will guarantee a fresh container where the only sources of information are those baked into the Docker image plus the settings from HA.

I don't have any great hope this will work - it's just something to try. The only reason I'm suggesting it is because it's about the only thing I can think of where a "repeated request" error might make some kind of sense.

Maybe also take a peek at the YAML view in the config page and make sure it looks sensible (ie the values you see in the YAML are those you expect from what you set in the UI view.

grechi-diego commented 6 months ago

ciao.si riuscirebbe fare un video per i poco esperti?per sistemare error appkey.ci ho provato ma non ho avuto nessun risultato. grazie

Triky101 commented 5 months ago

Hi @baylf2000 I had the same, if I am right it means the mqtt settings (username and/or password) are probably wrong in your GoSungrow configuration. Do you confirm you have a mqtt broker up and running and "discovered" in HA? Have you set some user+password for it and have you configured them in GoSungrow config? Cheers, Gaetan

Thanks, yes it was a typo in the mqtt details.

However now I'm getting another error ERROR: unknown error 'Repeated request'

One step closer I guess :)

Hey, did you get the "Error: unknown error 'Repeated request" problem fixed ?

I had it working but it broke a few weeks ago and now every time I try to fix it / reinstall it etc.. I keep getting this problem

igoratencompass commented 5 months ago

Hi @baylf2000 I had the same, if I am right it means the mqtt settings (username and/or password) are probably wrong in your GoSungrow configuration. Do you confirm you have a mqtt broker up and running and "discovered" in HA? Have you set some user+password for it and have you configured them in GoSungrow config? Cheers, Gaetan

Thanks, yes it was a typo in the mqtt details. However now I'm getting another error ERROR: unknown error 'Repeated request' One step closer I guess :)

Hey, did you get the "Error: unknown error 'Repeated request" problem fixed ?

I had it working but it broke a few weeks ago and now every time I try to fix it / reinstall it etc.. I keep getting this problem

This is not authentication error for sure, you get something like Not Authorised error or similar when MQTT user or password are incorrect. Not sure what it is but I get the same ERROR: unknown error 'Repeated request' both in HA and when running the GoSungrow binary.

It might be related to HA or MQTT plugin version, I'm running Mosquitto broker plugin 6.4.0 with mosquitto version 2.0.18 and my HA version is:

Core             2024.4.3
Supervisor       2024.04.0
Operating System 12.2
Frontend         20240404.2
grechi-diego commented 5 months ago

Non sono ancora riuscito a risolvere il problema.la soluzione al problema esiste,ma è troppo complessa per le mie conoscenze informatiche.aspettero che mickmake realizza un nuovo package Il 20 apr 2024 11:37, igorcatportland @.***> ha scritto:

Hi @baylf2000 I had the same, if I am right it means the mqtt settings (username and/or password) are probably wrong in your GoSungrow configuration. Do you confirm you have a mqtt broker up and running and "discovered" in HA? Have you set some user+password for it and have you configured them in GoSungrow config? Cheers, Gaetan

Thanks, yes it was a typo in the mqtt details. However now I'm getting another error ERROR: unknown error 'Repeated request' One step closer I guess :)

Hey, did you get the "Error: unknown error 'Repeated request" problem fixed ? I had it working but it broke a few weeks ago and now every time I try to fix it / reinstall it etc.. I keep getting this problem

This is not authentication error for sure, you get something like Not Authorised error or similar when MQTT user or password are incorrect. Not sure what it is but I get the same ERROR: unknown error 'Repeated request' both in HA and when running the GoSungrow binary.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

Sn0w3y commented 5 months ago

Hello @all !

use GoSungrow config write --appkey ANDROIDE13EC118BD7892FE7AB5A3F20 and it works ;-)

Greetings :)

grechi-diego commented 5 months ago

Davvero?😄 Se cambio appkey nella configurazione e metto questa riparte tutto?

Il mar 23 apr 2024, 18:59 Hannes @.***> ha scritto:

Hello @ALL https://github.com/ALL !

use GoSungrow config write --appkey ANDROIDE13EC118BD7892FE7AB5A3F20 and it works ;-)

Greetings :)

— Reply to this email directly, view it on GitHub https://github.com/MickMake/GoSungrow/issues/101#issuecomment-2072929491, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO6MNOFSQTSDW7BF42V5CHLY62HNFAVCNFSM6AAAAABAAXZAJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZSHEZDSNBZGE . You are receiving this because you commented.Message ID: @.***>

grechi-diego commented 5 months ago

Funziona davvero 😁😁😁😁 sono felicissimo grazie mille

Il mar 23 apr 2024, 20:12 Diego Grechi @.***> ha scritto:

Davvero?😄 Se cambio appkey nella configurazione e metto questa riparte tutto?

Il mar 23 apr 2024, 18:59 Hannes @.***> ha scritto:

Hello @ALL https://github.com/ALL !

use GoSungrow config write --appkey ANDROIDE13EC118BD7892FE7AB5A3F20 and it works ;-)

Greetings :)

— Reply to this email directly, view it on GitHub https://github.com/MickMake/GoSungrow/issues/101#issuecomment-2072929491, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO6MNOFSQTSDW7BF42V5CHLY62HNFAVCNFSM6AAAAABAAXZAJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZSHEZDSNBZGE . You are receiving this because you commented.Message ID: @.***>

howi303 commented 5 months ago

Hello @ALL !

use GoSungrow config write --appkey ANDROIDE13EC118BD7892FE7AB5A3F20 and it works ;-)

Greetings :)

@Sn0w3y where do I run this?

Sn0w3y commented 5 months ago

Hello @ALL ! use GoSungrow config write --appkey ANDROIDE13EC118BD7892FE7AB5A3F20 and it works ;-) Greetings :)

@Sn0w3y where do I run this?

Read the Instructions...

Paraphraser commented 5 months ago

Look, to be honest, I think recommending:

rather than:

might be bordering on bad advice. Please see the tests below.

If anyone is actually using the ANDROID key in a working system, can you please post additional details. In particular, which gateway you are using? I'm using augateway.isolarcloud.com. That's the only thing I can think of where a different API Key might be needed so it would be useful if we could try to figure that out.

Test using the "ANDROID" key - fails

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[14:00:09] INFO: Setting up GoSungrow config ...
[14:00:10] INFO: Writing GoSungrow config ...
Using config file '/data/.GoSungrow/config.json'
New config:
+-------------------+------------+---------------------------+--------------------------------+-----------------------------------+
|       FLAG        | SHORT FLAG |        ENVIRONMENT        |          DESCRIPTION           |        VALUE (* = DEFAULT)        |
+-------------------+------------+---------------------------+--------------------------------+-----------------------------------+
| --config          |            | GOSUNGROW_CONFIG          | GoSungrow: config file.        | /data/.GoSungrow/config.json      |
| --debug           |            | GOSUNGROW_DEBUG           | GoSungrow: Debug mode.         | true                              |
| --quiet           |            | GOSUNGROW_QUIET           | GoSungrow: Silence all         | false *                           |
|                   |            |                           | messages.                      |                                   |
| --timeout         |            | GOSUNGROW_TIMEOUT         | Web timeout.                   | 1m0s                              |
| --user            | -u         | GOSUNGROW_USER            | SunGrow: api username.         | aabbccddee                        |
| --password        | -p         | GOSUNGROW_PASSWORD        | SunGrow: api password.         | secrets                |
| --appkey          |            | GOSUNGROW_APPKEY          | SunGrow: api application key.  | ANDROIDE13EC118BD7892FE7AB5A3F20  |
| --host            |            | GOSUNGROW_HOST            | SunGrow: Provider API URL.     | https://augateway.isolarcloud.com |
|                   |            |                           |                                | *                                 |
| --token-expiry    |            | GOSUNGROW_TOKEN_EXPIRY    | SunGrow: last login.           | 2024-04-23T15:18:30               |
| --save            | -s         | GOSUNGROW_SAVE            | Save output as a file.         | false *                           |
| --dir             |            | GOSUNGROW_DIR             | Save output base directory.    |  *                                |
| --mqtt-user       |            | GOSUNGROW_MQTT_USER       | HASSIO: mqtt username.         | moi                             |
| --mqtt-password   |            | GOSUNGROW_MQTT_PASSWORD   | HASSIO: mqtt password.         | secrets                           |
| --mqtt-host       |            | GOSUNGROW_MQTT_HOST       | HASSIO: mqtt host.             | core-mosquitto                    |
| --mqtt-port       |            | GOSUNGROW_MQTT_PORT       | HASSIO: mqtt port.             |                              1883 |
| --modbus-user     |            | GOSUNGROW_MODBUS_USER     | Modbus username.               |  *                                |
| --modbus-password |            | GOSUNGROW_MODBUS_PASSWORD | Modbus password.               |  *                                |
| --modbus-host     |            | GOSUNGROW_MODBUS_HOST     | Modbus host.                   |  *                                |
| --modbus-port     |            | GOSUNGROW_MODBUS_PORT     | Modbus port.                   | 502 *                             |
+-------------------+------------+---------------------------+--------------------------------+-----------------------------------+
[14:00:10] INFO: Login to iSolarCloud using gateway https://augateway.isolarcloud.com ...
Error: unknown error 'E914'
Usage:
  GoSungrow api login [flags]

Examples:
    GoSungrow api login  

Flags: Use "GoSungrow help flags" for more info.

Additional help topics:

ERROR: unknown error 'E914'
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Test using the "B0455" key - succeeds

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[14:01:28] INFO: Setting up GoSungrow config ...
[14:01:28] INFO: Writing GoSungrow config ...
Using config file '/data/.GoSungrow/config.json'
New config:
+-------------------+------------+---------------------------+--------------------------------+-----------------------------------+
|       FLAG        | SHORT FLAG |        ENVIRONMENT        |          DESCRIPTION           |        VALUE (* = DEFAULT)        |
+-------------------+------------+---------------------------+--------------------------------+-----------------------------------+
| --config          |            | GOSUNGROW_CONFIG          | GoSungrow: config file.        | /data/.GoSungrow/config.json      |
| --debug           |            | GOSUNGROW_DEBUG           | GoSungrow: Debug mode.         | true                              |
| --quiet           |            | GOSUNGROW_QUIET           | GoSungrow: Silence all         | false *                           |
|                   |            |                           | messages.                      |                                   |
| --timeout         |            | GOSUNGROW_TIMEOUT         | Web timeout.                   | 1m0s                              |
| --user            | -u         | GOSUNGROW_USER            | SunGrow: api username.         | aabbccddee                        |
| --password        | -p         | GOSUNGROW_PASSWORD        | SunGrow: api password.         | secrets                |
| --appkey          |            | GOSUNGROW_APPKEY          | SunGrow: api application key.  | B0455FBE7AA0328DB57B59AA729F05D8  |
| --host            |            | GOSUNGROW_HOST            | SunGrow: Provider API URL.     | https://augateway.isolarcloud.com |
|                   |            |                           |                                | *                                 |
| --token-expiry    |            | GOSUNGROW_TOKEN_EXPIRY    | SunGrow: last login.           | 2024-04-23T15:18:30               |
| --save            | -s         | GOSUNGROW_SAVE            | Save output as a file.         | false *                           |
| --dir             |            | GOSUNGROW_DIR             | Save output base directory.    |  *                                |
| --mqtt-user       |            | GOSUNGROW_MQTT_USER       | HASSIO: mqtt username.         | moi                             |
| --mqtt-password   |            | GOSUNGROW_MQTT_PASSWORD   | HASSIO: mqtt password.         | secrets                           |
| --mqtt-host       |            | GOSUNGROW_MQTT_HOST       | HASSIO: mqtt host.             | core-mosquitto                    |
| --mqtt-port       |            | GOSUNGROW_MQTT_PORT       | HASSIO: mqtt port.             |                              1883 |
| --modbus-user     |            | GOSUNGROW_MODBUS_USER     | Modbus username.               |  *                                |
| --modbus-password |            | GOSUNGROW_MODBUS_PASSWORD | Modbus password.               |  *                                |
| --modbus-host     |            | GOSUNGROW_MODBUS_HOST     | Modbus host.                   |  *                                |
| --modbus-port     |            | GOSUNGROW_MODBUS_PORT     | Modbus port.                   | 502 *                             |
+-------------------+------------+---------------------------+--------------------------------+-----------------------------------+
[14:01:28] INFO: Login to iSolarCloud using gateway https://augateway.isolarcloud.com ...
Email:  someone@domain.com
Create Date:    Thu Feb 09 13:14:55 CST 2023
Login Last Date:    2024-04-30 22:01:28
Login Last IP:  
Login State:    1
User Account:   aabbccddee
User Id:    374058
User Name:  Moi
Is Online:  false
Token:  374058_a4507409d7f24dedaaaa54f53a1f0848
Token File: /data/.GoSungrow/AppService_login.json
Email:  someone@domain.com
Create Date:    Thu Feb 09 13:14:55 CST 2023
Login Last Date:    2024-04-30 22:01:29
Login Last IP:  
Login State:    1
User Account:   aabbccddee
User Id:    374058
User Name:  Moi
Is Online:  false
Token:  374058_f1e86ada8dbf40f7844d2345dc37d410
Token File: /data/.GoSungrow/AppService_login.json
[14:01:29] INFO: Syncing data from gateway https://augateway.isolarcloud.com ...
Email:  someone@domain.com
Create Date:    Thu Feb 09 13:14:55 CST 2023
Login Last Date:    2024-04-30 22:01:29
Login Last IP:  
2024/04/30 14:01:29 INFO: Connecting to MQTT HASSIO Service...
2024/04/30 14:01:29 INFO: Connecting to SunGrow...
Login State:    1
User Account:   aabbccddee
User Id:    374058
User Name:  Moi
Is Online:  false
Token:  374058_f1e86ada8dbf40f7844d2345dc37d410
Token File: /data/.GoSungrow/AppService_login.json
2024/04/30 14:01:29 INFO: Found SunGrow 3 devices
2024/04/30 14:01:29 INFO: Caching Sungrow metadata...
2024/04/30 14:01:29 INFO: Cached 975 Sungrow data points...
2024/04/30 14:01:29 INFO: Syncing 461 entries with HASSIO from queryDeviceList.
CU-CUCU-CUCUCUCUCUCU-CUCU-CU-CUCU----CUCUCU-----CU-CU-CU-CUCU
2024/04/30 14:01:30 INFO: Syncing 148 entries with HASSIO from getPsList.
CUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCU?CUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU
2024/04/30 14:01:30 INFO: Syncing 205 entries with HASSIO from getPsDetail.
2024/04/30 14:01:30 INFO: Starting ticker...
2024/04/30 14:01:30 INFO: Fetch Schedule: 5m
2024/04/30 14:01:30 INFO: Sleep Delay:    40s
CUCU??CUCUCUCUCUCUCUCU?CUCU?CU?CUCUCUCU?CUCUCU?CUCU?CUCU?CUCUCU?CUCU?CUCUCU??CUCUCU?CU?CUCUCU?CUCUCUCUCUCU??CU?CUCUCUCUCUCUCUCUCUCUCU?CUCUCU??CU?CU?CUCU?CUCUCU?CUCUCU?CUCUCUCU???CUCUCUCUCU?CUCUCU?CUCUCUCU?CUCUCUCU?CUCUCUCUCUCUCUCU?CUCUCUCU?CUCUCUCUCU?CU?CU????CUCU?CUCU?CUCUCUCUCUCUCUCUCUCUCU?CUCU??CU??CU?CUCUCU?CUCUCUCUCU??CUCUCUCUCUCUCUCUCUCUCUCU??CUCU
Paraphraser commented 5 months ago

@howi303 - see if this helps (the config write command is used when you run GoSungrow from the command line rather than in Home Assistant).

APIKey

mattiassjogren commented 5 months ago

I got the "unknown error 'Request is not encrypted'" earlier today. I was using the B0455 appkey and switched to the ANDROID appkey and GoSungrow works again! I'm on the gateway.isolarcloud.eu host.

[19:22:10] INFO: Setting up GoSungrow config ...
[19:22:12] INFO: Writing GoSungrow config ...
Using config file '/data/.GoSungrow/config.json'
New config:
+-------------------+------------+---------------------------+--------------------------------+----------------------------------+
|       FLAG        | SHORT FLAG |        ENVIRONMENT        |          DESCRIPTION           |       VALUE (* = DEFAULT)        |
+-------------------+------------+---------------------------+--------------------------------+----------------------------------+
| --config          |            | GOSUNGROW_CONFIG          | GoSungrow: config file.        | /data/.GoSungrow/config.json     |
| --debug           |            | GOSUNGROW_DEBUG           | GoSungrow: Debug mode.         | false *                          |
| --quiet           |            | GOSUNGROW_QUIET           | GoSungrow: Silence all         | false *                          |
|                   |            |                           | messages.                      |                                  |
| --timeout         |            | GOSUNGROW_TIMEOUT         | Web timeout.                   | 1m0s                             |
| --user            | -u         | GOSUNGROW_USER            | SunGrow: api username.         | XXXXXXX                          |
| --password        | -p         | GOSUNGROW_PASSWORD        | SunGrow: api password.         | XXXXXXX                          |
| --appkey          |            | GOSUNGROW_APPKEY          | SunGrow: api application key.  | ANDROIDE13EC118BD7892FE7AB5A3F20 |
| --host            |            | GOSUNGROW_HOST            | SunGrow: Provider API URL.     | https://gateway.isolarcloud.eu   |
| --token-expiry    |            | GOSUNGROW_TOKEN_EXPIRY    | SunGrow: last login.           | 2024-04-13T04:23:09              |
| --save            | -s         | GOSUNGROW_SAVE            | Save output as a file.         | false *                          |
| --dir             |            | GOSUNGROW_DIR             | Save output base directory.    |  *                               |
| --mqtt-user       |            | GOSUNGROW_MQTT_USER       | HASSIO: mqtt username.         | XXXXXXX                          |
| --mqtt-password   |            | GOSUNGROW_MQTT_PASSWORD   | HASSIO: mqtt password.         | XXXXXXX                          |
| --mqtt-host       |            | GOSUNGROW_MQTT_HOST       | HASSIO: mqtt host.             | core-mosquitto                   |
| --mqtt-port       |            | GOSUNGROW_MQTT_PORT       | HASSIO: mqtt port.             |                             1883 |
| --modbus-user     |            | GOSUNGROW_MODBUS_USER     | Modbus username.               |  *                               |
| --modbus-password |            | GOSUNGROW_MODBUS_PASSWORD | Modbus password.               |  *                               |
| --modbus-host     |            | GOSUNGROW_MODBUS_HOST     | Modbus host.                   |  *                               |
| --modbus-port     |            | GOSUNGROW_MODBUS_PORT     | Modbus port.                   | 502 *                            |
+-------------------+------------+---------------------------+--------------------------------+----------------------------------+
[19:22:12] INFO: Login to iSolarCloud using gateway https://gateway.isolarcloud.eu ...
Email:  XXXXXXX.XXXXXXXX@XXXXX.XXX
Create Date:    Tue Nov 07 18:08:40 CST 2023
Login Last Date:    2024-05-01 03:22:13
Login Last IP:  
Login State:    1
User Account:   XXXXXXX
User Id:    XXXXXX
User Name:  XXXXX
Is Online:  false
Token:  359009_9bXXXXXXXXXXXXXXXXXXXXXXX
Token File: /data/.GoSungrow/AppService_login.json
[19:22:13] INFO: Syncing data from gateway https://gateway.isolarcloud.eu ...
2024/04/30 19:22:13 INFO: Connecting to MQTT HASSIO Service...
2024/04/30 19:22:13 INFO: Connecting to SunGrow...
2024/04/30 19:22:13 INFO: Found SunGrow 2 devices
2024/04/30 19:22:13 INFO: Caching Sungrow metadata...
2024/04/30 19:22:14 INFO: Cached 841 Sungrow data points...
2024/04/30 19:22:15 INFO: Syncing 164 entries with HASSIO from queryDeviceList.
CUCUCUCUCUCU-CUCU-CU--CU-
2024/04/30 19:22:15 INFO: Syncing 155 entries with HASSIO from getPsList.
2024/04/30 19:22:15 INFO: Syncing 212 entries with HASSIO from getPsDetail.
CU?CUCUCUCUCU???CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU
CU?CUCU??CUCUCUCUCU?CUCUCUCUCU?CU?CUCUCUCUCU?CUCUCUCU?CUCU?CUCUCUCU?CUCUCUCUCU?????CUCU??CU?CUCU?CU???CUCUCUCUCUCU????CUCUCU???CUCUCUCU?CUCUCUCU??CUCUCUCUCUCU?CUCUCUCU?CUCUCUCUCUCUCUCU?CU?CUCUCUCUCU?CU?CU?CU??CU???CUCU?CUCU???CUCUCUCUCUCU?CUCU???CU?CUCUCUCU?CUCUCU?CU?CUCUCUCUCUCUCU??CUCUCU?CU?CUCU?CUCUCUCU?CUCUCU???CUCUCU?CU??CUCUCUCUCUCUCUCUCUCU?CU??
2024/04/30 19:22:15 INFO: Starting ticker...
2024/04/30 19:22:15 INFO: Fetch Schedule: 5m
2024/04/30 19:22:15 INFO: Sleep Delay:    40s
grechi-diego commented 5 months ago

Ciao..si funziona anche a mé e sono contento però non ti vede tutti i sensori.quando inserisco le card di lovelace sono incomplete.anche a tè?Il 30 apr 2024 21:37, mattiassjogren @.> ha scritto: I got the "unknown error 'Request is not encrypted'" earlier today. I was using the B0455 appkey and switched to the ANDROID appkey and GoSungrow works again! I'm on the gateway.isolarcloud.eu host. [19:22:10] INFO: Setting up GoSungrow config ... [19:22:12] INFO: Writing GoSungrow config ... Using config file '/data/.GoSungrow/config.json' New config: +-------------------+------------+---------------------------+--------------------------------+----------------------------------+ | FLAG | SHORT FLAG | ENVIRONMENT | DESCRIPTION | VALUE ( = DEFAULT) | +-------------------+------------+---------------------------+--------------------------------+----------------------------------+ | --config | | GOSUNGROW_CONFIG | GoSungrow: config file. | /data/.GoSungrow/config.json | | --debug | | GOSUNGROW_DEBUG | GoSungrow: Debug mode. | false | | --quiet | | GOSUNGROW_QUIET | GoSungrow: Silence all | false | | | | | messages. | | | --timeout | | GOSUNGROW_TIMEOUT | Web timeout. | 1m0s | | --user | -u | GOSUNGROW_USER | SunGrow: api username. | XXXXXXX | | --password | -p | GOSUNGROW_PASSWORD | SunGrow: api password. | XXXXXXX | | --appkey | | GOSUNGROW_APPKEY | SunGrow: api application key. | ANDROIDE13EC118BD7892FE7AB5A3F20 | | --host | | GOSUNGROW_HOST | SunGrow: Provider API URL. | https://gateway.isolarcloud.eu | | --token-expiry | | GOSUNGROW_TOKEN_EXPIRY | SunGrow: last login. | 2024-04-13T04:23:09 | | --save | -s | GOSUNGROW_SAVE | Save output as a file. | false | | --dir | | GOSUNGROW_DIR | Save output base directory. | | | --mqtt-user | | GOSUNGROW_MQTT_USER | HASSIO: mqtt username. | XXXXXXX | | --mqtt-password | | GOSUNGROW_MQTT_PASSWORD | HASSIO: mqtt password. | XXXXXXX | | --mqtt-host | | GOSUNGROW_MQTT_HOST | HASSIO: mqtt host. | core-mosquitto | | --mqtt-port | | GOSUNGROW_MQTT_PORT | HASSIO: mqtt port. | 1883 | | --modbus-user | | GOSUNGROW_MODBUS_USER | Modbus username. | | | --modbus-password | | GOSUNGROW_MODBUS_PASSWORD | Modbus password. | | | --modbus-host | | GOSUNGROW_MODBUS_HOST | Modbus host. | | | --modbus-port | | GOSUNGROW_MODBUS_PORT | Modbus port. | 502 | +-------------------+------------+---------------------------+--------------------------------+----------------------------------+ [19:22:12] INFO: Login to iSolarCloud using gateway https://gateway.isolarcloud.eu ... Email: **@.*** Create Date: Tue Nov 07 18:08:40 CST 2023 Login Last Date: 2024-05-01 03:22:13 Login Last IP:
Login State: 1 User Account: XXXXXXX User Id: XXXXXX User Name: XXXXX Is Online: false Token: 359009_9bXXXXXXXXXXXXXXXXXXXXXXX Token File: /data/.GoSungrow/AppService_login.json [19:22:13] INFO: Syncing data from gateway https://gateway.isolarcloud.eu ... 2024/04/30 19:22:13 INFO: Connecting to MQTT HASSIO Service... 2024/04/30 19:22:13 INFO: Connecting to SunGrow... 2024/04/30 19:22:13 INFO: Found SunGrow 2 devices 2024/04/30 19:22:13 INFO: Caching Sungrow metadata... 2024/04/30 19:22:14 INFO: Cached 841 Sungrow data points... 2024/04/30 19:22:15 INFO: Syncing 164 entries with HASSIO from queryDeviceList. CUCUCUCUCUCU-CUCU-CU--CU- 2024/04/30 19:22:15 INFO: Syncing 155 entries with HASSIO from getPsList. 2024/04/30 19:22:15 INFO: Syncing 212 entries with HASSIO from getPsDetail. CU?CUCUCUCUCU???CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU CU?CUCU??CUCUCUCUCU?CUCUCUCUCU?CU?CUCUCUCUCU?CUCUCUCU?CUCU?CUCUCUCU?CUCUCUCUCU?????CUCU??CU?CUCU?CU???CUCUCUCUCUCU????CUCUCU???CUCUCUCU?CUCUCUCU??CUCUCUCUCUCU?CUCUCUCU?CUCUCUCUCUCUCUCU?CU?CUCUCUCUCU?CU?CU?CU??CU???CUCU?CUCU???CUCUCUCUCUCU?CUCU???CU?CUCUCUCU?CUCUCU?CU?CUCUCUCUCUCUCU??CUCUCU?CU?CUCU?CUCUCUCU?CUCUCU???CUCUCU?CU??CUCUCUCUCUCUCUCUCUCU?CU?? 2024/04/30 19:22:15 INFO: Starting ticker... 2024/04/30 19:22:15 INFO: Fetch Schedule: 5m 2024/04/30 19:22:15 INFO: Sleep Delay: 40s

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

Sn0w3y commented 5 months ago

I got the "unknown error 'Request is not encrypted'" earlier today. I was using the B0455 appkey and switched to the ANDROID appkey and GoSungrow works again! I'm on the gateway.isolarcloud.eu host.

[19:22:10] INFO: Setting up GoSungrow config ...
[19:22:12] INFO: Writing GoSungrow config ...
Using config file '/data/.GoSungrow/config.json'
New config:
+-------------------+------------+---------------------------+--------------------------------+----------------------------------+
|       FLAG        | SHORT FLAG |        ENVIRONMENT        |          DESCRIPTION           |       VALUE (* = DEFAULT)        |
+-------------------+------------+---------------------------+--------------------------------+----------------------------------+
| --config          |            | GOSUNGROW_CONFIG          | GoSungrow: config file.        | /data/.GoSungrow/config.json     |
| --debug           |            | GOSUNGROW_DEBUG           | GoSungrow: Debug mode.         | false *                          |
| --quiet           |            | GOSUNGROW_QUIET           | GoSungrow: Silence all         | false *                          |
|                   |            |                           | messages.                      |                                  |
| --timeout         |            | GOSUNGROW_TIMEOUT         | Web timeout.                   | 1m0s                             |
| --user            | -u         | GOSUNGROW_USER            | SunGrow: api username.         | XXXXXXX                          |
| --password        | -p         | GOSUNGROW_PASSWORD        | SunGrow: api password.         | XXXXXXX                          |
| --appkey          |            | GOSUNGROW_APPKEY          | SunGrow: api application key.  | ANDROIDE13EC118BD7892FE7AB5A3F20 |
| --host            |            | GOSUNGROW_HOST            | SunGrow: Provider API URL.     | https://gateway.isolarcloud.eu   |
| --token-expiry    |            | GOSUNGROW_TOKEN_EXPIRY    | SunGrow: last login.           | 2024-04-13T04:23:09              |
| --save            | -s         | GOSUNGROW_SAVE            | Save output as a file.         | false *                          |
| --dir             |            | GOSUNGROW_DIR             | Save output base directory.    |  *                               |
| --mqtt-user       |            | GOSUNGROW_MQTT_USER       | HASSIO: mqtt username.         | XXXXXXX                          |
| --mqtt-password   |            | GOSUNGROW_MQTT_PASSWORD   | HASSIO: mqtt password.         | XXXXXXX                          |
| --mqtt-host       |            | GOSUNGROW_MQTT_HOST       | HASSIO: mqtt host.             | core-mosquitto                   |
| --mqtt-port       |            | GOSUNGROW_MQTT_PORT       | HASSIO: mqtt port.             |                             1883 |
| --modbus-user     |            | GOSUNGROW_MODBUS_USER     | Modbus username.               |  *                               |
| --modbus-password |            | GOSUNGROW_MODBUS_PASSWORD | Modbus password.               |  *                               |
| --modbus-host     |            | GOSUNGROW_MODBUS_HOST     | Modbus host.                   |  *                               |
| --modbus-port     |            | GOSUNGROW_MODBUS_PORT     | Modbus port.                   | 502 *                            |
+-------------------+------------+---------------------------+--------------------------------+----------------------------------+
[19:22:12] INFO: Login to iSolarCloud using gateway https://gateway.isolarcloud.eu ...
Email:    XXXXXXX.XXXXXXXX@XXXXX.XXX
Create Date:  Tue Nov 07 18:08:40 CST 2023
Login Last Date:  2024-05-01 03:22:13
Login Last IP:    
Login State:  1
User Account: XXXXXXX
User Id:  XXXXXX
User Name:    XXXXX
Is Online:    false
Token:    359009_9bXXXXXXXXXXXXXXXXXXXXXXX
Token File:   /data/.GoSungrow/AppService_login.json
[19:22:13] INFO: Syncing data from gateway https://gateway.isolarcloud.eu ...
2024/04/30 19:22:13 INFO: Connecting to MQTT HASSIO Service...
2024/04/30 19:22:13 INFO: Connecting to SunGrow...
2024/04/30 19:22:13 INFO: Found SunGrow 2 devices
2024/04/30 19:22:13 INFO: Caching Sungrow metadata...
2024/04/30 19:22:14 INFO: Cached 841 Sungrow data points...
2024/04/30 19:22:15 INFO: Syncing 164 entries with HASSIO from queryDeviceList.
CUCUCUCUCUCU-CUCU-CU--CU-
2024/04/30 19:22:15 INFO: Syncing 155 entries with HASSIO from getPsList.
2024/04/30 19:22:15 INFO: Syncing 212 entries with HASSIO from getPsDetail.
CU?CUCUCUCUCU???CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCU?CUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU
CU?CUCU??CUCUCUCUCU?CUCUCUCUCU?CU?CUCUCUCUCU?CUCUCUCU?CUCU?CUCUCUCU?CUCUCUCUCU?????CUCU??CU?CUCU?CU???CUCUCUCUCUCU????CUCUCU???CUCUCUCU?CUCUCUCU??CUCUCUCUCUCU?CUCUCUCU?CUCUCUCUCUCUCUCU?CU?CUCUCUCUCU?CU?CU?CU??CU???CUCU?CUCU???CUCUCUCUCUCU?CUCU???CU?CUCUCUCU?CUCUCU?CU?CUCUCUCUCUCUCU??CUCUCU?CU?CUCU?CUCUCUCU?CUCUCU???CUCUCU?CU??CUCUCUCUCUCUCUCUCUCU?CU??
2024/04/30 19:22:15 INFO: Starting ticker...
2024/04/30 19:22:15 INFO: Fetch Schedule: 5m
2024/04/30 19:22:15 INFO: Sleep Delay:    40s

sure it works :P i do not know why nobody believes me :D i also have been on eu

Paraphraser commented 5 months ago

@Sn0w3y I think it's less a question of (dis)believing what you say vs trying the ANDROID key and finding that it doesn't work in your own situation whereas the B0455 key does (touch wood).

Still, thanks to all the responses, the hypothesis that the actual value of the APPKEY might be tied to the iSolarCloud server seems to be gaining traction. I have updated the gist to consolidate everything about iSolarCloud host URLs and APPKEYs, as well as instructions for the three main use-cases (the HA add-on, the standalone binary, and manual editing of a JSON file). The new material is here.

Now, if anyone has anything to add/challenge/critique and, in particular, knows of different iSolarCloud servers and/or APPKeys then please mention it, either by adding to this issue or by making a comment on the gist.

mark-bloom commented 5 months ago

I got the "unknown error 'Request is not encrypted'" earlier today. I was using the B0455 appkey and switched to the ANDROID appkey and GoSungrow works again! I'm on the gateway.isolarcloud.eu host.

Same situation here (except on the https://augateway.isolarcloud.com host). I use the HA add-on, and it was running fine after installing via Paraphraser's patching instructions a few couple months back, no indication in the logs about what sparked the 'Request is not encrypted' to return. Changing to the Android key immediately started working.

Shaydengy commented 5 months ago

I got the "unknown error 'Request is not encrypted'" earlier today. I was using the B0455 appkey and switched to the ANDROID appkey and GoSungrow works again! I'm on the gateway.isolarcloud.eu host.

Same situation here (except on the https://augateway.isolarcloud.com host). I use the HA add-on, and it was running fine after installing via Paraphraser's patching instructions a few couple months back, no indication in the logs about what sparked the 'Request is not encrypted' to return. Changing to the Android key immediately started working.

I have had the exact same experience - augateway, B0455 used to work, and it stopped working a few days ago and was fixed by android key just this morning.

Paraphraser commented 5 months ago

@Shaydengy so, do you recall doing anything between "when the B0445 key worked" and "when you had to switch to the ANDROID key that might explain this? I'm thinking things like "used to use iOS, just switched to an Android tablet", or "I logged into the web version of iSolarCloud" or anything else that might constitute a trigger event that could conceivably have caused the "cloud" side of things to decide to upgrade you to a new key?

Shaydengy commented 5 months ago

I can't say with confidence sorry. I'm completely new to HA and having been setting it all up over the last week, so have lost track of events, as you could imagine.

However, I've looked through the sensor historicals - it looks like my gosungrow sensors stopped working at 3:04:22am 30 April. I wouldn't have made any edits after 10pm the night prior, so it doesn't seem to be from anything I've done. Let me know if there's anything further you'd like me to check.

alexandrechoske commented 3 months ago

Here the ANDROID app_key shows another error:

ERROR: Appkey: empty string

When using any other:

ERROR: appkey is incorrect 'er_invalid_appkey'

Paraphraser commented 3 months ago

A bit more context might help but, for now, on the assumption you are using Home Assistant, please review gist part 2 and double check that you followed all the steps, including the steps at configuration.

The first error sounds like you didn't have an appkey at all. The second one is either not following all the steps in part 2 or perhaps not trying both appkeys in the configuration section. I'm using the B0455 key while others report needing the ANDROID key. There doesn't seem to be a rule you can follow about which appkey to use so it's wise to try both. But whichever server+appkey combination you need, none of it will work if you haven't followed part 2 correctly.