PV Anlage per HTTPMOD abfragen (solarmanpv.com)

Begonnen von Helmi55, 09 November 2021, 18:30:32

Vorheriges Thema - Nächstes Thema

Helmi55

Guten Abend
ich versuche nun schon seit einiger Zeit die Daten meines Balkonkraftwerkes auszulesen.
anscheinend scheitere ich am Login? Wenn ich mit Burp (soweit ich das verstehe) den Datenverkehr mitlese gibts da beim  GET Authorization Bearer einen Access token?
Wie kann ich den mitschicken, bzw. muss ich den senden.
Beim ,,normalen" Login wird nur email Adresse und Pw verlangt
Das gebe ich ja mit sid01 mit und mit sidURL gehe ich auf die Login Seite....
Anbei ein List von PV

Internals:
   BUSY       0
   CFGFN     
   DEF        https://home.solarmanpv.com/maintain-s/operating/station/information/1194128 30
   FUUID      618a5dac-f33f-ee2d-eb9c-4df05424d5ebc07d
   Interval   30
   LastAuthTry 2021-11-09 17:47:24
   MainURL    https://home.solarmanpv.com/maintain-s/operating/station/information/1194128
   ModuleVersion 4.1.10 - 6.7.2021
   NAME       PV
   NOTIFYDEV  global
   NR         2289
   NTFY_ORDER 50-PV
   STATE      ???
   TYPE       HTTPMOD
   value     
   CompiledRegexes:
   HttpUtils:
     NAME       
     addr       https://home.solarmanpv.com:443
     auth       0
     code       401
     compress   1
     conn       
     data       
     displayurl https://home.solarmanpv.com/maintain-s/operating/station/information/1194128
     header     
     host       home.solarmanpv.com
     httpheader HTTP/1.1 401 Unauthorized
Server: Tengine
Content-Type: application/json;charset=UTF-8
Connection: close
Strict-Transport-Security: max-age=5184000
Date: Tue, 09 Nov 2021 17:26:25 GMT
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Cache-Control: no-store
Pragma: no-cache
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
WWW-Authenticate: Bearer realm="oauth2-resource", error="unauthorized", error_description="Full authentication is required to access this resource"
x-alicdn-da-ups-status: endOs,0,401
Via: cache21.l2et2[6,0], cache2.de3[210,0]
Timing-Allow-Origin: *
EagleId: 4f85b19616364787849875361e
     httpversion 1.0
     hu_blocking 0
     hu_filecount 1
     hu_port    443
     hu_portSfx
     ignoreredirects 1
     loglevel   4
     path       /maintain-s/operating/station/information/1194128
     protocol   https
     redirects  0
     timeout    2
     url        https://home.solarmanpv.com/maintain-s/operating/station/information/1194128
     sslargs:
   QUEUE:
   READINGS:
     2021-11-09 18:26:25   error           unauthorized
     2021-11-09 18:26:25   error_description Full authentication is required to access this resource
   REQUEST:
     context    reading
     data       
     header     
     ignoreredirects 0
     num        unknown
     retryCount 0
     type       update
     url        https://home.solarmanpv.com/maintain-s/operating/station/information/1194128
   defptr:
     readingBase:
       error      reading
       error_description reading
     readingNum:
       error      unknown
       error_description unknown
     readingOutdated:
     requestReadings:
       update:
         error      reading unknown
         error_description reading unknown
Attributes:
   enableCookies 1
   extractAllJSON 1
   reading01JSON generationYear
   reading01Name Jahresertrag
   set01Data  {{data}}
   sid01Data  email=meine email adresse&password=geheim
   sid01URL   https://home.solarmanpv.com/login
   verbose    5


Wenn dann das Login geschafft ist, sollten ja mit "extractAllJSON" alle verfügbaren JSONs angezeigt werden oder?

Herzlichen Dank für eure Hilfe

Gruß
Helmut
System1 fhem 6.1 auf RPi 4B mit 4GB, HMUSBConfig, DS9490R-1Wire, Busware USB 868, Pool-Solarsteuerung mit FHEM. System2 fhem 6.1 auf RPi 4B mit 4GB (Bullseye) mit Busware USB 868 und 433 und HMUARTLGW für Haussteuerung

https://www.flickr.com/photos/canonhelmi/

Decki

Hallo Helmut,

ich stehe vor dem gleichen Problem und habe die Frage auch schon im Unterforum Solaranlagen gestellt.
Im Moment werte ich das über einen Shelly1PM aus. Dieser liefert aber nur die momentane Gesamt KW und die KWh des Tages aller Micro-WR.
Leider kann ich nicht beim Programmieren helfen, werde aber mitlesen und bei Test helfen.
Habe Bosswerk und Huayu WR, die aber baugleich sind.

