Open jvinkovic opened 5 months ago
A little more information would be nice. Are the environment variables set correctly?
Yes. They are correct.
What else is in the log?
Nothing
On Fri, 2 Feb 2024, 15:40 z-master42, @.***> wrote:
What else is in the log?
— Reply to this email directly, view it on GitHub https://github.com/reinhard-brandstaedter/solarflow-statuspage/issues/40#issuecomment-1924020462, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKOFCD6ISJZM3JF7C3WM3DYRT3HVAVCNFSM6AAAAABCCVLOQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRUGAZDANBWGI . You are receiving this because you authored the thread.Message ID: @.*** com>
Ok, that's not really helpful.
Same Issue here. Changed my SolarFlow to "Germany" as Region These env-Configs do not work:
ZEN_MQTT = mqtt.zen-iot.com
ZEN_API = https://app.zendure.tech
or
ZEN_MQTT = mqtt.zen-iot.com
ZEN_API = https://app.zendure.tech/eu
or
ZEN_MQTT = mqtteu.zen-iot.com
ZEN_API = https://app.zendure.tech
Also not providing both ENV-Variables do not work.
Logs:
solarflow-statuspage | 2024-02-04 12:02:18,767:INFO: Authenticating with Zendure ...
solarflow-statuspage | 2024-02-04 12:02:20,341:INFO: Getting device list ...
solarflow-statuspage | 2024-02-04 12:02:20,888:INFO: []
solarflow-statuspage | 2024-02-04 12:02:20,889:ERROR: Connecting to Zendure's MQTT broker failed!
solarflow-statuspage | Traceback (most recent call last):
solarflow-statuspage | File "//solarflow-status.py", line 295, in zendure_mqtt_background_task
solarflow-statuspage | auth = get_auth()
solarflow-statuspage | File "//solarflow-status.py", line 288, in get_auth
solarflow-statuspage | log.info(f'Zendure Auth: {auth}')
solarflow-statuspage | NameError: name 'auth' is not defined`
Have you re-registered your SolarFlow on the EU server using the curl command?
Hi! Yes, I think:
curl -i -v --json "{'snNumber': 'XXXX', 'account': 'XXXX'}" https://app.zendure.tech/eu/developer/api/apply
<__Removed__>
<
{"code":200,"success":true,"data":{"appKey":"XXXX","secret":"XXXX","mqttUrl":"mqtt.zen-iot.com","port":1883},"msg":"Successful operation"}* Connection #0 to host app.zendure.tech left intact```
Does it work if you use the two URLs? The one from your curl command and the one from the answer?
You mean like this:
ZEN_MQTT = mqtt.zen-iot.com
ZEN_API = https://app.zendure.tech/eu/developer/api/apply
Nope. Other ways, I showed at my first comment.
How do you use it with EU-Server?
I didn't switch because I didn't want to lose the statistics in the app.
I have now played around with ZEN_MQTT and ZEN_API. I can specify whatever I want. The EU server, the global server or just a jumble of letters. It always works. Apparently it always falls back to the fallback, which is the global server.
Have you tried changing that directly in the config.ini and loading it into the container?
Okay, I switched to global server and it works again. I'm not good in Python, but I think, it tries to append "v2" to both API-URLS, but the EU Url does'nt have "v2". Reference Line 21 and Line 28: https://github.com/reinhard-brandstaedter/solarflow-statuspage/blob/740bace043e309f8d7a9e0007c86aecefb38890b/src/zenapi/ZendureAPI.py#L20-L28
But Global and Europe URL are the following:
Global: https://app.zendure.tech/v2/developer/api/apply
Europe: https://app.zendure.tech/eu/developer/api/apply
Looks like easiest would be just to use complete url in config and clean up the script.
@jvinkovic you wanna create a pull request for that change suggestion? Happy to take this into consideration, for the next merge given that Zendure is handling URLs so badly.
Sure, I'll try to make it these days hopefully (quite busy). Will try to make it backward compatible.
I have a new hub and wanted to use it today with the status page, but now I get the same error as in this issue here. I haven't changed anything on my container or in the app.
Log:
2024-04-19 16:59:29,265:ERROR: No configuration file (config.ini) found in execution directory! Using environment variables.
2024-04-19 16:59:29,479:INFO: Authenticating with Zendure ...
2024-04-19 16:59:29,489:DEBUG: Starting new HTTPS connection (1): app.zendure.tech:443
2024-04-19 16:59:31,106:DEBUG: https://app.zendure.tech:443 "POST /v2/auth/app/token HTTP/1.1" 200 None
2024-04-19 16:59:31,108:INFO: Getting device list ...
2024-04-19 16:59:31,794:DEBUG: https://app.zendure.tech:443 "POST /v2/productModule/device/queryDeviceListByConsumerId HTTP/1.1" 200 None
2024-04-19 16:59:31,798:INFO: []
2024-04-19 16:59:31,812:ERROR: Connecting to Zendure's MQTT broker failed!
Traceback (most recent call last):
File "//solarflow-status.py", line 295, in zendure_mqtt_background_task
auth = get_auth()
File "//solarflow-status.py", line 288, in get_auth
log.info(f'Zendure Auth: {auth}')
NameError: name 'auth' is not defined
Update: Found the error. New hub means new device sharing for the second account. Oh boy.
I can also not connect:
docker run --rm --env-file .env -p 127.0.0.1:5000:5000 --name solarflow-statuspage rbrandstaedter/solarflow-statuspage:master --online 2024-06-07 06:47:28,357:ERROR: No configuration file (config.ini) found in execution directory! Using environment variables. 2024-06-07 06:47:28,392:INFO: Authenticating with Zendure ... 2024-06-07 06:47:31,634:INFO: Getting device list ... 2024-06-07 06:47:32,793:INFO: [] 2024-06-07 06:47:32,795:ERROR: Connecting to Zendure's MQTT broker failed! Traceback (most recent call last): File "//solarflow-status.py", line 295, in zendure_mqtt_background_task auth = get_auth() File "//solarflow-status.py", line 288, in get_auth log.info(f'Zendure Auth: {auth}') NameError: name 'auth' is not defined
curl -i -v --json "{'snNumber': 'H**', 'account': 'j***@gmx.at'}" https://app.zendure.tech/eu/developer/api/apply
{"code":200,"success":true,"data":{"appKey":"2**","secret":"8*****","mqttUrl":"mqtt.zen-iot.com","port":1883},"msg":"Successful operation"}* Connection #0 to host app.zendure.tech left intact
my .env-file
ZEN_USER=z* ZEN_PASSWD=Z MQTT_HOST=mqtt.zen-iot.com MQTT_PORT=1883 MQTT_USER=2 MQTT_PWD=8***** PROD_NAME=SolarFlow Hub 2000
can you pls give me a hint?
You are on the EU server. The status page only works as it is here with the global server.
You would have to adapt the code manually yourself.
Aha,
where (in the Dockerfile) an how (what I have to change)?
@switch to global: means to delete the mobile-app and register once more?
I have tried it several times with different options ( eu vs global, englisch/ deutsch = Austria/Österreich , different Email-adresses) because of I didn’t receive a verification-code.
Only as I created a new email-account ( @. @.> [ joe_fuchs.gmx.at and @. @.> seem not to work because of then missing point] ) I got the verification-code by mail.
So I cannot say if I at least used eu or global.
Is there a possibilty to check this afterwards?
PS
Die Kommunikation auf Deutsch wäre mir lieber!
Von: z-master42 @.> Gesendet: Freitag, 7. Juni 2024 11:39 An: reinhard-brandstaedter/solarflow-statuspage @.> Cc: joe63 @.>; Comment @.> Betreff: Re: [reinhard-brandstaedter/solarflow-statuspage] Cannot connect (Issue #40)
Which server (region) are you on in the Zendure app?
— Reply to this email directly, view it on GitHub https://github.com/reinhard-brandstaedter/solarflow-statuspage/issues/40#issuecomment-2154474218 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSAN2DQI2SZGZCHCDEVBOLZGF5SLAVCNFSM6AAAAABCCVLOQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJUGQ3TIMRRHA . You are receiving this because you commented. https://github.com/notifications/beacon/ABSAN2BXSYFAQ3T7LAQA4SLZGF5SLA5CNFSM6AAAAABCCVLOQKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUANKVOU.gif Message ID: @. @.> >
Wenn ich nichts übersehen habe muss nur in der ZendureAPI.py v2 auf eu geändert werden. Sicherheitshalber ist das in den anderen .py auch noch gegen zu checken.
Wechsel auf global heißt Gerät aus der App löschen, Region in der App ändern, Gerät neu hinzufügen.
Dann über curl Gerät neu am globalen Server (v2) registrieren.
Hinweis: Beim wechsel der Region in der App verbleibt die bisherige Statistik in der App auf dem "alten Server", ist danach also nicht mehr einsehbar.
Danke der Connect funktioniert jetzt! Ich habe die Region gewechselt!
@Additionally the statuspage can push the data it reads from Zendure's cloud service to a local MQTT broker wie funktioniert das?
Da wo du in deiner env-Datei den Zendure-Broker angegeben hast kommt eigentlich wenn dann dein lokaler Broker rein, wenn du einen hast. Die "Statuspage" stellt die einzelnen Hubwerte dann über das Topic solarflow-hub bereit.
ZEN_USER=z* ZEN_PASSWD=Z MQTT_HOST=mqtt.zen-iot.com MQTT_PORT=1883 MQTT_USER=2 MQTT_PWD=8***** PROD_NAME=SolarFlow Hub 2000
Ich sehe gerade, EU-Server wird bald auch gehen, nur muss dies explizit über ZEN_API mitgeteilt werden. Hat @jvinkovic vor zwei Tagen erst gepushed. Den Stand hatte ich noch nicht.
@mdillmann https://github.com/reinhard-brandstaedter/solarflow-statuspage/blob/master/README.md?plain=1#L39 hier ist ein ` zuviel.
Ich sehe gerade, EU-Server geht mittlerweile auch, nur muss dies explizit über ZEN_API mitgeteilt werden. Hat @jvinkovic vor zwei Tagen erst gepushed. Den Stand hatte ich noch nicht.
@mdillmann https://github.com/reinhard-brandstaedter/solarflow-statuspage/blob/master/README.md?plain=1#L39 hier ist ein ` zuviel.
Wenn man diese Änderung um File durchführt, muss man dann den Container lokal erzeugen??
Da wo du in deiner env-Datei den Zendure-Broker angegeben hast kommt eigentlich wenn dann dein lokaler Broker rein, wenn du einen hast. Die "Statuspage" stellt die einzelnen Hubwerte dann über das Topic solarflow-hub bereit.
Danke, so ist es sehr gut um es weiterzuverarbeiten.
Ein letztes noch für heute:
Welche Werte sollten hier drin stehen?
Ich sehe gerade, EU-Server geht mittlerweile auch, nur muss dies explizit über ZEN_API mitgeteilt werden. Hat @jvinkovic vor zwei Tagen erst gepushed. Den Stand hatte ich noch nicht.
@mdillmann https://github.com/reinhard-brandstaedter/solarflow-statuspage/blob/master/README.md?plain=1#L39 hier ist ein ` zuviel.
Wenn man diese Änderung um File durchführt, muss man dann den Container lokal erzeugen??
Ja, solange es noch nicht im master-Branch ist.
Da wo du in deiner env-Datei den Zendure-Broker angegeben hast kommt eigentlich wenn dann dein lokaler Broker rein, wenn du einen hast. Die "Statuspage" stellt die einzelnen Hubwerte dann über das Topic solarflow-hub bereit.
Danke, so ist es sehr gut um es weiterzuverarbeiten.
Ein letztes noch für heute:
Welche Werte sollten hier drin stehen?
Der aktuelle Verbrauch deines Stromzählers, wenn dieser Wert per MQTT mitgeteilt werden sollte.
Ich sehe gerade, EU-Server wird bald auch gehen, nur muss dies explizit über ZEN_API mitgeteilt werden. Hat @jvinkovic vor zwei Tagen erst gepushed. Den Stand hatte ich noch nicht.
@mdillmann https://github.com/reinhard-brandstaedter/solarflow-statuspage/blob/master/README.md?plain=1#L39 hier ist ein ` zuviel.
Thanks, I created a PR to correct that typo (VS-Code is sometimes over-enthusiastic ...)
@Der aktuelle Verbrauch deines Stromzählers, wenn dieser Wert per MQTT mitgeteilt werden sollte.
über diesen Weg?
you can already today publish to the topic iot/73bkTV/
wird das irgendwo näher beschrieben, wie z.B.: diese Property für den Verbrauch heißen muss damit die Werte dann in diesem Feld angezeigt werden?
@der aktuelle Verbrauch deines Stromzählers, wenn dieser Wert per MQTT mitgeteilt werden sollte.
über diesen Weg? you can already today publish to the topic iot/73bkTV//properties/write and the statuspage will forward it to to the Zendure MQTT to set properties of the hub.
wird das irgendwo näher beschrieben, wie z.B.: diese Property für den Verbrauch heißen muss damit die Werte dann in diesem Feld angezeigt werden?
Nein, damit kannst du den SolarFlow Hub regeln.
Um deinen aktuellen Bezug in Watt in der Statuspage anzuzeigen musst du diese als reinen Zahlenwert unter dem Topic solarflow-hub/control/homeUsage
veröffentlichen.
danke funktioniert!
Ich habe mal eine Frage. Ich habe mein HUB2000 freigegeben. Wenn ich das Ding aber registrieren will geht das nur mit dem Haupt-Account welchen ich auf meinem Handy nutze. Gebe ich das Gerät für einen anderen Account frei und nehme dort die Freigabe an sehe ich nur folgenden Fehler.
{"code":400,"success":false,"data":{},"msg":"Please bind the device first"}
Okay its working now when i use the jason on the account which is initially connected with the HUB. Its not working with shared devices. This really isnt that nice as i want to use the main account on my phone but when i relogin on my phone and restart the docker container i get a login failed again.
Everytime you log in to the Zendure API (with your user/email) a new authentication token is generated for their MQTT server (which is where all the data for the App/statuspage is coming from). So you can't use the statuspage and the app in parallel. The idea is to use the statuspage for offline hubs and/or do the controlling og the hub via sf-control and Homeassistant integration (or any other HA system via the local MQTT).
Use your main account to bind and the secondary account to connect via the status page. Works for me too.