FHEM Forum

FHEM => Sonstiges => Thema gestartet von: dietpe1g am 01 Juli 2023, 16:18:35

Titel: Basic Fragen zu HTTPMOD
Beitrag von: dietpe1g am 01 Juli 2023, 16:18:35
Hallo Gemeinde, ich versuche ein HTTPMOD device mit dem Zugriff auf mein Zeversolar Wechselrichter zu erreichen. Bisher mit Python und Curl möglich:
pi@heizung:~ $ curl --silent http://zeversolar/home.cgi
1
1
EAB961710598
XPWJJJLRYBW4AX9H
M10
19703-826R+17829-719R
21:30 01/07/2023
0
1
BS20006011710285
[color=red]383[/color]
4.78
OK
Error
Mein Device ist wie folgt definiert:
nternals:
   BUSY       0
   CFGFN     
   DEF        http://192.168.178.42/home.cgi 60
   FUUID      64a028d2-f33f-39c2-54bf-ecfce9bad4fecc8c
   Interval   60
   MainURL    http://192.168.178.42/home.cgi
   ModuleVersion 4.1.15 - 17.12.2022
   NAME       zsolar
   NOTIFYDEV  global
   NR         7553
   NTFY_ORDER 50-zsolar
   STATE      ???
   TYPE       HTTPMOD
   eventCount 10
   value     
   CompiledRegexes:
   HttpUtils:
     NAME      
     addr       http://192.168.178.42:80
     auth       0
     buf       
     code       505
     conn      
     data      
     displayurl http://192.168.178.42/home.cgi
     header    
     host       192.168.178.42
     httpheader HTTP/1.1 505 HTTP Version Not Supported
Transfer-Encoding: chunked
Content-Type: text/plain
     httpversion 1.0
     hu_blocking 0
     hu_filecount 1
     hu_port    80
     hu_portSfx
     ignoreredirects 1
     loglevel   4
     path       /home.cgi
     protocol   http
     redirects  0
     timeout    2
     url        http://192.168.178.42/home.cgi
     sslargs:
   QUEUE:
   READINGS:
   REQUEST:
     context    reading
     data      
     header    
     ignoreredirects 0
     num        unknown
     retryCount 0
     type       update
     url        http://192.168.178.42/home.cgi
Attributes:
   enableControlSet 1
   enableCookies 1
   enforceGoodReadingNames 1
   handleRedirects 1
   reading01Name current_power
   reading01Regex "(^[0-9]{1,4})"
   room       PV

1) Führe ich ein "reread" aus, wird kein Reading angelegt. Die 11te Zeile enthält den aktuellen Peak-Wert (nur Zahlen 0-2400). Was mache ich hier falsch?

2) Weiterhin würde ich unter den Internals "value" eine Zeile mit den eingelesenen Werten erwarten. Ist die Annahme richtig?

Vorab schon vielen Dank für euere Hilfe.
Titel: Aw: Basic Fragen zu HTTPMOD
Beitrag von: betateilchen am 01 Juli 2023, 16:28:04
Falsches Unterforum für Fragen zu HTTPMOD.

HTTP/1.1 505 HTTP Version Not Supported

Da hast Du vermutlich die Ursache für Dein Problem.
Titel: Aw: Basic Fragen zu HTTPMOD
Beitrag von: dietpe1g am 01 Juli 2023, 16:47:40
Heißt es dann, dass das HTTPMOD diese "alte" HTTP/1.1 nicht unterstützt?
Titel: Aw: Basic Fragen zu HTTPMOD
Beitrag von: betateilchen am 01 Juli 2023, 16:52:02
Immer noch das falsche Forum für HTTPMOD.

Nein, umgekehrt. Dein Wechselrichter verwendet vermutlich eine neuere HTTP Version (2?), die HTTPMOD nicht kann.
Titel: Aw: Basic Fragen zu HTTPMOD
Beitrag von: dietpe1g am 01 Juli 2023, 16:57:28
1) wie kann ich das Thema ins richtige Forum umziehen? -> bin leider Anfänger!
2) ups, das hätte ich nicht gedacht. Zeversolar habe ich 2016 in Betrieb genommen und bisher über Python ausgelesen. Jetzt wollte ich es richtig machen, da mir der Python-Prozess manchmal hängen geblieben ist. Bin mit den ganzen HTTP Protokollen nicht so firm.
Titel: Aw: Basic Fragen zu HTTPMOD
Beitrag von: betateilchen am 01 Juli 2023, 17:02:28
Zu 1)