Andreas
Raspi 2 im Schaltschrank, USB IR Lesekopf am EHz21, Gaszähler mit Reedkontakt, Jeelink,  16 FS20 Aktoren,  3 Ufos für LED, 11 FS20 Rolladenaktore, AMAD 4.0 mit Sprachausgabe, Esp12 mit EspEasy

Helmi55

Guiten Morgen
ich habe jetzt, so wie auch hier beschrieben
https://forum.fhem.de/index.php/topic,124009.0.html
Showbody auf 1 gesetzt und sehe jetzt die Fehlermeldung
{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}
obwohl unter
sid01URL https://home.solarmanpv.com/login
eingetragen ist und unter
sid01Data email und Password hinterlegt sind.

Was übersehe ich hier noch bzw. was fehlt?

Habe jetzt schon einiges gelesen, aber die HTTPMOD Abfragen sind immer ohne Login (bis auf "mein" Beispiel mit dem Ofen im Wiki)

@Decki
Ich habe auch 2 Huayu HY800 WR
Ich könnte die natürlich auch direkt mit der internen IP Abfragen - ABER - auch hier stolpere ich über das Login

Vielleicht gibts ja einen Experten der uns hier beim Login hilft

Schönen Tag
Gruß
Helmut
System1 fhem 6.1 auf RPi 4B mit 4GB, HMUSBConfig, DS9490R-1Wire, Busware USB 868, Pool-Solarsteuerung mit FHEM. System2 fhem 6.1 auf RPi 4B mit 4GB (Bullseye) mit Busware USB 868 und 433 und HMUARTLGW für Haussteuerung

https://www.flickr.com/photos/canonhelmi/

Decki

Raspi 2 im Schaltschrank, USB IR Lesekopf am EHz21, Gaszähler mit Reedkontakt, Jeelink,  16 FS20 Aktoren,  3 Ufos für LED, 11 FS20 Rolladenaktore, AMAD 4.0 mit Sprachausgabe, Esp12 mit EspEasy

Helmi55

Guten Abend

habs jetzt mit der internen Abfrage vom Converter probiert:

2021.11.11 15:03:56 3: Converter1: Read callback: Error: xyz:abc@10.0.0.191: malformed or unsupported URL

und bekomme diese Meldung
Wenn ich die Zeile so im Firefox eingebe, habe ich Zugriff?

Hier ein List

Internals:
   BUSY       0
   DEF        xyz:abc@10.0.0.191 7200
   FUUID      618cd547-f33f-ee2d-dc47-79ca2fefe5e2427e
   Interval   7200
   MainURL    xyz:abc@10.0.0.191
   ModuleVersion 4.1.10 - 6.7.2021
   NAME       Converter1
   NOTIFYDEV  global
   NR         626
   NTFY_ORDER 50-Converter1
   STATE      ???
   TYPE       HTTPMOD
   value     
   HttpUtils:
     data       
     displayurl xyz:abc@10.0.0.191
     header     
     httpversion 1.0
     hu_blocking 0
     ignoreredirects 1
     loglevel   4
     redirects  0
     timeout    2
     url        xyz:abc@10.0.0.191
     sslargs:
   QUEUE:
   READINGS:
   REQUEST:
     context    reading
     data       
     header     
     ignoreredirects 0
     num        unknown
     retryCount 0
     type       update
     url        xyz:abc@10.0.0.191
Attributes:
   extractAllJSON 1
   verbose    5



Wer hilft mir bitte weiter?

Gruß
Helmut
System1 fhem 6.1 auf RPi 4B mit 4GB, HMUSBConfig, DS9490R-1Wire, Busware USB 868, Pool-Solarsteuerung mit FHEM. System2 fhem 6.1 auf RPi 4B mit 4GB (Bullseye) mit Busware USB 868 und 433 und HMUARTLGW für Haussteuerung

https://www.flickr.com/photos/canonhelmi/

Helmi55

Hallo

habe jetzt nochmals auf andere Art und Weise versucht ein Login zum "internen" Converter herzustellen - auch ohne Erfolg
Ich poste die auch nochmals - vielleicht liest es ja einer der sich auskennt und bereit ist mir zu helfen?

