Moin zusammen,
ich wollte das shell script aus #5 benutzen aber mit Zugang zur Fritzbox über https.
Dazu braucht curl den Paramter "-k".
Merkwürdigerweise ist der nicht bei allen curl Aufrufen angegeben. Aber mit -k klappt es auch über https.
Ein weiterer Punkt ist, dass die grep Abfrage zum Auslesen der SID nicht funktioniert. Evt. liegt das m Firitz OS 7.50 ?
Also das funktioniert bei mir nicht (keine Ausgabe):
SID=$(curl -i -s -k -d "response=${RESPONSE}&username=${USER}" "${FBF}" | grep -Po -m 1 '(?<=sid=)[a-f\d]+')
aber so klappt es:
SID=$(curl -i -s -k -d "response=${RESPONSE}&username=${USER}" "${FBF}" | grep -oP '"sid": *"\K[^"]*')
Alternativ mit wget statt curl:
SID=$(wget --no-check-certificate -O - --post-data="response=${RESPONSE}&username=${USERNAME}" "${FBF}" | grep -oP '"sid": *"\K[^"]*')
--------------
Ich hab hier kein vollwertiges SmartHome im Einsatz aber ich hab diverse Temperatur Sensoren im Einsatz, u.a. Tuya Zigbee, Shelly H&T un dauch FritzBox Comet DECT.
Ich lese mittels cron job die Temperatur Daten aus und bastel dann eine Grafik mit Google Graph.
Klappt aus soweit aber trotz shell script aus #5 bekomme ich keien aktuelle Temperatur für meine Comet Teile.
Müsste das nicht so aussehen?
...
AIN="11959%200531552"
...
TEMPINT=$(curl -s -k ${FBF}'/webservices/homeautoswitch.lua?ain='${AIN}'&switchcmd=gettemperatur&sid='${SID})
Oder geht das mit den Comet nicht? Ich bekomme einen Fehler "Bad request"
* Trying 2a01:...
* Connected to fritz.box (2a01:...) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: CN=dieko.goip.de
* start date: Jul 25 21:53:11 2022 GMT
* expire date: Jan 15 21:53:11 2038 GMT
* issuer: CN=dieko.goip.de
* SSL certificate verify result: self signed certificate (18), continuing anyway.
> GET /webservices/homeautoswitch.lua?ain=11959%200531552&switchcmd=gettemperatur&sid=4a8a420fbff647fa HTTP/1.1
> Host: fritz.box
> User-Agent: curl/7.74.0
> Accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Mark bundle as not supporting multiuse
< HTTP/1.1 400 Bad Request
< Cache-Control: no-cache
< Connection: Keep-Alive
< Content-Length: 0
< Content-Type: text/plain; charset=utf-8
< Expires: -1
< Pragma: no-cache
< Keep-Alive: timeout=60, max=300
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< Content-Security-Policy: default-src 'none'; connect-src 'self'; font-src 'self'; frame-src https://service.avm.de https://fritzhelp.avm.de/help/ https://help.avm.de https://www.avm.de https://avm.de https://assets.avm.de https://clickonce.avm.de http://clickonce.avm.de http://download.avm.de https://download.avm.de 'self'; img-src 'self' https://tv.avm.de https://help.avm.de/images/ http://help.avm.de/images/ data:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; frame-ancestors 'self'; media-src 'self'
<
* Connection #0 to host fritz.box left intact
Danke für einen Hinweis...