Das richtige Unterforum findest Du mit "help httpmod", verschieben kannst Du mit dem Button unten links auf der Seite.

Zu 2)

Erstmal ins richtige Forum verschieben...
Titel: Aw: Basic Fragen zu HTTPMOD
Beitrag von: dietpe1g am 01 Juli 2023, 17:29:30
zu 1) ah, zuerst war ich etwas verwirrt, da viele HTTPMOD unter "Sonstiges" stehen, habe unter Wie finde ich das richtige Board für meinen Beitrag?
das HTTPMOD gefunden und tatsächlich gehört es hier rein.
Dann verschiebe ich mal.  ;)
Titel: Aw: Basic Fragen zu HTTPMOD
Beitrag von: betateilchen am 01 Juli 2023, 17:34:59
Meine Vermutung mit HTTP2 ist tatsächlich nur eine Vermutung, aber naheliegend aufgrund der von Dir geposteten Fehlermeldung.

Setze mal im HTTPMOD device verbose=5 und mache dann ein reread.
Danach kannst Du die Logausgaben hier posten, vielleicht erkennt man darin mehr.
Nicht vergessen, das verbose danach wieder zurückzusetzen.
Titel: Aw: Basic Fragen zu HTTPMOD
Beitrag von: dietpe1g am 02 Juli 2023, 09:14:41
Leider hat das Setzen im HTTPMOD attr zsolar verbose 5 erstmal nicht die erforderliche Wirkung gehabt. Habe dann das verbose in fhem.cfg gesetzt und den "set zsolar reread" - Teil (hoffentlich alles) rauskopiert.

2023.07.02 08:44:50 5: Cmd: >set zsolar reread<
2023.07.02 08:44:50 5: zsolar: set called with reread
2023.07.02 08:44:50 4: zsolar: GetUpdate called (reread)
2023.07.02 08:44:50 5: zsolar: AddToQueue adds type update to URL http://192.168.178.42/home.cgi, no data, no headers, retry 0, initial queue len: 0
2023.07.02 08:44:50 5: zsolar: HandleSendQueue called from AddToSendQueue, qlen = 1
2023.07.02 08:44:50 4: zsolar: HandleSendQueue sends update with timeout 2 to http://192.168.178.42/home.cgi, No Data, No Header
2023.07.02 08:44:50 5: HttpUtils url=http://192.168.178.42/home.cgi NonBlocking via http
2023.07.02 08:44:50 4: IP: 192.168.178.42 -> 192.168.178.42
2023.07.02 08:44:50 5: Starting notify loop for zsolar, 1 event(s), first is reread
2023.07.02 08:44:50 5: End notify loop for zsolar
2023.07.02 08:44:50 5: HttpUtils request header:
GET /home.cgi HTTP/1.0
Host: 192.168.178.42
User-Agent: fhem