Internals:
   BUSY       0
   DEF        http://10.0.0.191/status 30
   FUUID      618cd547-f33f-ee2d-dc47-79ca2fefe5e2427e
   Interval   30
   LastAuthTry 2021-11-14 14:59:20
   MainURL    http://10.0.0.191/status
   ModuleVersion 4.1.10 - 6.7.2021
   NAME       Converter1
   NOTIFYDEV  global
   NR         624
   NTFY_ORDER 50-Converter1
   STATE      ???
   TYPE       HTTPMOD
   nextQueueRun 1636898362.21061
   value     
   CompiledRegexes:
   HttpUtils:
     data       Nutzername=xyz&Passwort=xyz&Remember=false
     displayurl http://10.0.0.191
     header     
     httpversion 1.0
     hu_blocking 0
     ignoreredirects 1
     loglevel   4
     redirects  0
     timeout    2
     url        http://10.0.0.191
     sslargs:
   QUEUE:
     HASH(0x4c19310)
   READINGS:
   REQUEST:
     context    sid
     data       Nutzername=xyz&Passwort=xyz&Remember=false
     header     
     ignoreRedirects 0
     ignoreredirects 0
     num        01
     priority   1
     retryCount 0
     type       auth01
     url        http://10.0.0.191
Attributes:
   enableControlSet 1
   enableCookies 1
   extractAllJSON 1
   reAuthRegex USER LOGIN
   sid01Data  Nutzername=xyz&Passwort=xyz&Remember=false
   sid01URL   http://10.0.0.191
   verbose    5



Hier das Log
2021.11.14 15:06:50 4: Converter1: GetUpdate called (update)
2021.11.14 15:06:50 4: Converter1: UpdateTimer called from GetUpdate with cmd next sets timer to call update function in 30.0 sec at 15:07:20.753, interval 30
2021.11.14 15:06:50 5: Converter1: AddToQueue adds type update to URL http://10.0.0.191/status, no data, no headers, retry 0, initial queue len: 0
2021.11.14 15:06:50 5: Converter1: HandleSendQueue called from AddToSendQueue, qlen = 1
2021.11.14 15:06:50 4: Converter1: HandleSendQueue sends update with timeout 2 to http://10.0.0.191/status, No Data, No Header
2021.11.14 15:06:50 5: Converter1: ReadCallback called from __ANON__
2021.11.14 15:06:50 4: Converter1: Read callback: request type was update retry 0,
header: HTTP/1.0 401 Unauthorized
Server: HTTPD
Date: Thu, 01 Jan 1970 00:20:05 GMT
WWW-Authenticate: Basic realm="USER LOGIN"
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Connection: close, body length 140
2021.11.14 15:06:50 5: Converter1: Read callback: body
<HTML><HEAD><TITLE>401 Unauthorized</TITLE></HEAD>
<BODY BGCOLOR="#cc9999"><H4>401 Unauthorized</H4>
Authorization required.
</BODY></HTML>

2021.11.14 15:06:50 4: Converter1: BodyDecode is not decoding the response body (charset not found, bodyDecode defaults to none)
2021.11.14 15:06:50 4: Converter1: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<HTML><HEAD><TITLE>4...") at lib/FHEM/HTTPMOD/Utils.pm line 678.

2021.11.14 15:06:50 5: Converter1: GetCookies is looking for Cookies
2021.11.14 15:06:50 5: Converter1: ExtractSid called, context reading, num unknown
2021.11.14 15:06:50 4: Converter1: checking for redirects, code=401, ignore=0
2021.11.14 15:06:50 4: Converter1: no redirects to handle
2021.11.14 15:06:50 5: Converter1: Read callback sets LAST_REQUEST to update
2021.11.14 15:06:50 5: Converter1: CheckAuth is checking buffer with ReAuthRegex (?^:USER LOGIN)
2021.11.14 15:06:50 4: Converter1: CheckAuth decided new authentication required
2021.11.14 15:06:50 5: Converter1: AddToQueue prepends type update to URL http://10.0.0.191/status, no data, no headers, retry 1, initial queue len: 0
2021.11.14 15:06:50 4: Converter1: CheckAuth prepended request update again before auth, retryCount 0 ...
2021.11.14 15:06:50 4: Converter1: DoAuth called with Steps: 01
2021.11.14 15:06:50 5: Converter1: AddToQueue prepends type auth01 to URL http://10.0.0.191, data Nutzername=xyz&Passwort=xyz&Remember=false, no headers, retry 0, initial queue len: 1
2021.11.14 15:06:50 5: Converter1: HandleSendQueue called from DoAuth, qlen = 2
2021.11.14 15:06:50 5: Converter1: StartQueueTimer called from ReadyForSending sets internal timer to process queue in 1.000 seconds, minSendDelay 0.2 not over
2021.11.14 15:06:51 5: Converter1: HandleSendQueue called from Fhem internal timer, qlen = 2
2021.11.14 15:06:51 4: Converter1: HandleSendQueue sends auth01 with timeout 2 to http://10.0.0.191,
data: Nutzername=admin&Passwort=admin&Remember=false, No Header
2021.11.14 15:06:51 5: Converter1: ReadCallback called from HttpUtils_NonblockingGet
2021.11.14 15:06:51 5: Converter1: Read callback Error LogLvl set to 3, regex
2021.11.14 15:06:51 3: Converter1: Read callback: Error: http://10.0.0.191: malformed or unsupported URL
2021.11.14 15:06:51 4: Converter1: Read callback: request type was auth01 retry 0, no headers, no body
2021.11.14 15:06:51 5: Converter1: Read callback: body empty
2021.11.14 15:06:51 4: Converter1: BodyDecode is not decoding the response body (charset not found, bodyDecode defaults to none)
2021.11.14 15:06:51 5: Converter1: GetCookies is looking for Cookies
2021.11.14 15:06:51 5: Converter1: ExtractSid called, context sid, num 01
2021.11.14 15:06:51 4: Converter1: no header to look for redirects
2021.11.14 15:06:51 5: Converter1: Read callback sets LAST_REQUEST to auth01
2021.11.14 15:06:51 5: Converter1: StartQueueTimer called from HandleSendQueue sets internal timer to process queue in 1.000 seconds
2021.11.14 15:06:52 5: Converter1: HandleSendQueue called from Fhem internal timer, qlen = 1
2021.11.14 15:06:52 4: Converter1: HandleSendQueue sends update with timeout 2 to http://10.0.0.191/status, No Data, No Header
2021.11.14 15:06:52 5: Converter1: ReadCallback called from __ANON__
2021.11.14 15:06:52 4: Converter1: Read callback: request type was update retry 1,
header: HTTP/1.0 401 Unauthorized
Server: HTTPD
Date: Thu, 01 Jan 1970 00:20:05 GMT
WWW-Authenticate: Basic realm="USER LOGIN"
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Connection: close, body length 140
2021.11.14 15:06:52 5: Converter1: Read callback: body
<HTML><HEAD><TITLE>401 Unauthorized</TITLE></HEAD>
<BODY BGCOLOR="#cc9999"><H4>401 Unauthorized</H4>
Authorization required.
</BODY></HTML>

2021.11.14 15:06:52 4: Converter1: BodyDecode is not decoding the response body (charset not found, bodyDecode defaults to none)
2021.11.14 15:06:52 4: Converter1: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<HTML><HEAD><TITLE>4...") at lib/FHEM/HTTPMOD/Utils.pm line 678.

2021.11.14 15:06:52 5: Converter1: GetCookies is looking for Cookies
2021.11.14 15:06:52 5: Converter1: ExtractSid called, context reading, num unknown
2021.11.14 15:06:52 4: Converter1: checking for redirects, code=401, ignore=0
2021.11.14 15:06:52 4: Converter1: no redirects to handle
2021.11.14 15:06:52 5: Converter1: Read callback sets LAST_REQUEST to update
2021.11.14 15:06:52 5: Converter1: CheckAuth is checking buffer with ReAuthRegex (?^:USER LOGIN)
2021.11.14 15:06:52 4: Converter1: CheckAuth decided new authentication required
2021.11.14 15:06:52 4: Converter1: Authentication still required but no retries left - did last authentication fail?
2021.11.14 15:06:52 3: Converter1: no parsed JSON structure available
2021.11.14 15:06:52 5: Converter1: Read starts parsing response to update with defined readings:
2021.11.14 15:06:52 4: Converter1: Read response to update didn't match any Reading
2021.11.14 15:06:52 5: Converter1: HandleSendQueue called from ReadCallback, qlen = 0
2021.11.14 15:06:52 5: Converter1: HandleSendQueue found no usable entry in queue



Und hier 2 Bilder von BURP

Ersuche um Hilfe - Danke
Helmut

System1 fhem 6.1 auf RPi 4B mit 4GB, HMUSBConfig, DS9490R-1Wire, Busware USB 868, Pool-Solarsteuerung mit FHEM. System2 fhem 6.1 auf RPi 4B mit 4GB (Bullseye) mit Busware USB 868 und 433 und HMUARTLGW für Haussteuerung

https://www.flickr.com/photos/canonhelmi/

Tueftler1983

Hallo zusammen hat es mittlerweile jemand geschafft die Daten vom Solarman in Fhem zu bekommen?

marboj

Hallo zusammen,

habe die Lösung aus diesem THread genommen:

https://forum.fhem.de/index.php/topic,123506.0.html

Das geht. Fragt aber über die lokale IP ab.

Gruß
Marco
meine FHEM-Konfiguration: Raspberry Pi4, BT-Dongle, CUL868, CeeBee II

Tueftler1983

Ja habe es auch eben gesehen und auch so umgesetzt.
Und local direkt den logger/Inverter abzufragen gefällt mir eh besser.

Danke dir für das Feedback.