2023.07.02 08:44:50 4: http://192.168.178.42/home.cgi: HTTP response code 505
2023.07.02 08:44:50 5: HttpUtils http://192.168.178.42/home.cgi: Got data, length: 0
2023.07.02 08:44:50 5: HttpUtils response header:
HTTP/1.1 505 HTTP Version Not Supported
Transfer-Encoding: chunked
Content-Type: text/plain
2023.07.02 08:44:50 5: zsolar: ReadCallback called from __ANON__
2023.07.02 08:44:50 4: zsolar: Read callback: request type was update retry 0,
header: HTTP/1.1 505 HTTP Version Not Supported
Transfer-Encoding: chunked
Content-Type: text/plain, no body
2023.07.02 08:44:50 5: zsolar: Read callback: body empty
2023.07.02 08:44:50 4: zsolar: BodyDecode is not decoding the response body (charset not found, bodyDecode defaults to none)
2023.07.02 08:44:50 5: zsolar: GetCookies is looking for Cookies
2023.07.02 08:44:50 5: zsolar: ExtractSid called, context reading, num unknown
2023.07.02 08:44:50 4: zsolar: checking for redirects, code=505, ignore=0
2023.07.02 08:44:50 4: zsolar: no redirects to handle
2023.07.02 08:44:50 5: zsolar: Read callback sets LAST_REQUEST to update
2023.07.02 08:44:50 5: zsolar: CheckAuth decided no authentication required
2023.07.02 08:44:50 5: zsolar: Read starts parsing response to update with defined readings: 01
2023.07.02 08:44:50 5: zsolar: ExtractReading current_power with regex /(?^:"(^[0-9]{1,4})")/...
2023.07.02 08:44:50 5: zsolar: ExtractReading current_power did not match
2023.07.02 08:44:50 4: zsolar: Read response to update didn't match any Reading
2023.07.02 08:44:50 5: zsolar: HandleSendQueue called from ReadCallback, qlen = 0
2023.07.02 08:44:50 5: zsolar: HandleSendQueue found no usable entry in queue
2023.07.02 08:44:50 5: GET /fhem?detail=zsolar&fw_id= HTTP/1.1
Host: 192.168.178.25:8083
Origin: http://192.168.178.25:8083
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15
Referer: http://192.168.178.25:8083/fhem?detail=zsolar
Accept-Encoding: gzip, deflate
Accept-Language: de-de
2023.07.02 08:44:50 4: WEB_192.168.178.43_49816 GET /fhem?detail=zsolar&fw_id=; BUFLEN:0
2023.07.02 08:44:50 4: WEB: /fhem?detail=zsolar&fw_id= / RL:6282 / text/html; charset=UTF-8 / Content-Encoding: gzip
 / Cache-Control: no-cache, no-store, must-revalidate

2023.07.02 08:44:50 4: Connection closed for WEB_192.168.178.43_49819: EOF
2023.07.02 08:44:50 5: GET /fhem?cmd=%7BReadingsVal(%22zsolar%22%2C%22attrTemplate%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_841419880578654 HTTP/1.1
Host: 192.168.178.25:8083
Connection: keep-alive
Accept: */*
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15
Accept-Language: de-de
Referer: http://192.168.178.25:8083/fhem?detail=zsolar&fw_id=
Accept-Encoding: gzip, deflate
2023.07.02 08:44:50 4: WEB_192.168.178.43_49816 GET /fhem?cmd=%7BReadingsVal(%22zsolar%22%2C%22attrTemplate%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_841419880578654; BUFLEN:0
2023.07.02 08:44:50 5: Cmd: >{ReadingsVal("zsolar","attrTemplate","")}<
2023.07.02 08:44:50 4: WEB: /fhem?cmd=%7BReadingsVal(%22zsolar%22%2C%22attrTemplate%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_841419880578654 / RL:21 / text/plain; charset=UTF-8 / Content-Encoding: gzip
 / Cache-Control: no-cache, no-store, must-revalidate

2023.07.02 08:44:51 5: GET /fhem?cmd=%7BAttrVal(%22zsolar%22%2C%22room%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_841419880578654 HTTP/1.1
Host: 192.168.178.25:8083
Connection: keep-alive
Accept: */*
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15
Accept-Language: de-de
Referer: http://192.168.178.25:8083/fhem?detail=zsolar&fw_id=
Accept-Encoding: gzip, deflate
2023.07.02 08:44:51 4: WEB_192.168.178.43_49818 GET /fhem?cmd=%7BAttrVal(%22zsolar%22%2C%22room%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_841419880578654; BUFLEN:0
2023.07.02 08:44:51 5: Cmd: >{AttrVal("zsolar","room","")}<
2023.07.02 08:44:51 4: WEB: /fhem?cmd=%7BAttrVal(%22zsolar%22%2C%22room%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_841419880578654 / RL:23 / text/plain; charset=UTF-8 / Content-Encoding: gzip
 / Cache-Control: no-cache, no-store, must-revalidate

2023.07.02 08:44:51 5: [Shelly_status] issue a non-blocking call to http://192.168.178.98/status
Titel: Aw: Basic Fragen zu HTTPMOD
Beitrag von: betateilchen am 02 Juli 2023, 17:46:12
Du sendest den request mit HTTP 1.0 und der Server teilt Dir mittels HTTP 1.1 mit, dass Deine HTTP-Version nicht erlaubt ist.

Dann setze doch mal das Attribut httpVersion entsprechend auf 1.1 und teste nochmal.