Autor Thema: Miele 3rd party API in FHEM einbinden  (Gelesen 21713 mal)

Offline xerion

  • Full Member
  • ***
  • Beiträge: 115
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #30 am: 21 Januar 2019, 20:39:09 »
Ich konnte den Aufruf erfolgreich mit folgenden Code in einem NOTIFY durchführen:

Waschmaschine:An 
{ fhem "set Miele_API3 reread";
if (ReadingsVal("Miele_API3", "000149130299_state_status_value_raw", 0)==4) {
   system("curl -X PUT \"https://api.mcs3.miele.com/v1/devices/000149130299/actions\" -H  \"accept: */*\" -H  \"Content-Type: application/json\" -H \"Authorization: Bearer ".InternalVal("Miele_API3","sid", "")."\" -d '{\"processAction\":1}' &")
  }
}

Für Testzwecke habe ich noch einen Dummy (Waschmaschine) angelegt und es funktioniert so wie ich es mir gewünscht habe.
Ich habe an meinem Senec Speicher zwei schaltbare Steckdosen dran, die anhand von Einstellungen automatisch schalten. Diese Werte lese ich per HTTPMOD aus uns setzte den Befehl per DOIF ab.

Also kann der Sommer nun kommen und meine PV-Anlage kann dank dir amenomade noch mehr Eigenverbrauch sicher stellen  ;D
Gefällt mir Gefällt mir x 2 Liste anzeigen

Online Fritz Muster

  • Full Member
  • ***
  • Beiträge: 198
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #31 am: 05 März 2019, 11:43:37 »
Hab ein bisschen weiter experimentiert. Sowas könnte funktionieren:

In 99_myUtils:
sub mieleStart() {
  my $befehl = "curl -X PUT 'https://api.mcs3.miele.com/v1/devices/000149130299/actions' -H 'accept: */*' -H 'Content-Type: application/json' -H 'Authorization: Bearer ";
  $befehl .= InternalVal("Miele_API3","sid", "");
  $befehl .= "' -d '{\"processAction\":1}' &";
  Log 3,$befehl;
  system("$befehl");
  return 0;
}

Und dann in einem notify auf deinem PV-Anlage, oder ein DOIF oder hier ein at:
defmod atcurl at *01:00 set Miele_API3 reread;; sleep 10;; { mieleStart() }
Wie gesagt, reread um sicher zu stellen, dass der Token OK ist, dann 10 Sekunden (non blocking) warten, um sicher zu sein, dass der HTTPMOD fertig ist, und dann das PUT (das & am Ende, um zu forken, damit es auch non blocking wird)

Dann könnte man noch ein reread reinpacken, um den Status zu aktualisieren...

Danke!!

Habe meine Miele WMA nun auch in FHEM / TabletUI drin.

Grüße Fritz
RasPi 3B+, Stretch, Fhem 5.9, DBlog SQLite
HMLAN, Jeelink Clone, nanoCUL/MAX, SIGNALduino 433&868, ArduCounter
HM Sensoren/Aktoren ,Technoline TX 29 DTH-IT, TFA 30.3155WD, MAX!
Hour Counter, Astro, EletricityCounter, Statistics, Charting Frontend, TabletUI, Modbus

Online Fritz Muster

  • Full Member
  • ***
  • Beiträge: 198
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #32 am: 07 März 2019, 12:27:48 »
Hallo an Alle Interessierten,

da ich an der ein oder anderen Stellen hier im Forum User getroffen habe die Ihre Miele@home Geräte in fhem integrieren möchten fasse ich hier mal zusammen wie das Ganze funktioniert bzw. was gemacht werden muss um Miele@home Geräte in fhem zu integrieren. Der folgende Weg geht über die Miele cloud, welche hier beschrieben/dokumentiert ist.

1. Das Miele@home Gerät in das eigene WLAN integrieren. Das kann auf zwei unterschiedliche Arten erfolgen.
         a. Über die WPS (Push Button) Funktion des eigenen WLAN Routers (hat bei mir nicht funktioniert)
         b. Über die IOS/Android App miele@mobile

2. Ein Developer account beim Miele API Developer Team beantragen. Dazu einfach formlos eine Mail an developer@miele.com mit der Bitte einen API Account für die Emailadresse welche in der miele@mobile IOS/Android App als Benutzername verwendet wurde anzulegen. Die Antwort erfolgt in der Regel innerhalb eines Werktages und enthält dann die benötige client-ID und die client-secret

3. Das Miele@home Gerät via HTTMOD in fhem anlegen defmod myMiele@homeGerät HTTPMOD https://api.mcs3.miele.com/v1/devices/0001486XXXXX/?language=de 120
Die 12-stellige Nummer 0001486XXXXX ist die Gerätenummer des Miele@home Gerätes welches in fhem integriert werden soll. Zu finden ist diese Nummer in der IOS/Android App unter Mehr=>Einstellungen =>Meine Miele Geräte=>Gerät=>Informationen=>Seriennummer oder auf dem Typenschild des Miele@home Gerätes bei einer Waschmaschine z.B. auf der Türinneseite oben.

4. Folgende Attribute für das myMiele@homeGerät anlegen
attr myMiele@homeGerät enableControlSet 1
attr myMiele@homeGerät reAuthRegex 500.Internal.Server.Error|Unauthorized|default.backend...401
attr myMiele@homeGerät requestHeader01 Authorization: Bearer $sid
attr myMiele@homeGerät requestHeader02 Content-Type: application/json
attr myMiele@homeGerät sid1URL  https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=client-ID-vom-Miele-API-Account&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
attr myMiele@homeGerät sid2Data email=Email-von-App-Account&password=Passwort-von-App-Account&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=client-ID-vom-Miele-API-Account&vgInformationSelector=de-DE
attr myMiele@homeGerät sid2IdRegex (?s)code=(DE_[0-9a-f]+)
attr myMiele@homeGerät sid2IgnoreRedirects 1
attr myMiele@homeGerät sid2URL https://api.mcs3.miele.com/oauth/auth
attr myMiele@homeGerät sid3Data grant_type=authorization_code&code=$sid&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&client_id=client-ID-vom-Miele-API-Account&client_secret=client-Secret-vom-Miele-API-Account
attr myMiele@homeGerät sid3IdJSON access_token
attr myMiele@homeGerät sid3URL https://api.mcs3.miele.com/thirdparty/token/
attr myMiele@homeGerät verbose 3

in den Attributen
sid1URL
sid2Data
sid3Data
müssen die entsprechenden individuellen Daten Benutzername, Passwort, client-ID und client-secure eingetragen werden.

5. Abschließend nun die readings definieren, welche aus dem Miele@home Gerät ausgelesen werden sollen. Beispielhaft mal ein paar readings einer Waschmaschine
attr myMiele@homeGerät reading01Name remainigtime_h
attr myMiele@homeGerät reading01JSON state_remainingTime_0
attr myMiele@homeGerät reading02Name remainigtime_m
attr myMiele@homeGerät reading02JSON state_remainingTime_1
attr myMiele@homeGerät reading03Name elapsedtime_h
attr myMiele@homeGerät reading03JSON state_elapsedTime_0
attr myMiele@homeGerät reading04Name elapsedtime_m
attr myMiele@homeGerät reading04JSON state_elapsedTime_1
attr myMiele@homeGerät reading05Name spinningspeed
attr myMiele@homeGerät reading05JSON state_spinningSpeed
attr myMiele@homeGerät reading06Name state
attr myMiele@homeGerät reading06JSON state_status_value_raw

Wenn weitere/andere readings aus dem Miele@home Gerät benötigt werden können diese nach der Miele API Dokumentation via Attribute eingepflegt werden.

Nun werden alle 120 Sekunden die definierten readings aktualisiert.

Eine Ansteuerung des Miele@home Gerätes (z.B bei Verwendung einer Photovoltaik Anlage) kann dann direkt z.B. über ein notify erfolgen.
define mynotify notify PhotovoltaikAnlage:Strom_vorhanden
{ fhem "set myMiele@homeGerät reread";
if (ReadingsVal("myMiele@homeGerät", "state", 0)==4) {
   system("curl -X PUT \"https://api.mcs3.miele.com/v1/devices/0001486XXXXX/actions\" -H  \"accept: */*\" -H  \"Content-Type: application/json\" -H \"Authorization: Bearer ".InternalVal("myMiele@homeGerät","sid", "")."\" -d '{\"processAction\":1}' &")
  }
}

Dazu muss die Seriennummer des Miele@home Gerätes (0001486XXXXX) entsprechend eingetragen werden.


Grüße Fritz

« Letzte Änderung: 29 August 2019, 11:29:12 von Fritz Muster »
RasPi 3B+, Stretch, Fhem 5.9, DBlog SQLite
HMLAN, Jeelink Clone, nanoCUL/MAX, SIGNALduino 433&868, ArduCounter
HM Sensoren/Aktoren ,Technoline TX 29 DTH-IT, TFA 30.3155WD, MAX!
Hour Counter, Astro, EletricityCounter, Statistics, Charting Frontend, TabletUI, Modbus
Gefällt mir Gefällt mir x 4 Zustimmung Zustimmung x 1 Hilfreich Hilfreich x 2 Liste anzeigen

Offline leuchte1

  • Full Member
  • ***
  • Beiträge: 115
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #33 am: 07 März 2019, 13:12:17 »
Hallo Fritz,

Das ist mal just in time. Morgen kommt unser Geschirrspüler, die Zugangsdaten habe ich schon und dann kann’s losgehen.
Vielen Dank.

Gruß
Stefan

Offline basi79

  • New Member
  • *
  • Beiträge: 49
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #34 am: 13 März 2019, 12:40:42 »
Danke @Fritz,

für die Anleitung...

Habe gleich am 07.03. eine Mail an Miele geschrieben, mit der bitte um ein Developer Account..
.. bis heute jedoch noch nichts bekommen!

Gibt es noch einen anderen weg..?? vermutlich nicht.. :)

Gruß

basi79
RaspberryPI, Homematic, FS20, Fritzbox7490

Offline volschin

  • Hero Member
  • *****
  • Beiträge: 1403
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #35 am: 14 März 2019, 09:20:16 »
Ich habe auch heute erst Antwort bekommen. Also gedulden, die wurden vermutlich vom Ansturm der Anfragen überrascht.
RPi4 4GB+Docker+FHEM5.9,HM-MOD-RPI-PCB+HM-USB-CFG2+hmland
HomeMatic: diverse, HUE: diverse, Hue-Bridge, RaspBee+deCONZ
Amzn Dash-Buttons, Siro Rollos
4xRPi, 4xCO20, OWL+USB, HarmonyHub, FRITZ!Box 7590, Echo Dot, Logi Circle 2

Offline basi79

  • New Member
  • *
  • Beiträge: 49
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #36 am: 14 März 2019, 11:30:34 »
Danke @Fritz,

für die Anleitung...

Habe gleich am 07.03. eine Mail an Miele geschrieben, mit der bitte um ein Developer Account..
.. bis heute jedoch noch nichts bekommen!

Gibt es noch einen anderen weg..?? vermutlich nicht.. :)

Gruß

basi79

hab auch heute eine erfreuliche eMail bekommen.. danke..für die Geduld...
RaspberryPI, Homematic, FS20, Fritzbox7490
Gefällt mir Gefällt mir x 1 Liste anzeigen

Online Laffer72

  • Jr. Member
  • **
  • Beiträge: 96
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #37 am: 21 März 2019, 20:40:18 »
Hallo,

wollte mal nachfragen, ob die Abfrage bei Euch noch funktioniert. Am Anfang hat es geklappt, aber seit ein paar Tagen hab ich im Header immer diese Meldung:

HTTP/1.1 401 Unauthorized
Date: Thu, 21 Mar 2019 19:29:36 GMT
Content-Type: text/html
Content-Length: 188
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS
Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
Strict-Transport-Security: max-age=15724800; includeSubDomains

Im Log:
[tr]
[td]2019.03.21 00:04:54 3: Miele_Waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html>\r\n<head><tit...") at (eval 4301) line 1.

2019.03.21 00:04:54 3: Miele_Waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html lang="de">\n<h...") at (eval 4303) line 1.

2019.03.21 00:04:56 3: Miele_Waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html lang="de">\n<h...") at (eval 4305) line 1.

2019.03.21 00:04:57 3: Miele_Waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html>\r\n<head><tit...") at (eval 4309) line 1.
[/td][/tr]

Haben die bei Miele vielleicht etwas umgestellt?

Achja, angelegt hab ich das Ganze wie oben beschrieben mit meinen von Miele zugesandten Api-Account-Daten.

Danke

Reinhard

« Letzte Änderung: 21 März 2019, 20:42:35 von Laffer72 »
Raspberry Pi Rev.B, FB7390 (FHEM2FHEM), Sonos, Smarter Coffee
Osram Lightify:2m LED-Streifen, 5m-LED-Streifen, Gartenspot, Surface 28W, Classic E14,E27, Classic RGBW E27, PAR16 GU10, Plug
CUL868:FS20-ST, FS20-DI, FS20-FMS, FS20-ES1
HMUSB:HM-Sec-RHS,HM-Sec-MDIR2
Jeelink868:TX-29-IT, TFA30.315

Offline amenomade

  • Hero Member
  • *****
  • Beiträge: 4885
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #38 am: 21 März 2019, 20:58:15 »
Die Antwort ist klar:
Zitat
HTTP/1.1 401 Unauthorized

Zeig bitte ein "list" von deinem HTTPMOD und die gesamte Log bei einem "reread".
(! bitte anonymisieren !)
FHEM 5.9 Pi 3, EchoDot, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, und HM Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Online Laffer72

  • Jr. Member
  • **
  • Beiträge: 96
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #39 am: 21 März 2019, 21:17:29 »
Also anbei mein Device:

Internals:
   BUSY       0
   CHANGED   
   DEF        https://api.mcs3.miele.com/v1/devices/00014xxxxxxx/?language=de 120
   FUUID      5c93e23e-f33f-4b02-4e7d-d5430b969307c9cb
   Interval   120
   JSONEnabled 1
   LASTSEND   1553198740.99202
   LastAuthTry 2019-03-21 21:05:37
   MainURL    https://api.mcs3.miele.com/v1/devices/00014xxxxxxx/?language=de
   ModuleVersion 3.5.9 - 13.2.2019
   NAME       miele_waschmaschine
   NOTIFYDEV  global
   NR         268
   NTFY_ORDER 50-miele_waschmaschine
   STATE      ???
   TRIGGERTIME 1553198857.60728
   TRIGGERTIME_FMT 2019-03-21 21:07:37
   TYPE       HTTPMOD
   addr       https://api.mcs3.miele.com:443
   auth       0
   buf       
   code       401
   compress   1
   conn       
   data       
   displayurl https://api.mcs3.miele.com/v1/devices/00014xxxxxxx/?language=de
   header     Authorization: Bearer $sid
Content-Type: application/json
   host       api.mcs3.miele.com
   httpheader HTTP/1.1 401 Unauthorized
Date: Thu, 21 Mar 2019 20:05:41 GMT
Content-Type: text/html
Content-Length: 188
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS
Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
Strict-Transport-Security: max-age=15724800; includeSubDomains
   httpversion 1.0
   hu_blocking 0
   hu_filecount 100
   hu_port    443
   hu_portSfx
   ignoreredirects 0
   loglevel   4
   path       /v1/devices/00014xxxxxxx/?language=de
   protocol   https
   redirects  0
   timeout    2
   url        https://api.mcs3.miele.com/v1/devices/00014xxxxxxxx/?language=de
   value      0
   QUEUE:
   READINGS:
   REQUEST:
     data       
     header     Authorization: Bearer $sid
Content-Type: application/json
     ignoreredirects 0
     retryCount 1
     type       update
     url        https://api.mcs3.miele.com/v1/devices/00014xxxxxxx/?language=de
     value      0
   sslargs:
Attributes:
   enableControlSet 1
   reAuthRegex Unauthorized
   reading01JSON state_remainingTime_0
   reading01Name remainigtime_h
   reading02JSON state_remainingTime_1
   reading02Name remainigtime_m
   reading03JSON state_elapsedTime_0
   reading03Name elapsedtime_h
   reading04JSON state_elapsedTime_1
   reading04Name elapsedtime_m
   reading05JSON state_spinningSpeed
   reading05Name spinningspeed
   reading06JSON state_status_value_raw
   reading06Name state
   requestHeader01 Authorization: Bearer $sid
   requestHeader02 Content-Type: application/json
   sid1URL    https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=X&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
   sid2Data   email=X&password=X&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=X&vgInformationSelector=de-DE
   sid2IdRegex (?s)code=(DE_[0-9a-f]+)
   sid2IgnoreRedirects 1
   sid2URL    https://api.mcs3.miele.com/oauth/auth
   sid3Data   grant_type=authorization_code&code=$sid&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&client_id=X&client_secret=X
   sid3IdJSON access_token
   sid3URL    https://api.mcs3.miele.com/thirdparty/token/
   userattr   reading01JSON reading01Name reading02JSON reading02Name reading03JSON reading03Name reading04JSON reading04Name reading05JSON reading05Name reading06JSON reading06Name requestHeader01 requestHeader02 sid1URL sid2Data sid2IdRegex sid2IgnoreRedirects:0,1 sid2URL sid3Data sid3IdJSON sid3URL
   verbose    3

Log
2019.03.21 21:13:38 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html>\r\n<head><tit...") at (eval 2378) line 1.

2019.03.21 21:13:38 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html lang="de">\n<h...") at (eval 2380) line 1.

2019.03.21 21:13:39 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html lang="de">\n<h...") at (eval 2382) line 1.

2019.03.21 21:13:41 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html>\r\n<head><tit...") at (eval 2386) line 1.

2019.03.21 21:13:41 3: miele_waschmaschine: Read response to update didn't match any Reading
2019.03.21 21:14:38 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html>\r\n<head><tit...") at (eval 2453) line 1.


2019.03.21 21:14:38 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html lang="de">\n<h...") at (eval 2457) line 1.

2019.03.21 21:14:40 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html lang="de">\n<h...") at (eval 2459) line 1.

2019.03.21 21:14:41 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html>\r\n<head><tit...") at (eval 2464) line 1.

2019.03.21 21:14:42 3: miele_waschmaschine: Read response to update didn't match any Reading

Es hat ja bereits funktioniert...ich versteh es einfach nicht.
Raspberry Pi Rev.B, FB7390 (FHEM2FHEM), Sonos, Smarter Coffee
Osram Lightify:2m LED-Streifen, 5m-LED-Streifen, Gartenspot, Surface 28W, Classic E14,E27, Classic RGBW E27, PAR16 GU10, Plug
CUL868:FS20-ST, FS20-DI, FS20-FMS, FS20-ES1
HMUSB:HM-Sec-RHS,HM-Sec-MDIR2
Jeelink868:TX-29-IT, TFA30.315

Offline amenomade

  • Hero Member
  • *****
  • Beiträge: 4885
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #40 am: 21 März 2019, 21:25:35 »
Mit dieser Log kann ich nichts anfangen. Man sieht gar nichts vom Anmeldungsprozess. Ich vermute er kann das Token nicht erneuern

Bitte die vollständige Log nach einem reread mit verbose 5 (auch anonymisiert)
« Letzte Änderung: 21 März 2019, 21:28:33 von amenomade »
FHEM 5.9 Pi 3, EchoDot, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, und HM Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Online Laffer72

  • Jr. Member
  • **
  • Beiträge: 96
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #41 am: 21 März 2019, 21:54:08 »
so jetzt das "lange" Log:
2019.03.21 21:46:02 5: miele_waschmaschine: set called with reread
2019.03.21 21:46:02 4: miele_waschmaschine: GetUpdate called (reread)
2019.03.21 21:46:02 4: miele_waschmaschine: AddToQueue adds update, initial queue len: 0
2019.03.21 21:46:02 5: miele_waschmaschine: AddToQueue adds type update to URL https://api.mcs3.miele.com/v1/devices/X/?language=de, no data, header Authorization: Bearer $sid
Content-Type: application/json, retry 0
2019.03.21 21:46:02 5: miele_waschmaschine: HandleSendQueue called, qlen = 1
2019.03.21 21:46:02 4: miele_waschmaschine: HandleSendQueue sends request type update to URL https://api.mcs3.miele.com/v1/devices/X/?language=de, No Data,
header: Authorization: Bearer $sid
Content-Type: application/json
timeout 2
2019.03.21 21:46:02 5: HttpUtils url=https://api.mcs3.miele.com/v1/devices/X/?language=de
2019.03.21 21:46:02 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.03.21 21:46:02 5: HttpUtils request header:
GET /v1/devices/X/?language=de HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Authorization: Bearer $sid
Content-Type: application/json
Content-Length: 0

2019.03.21 21:46:02 4: https://api.mcs3.miele.com/v1/devices/X/?language=de: HTTP response code 401
2019.03.21 21:46:02 5: HttpUtils https://api.mcs3.miele.com/v1/devices/X/?language=de: Got data, length: 188
2019.03.21 21:46:02 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Thu, 21 Mar 2019 20:46:02 GMT
Content-Type: text/html
Content-Length: 188
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS
Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.03.21 21:46:02 4: miele_waschmaschine: Read callback: request type was update retry 0,
Body: <html>
<head><title>401 Authorization Required</title></head>
<body bgcolor="white">
<center><h1>401 Authorization Required</h1></center>
<hr><center>nginx</center>
</body>
</html>

2019.03.21 21:46:02 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html>\r\n<head><tit...") at (eval 3533) line 1.

2019.03.21 21:46:02 5: miele_waschmaschine: ExtractSid called, context reading, num
2019.03.21 21:46:02 5: miele_waschmaschine: CheckAuth is checking buffer with ReAuthRegex Unauthorized
2019.03.21 21:46:02 4: miele_waschmaschine: CheckAuth decided new authentication required
2019.03.21 21:46:02 4: miele_waschmaschine: Auth called with Steps: 1 2 3
2019.03.21 21:46:02 4: miele_waschmaschine: AddToQueue adds auth3, initial queue len: 0, prio
2019.03.21 21:46:02 5: miele_waschmaschine: AddToQueue prepends type auth3 to URL https://api.mcs3.miele.com/thirdparty/token/, data grant_type=authorization_code&code=$sid&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&client_id=X&client_secret=X, no headers, retry 0
2019.03.21 21:46:02 4: miele_waschmaschine: AddToQueue adds auth2, initial queue len: 1, prio
2019.03.21 21:46:02 5: miele_waschmaschine: AddToQueue prepends type auth2 to URL https://api.mcs3.miele.com/oauth/auth, data email=X&password=X&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=X&vgInformationSelector=de-DE, no headers, ignore redirects, retry 0
2019.03.21 21:46:02 4: miele_waschmaschine: AddToQueue adds auth1, initial queue len: 2, prio
2019.03.21 21:46:02 5: miele_waschmaschine: AddToQueue prepends type auth1 to URL https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=X&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F, no data, no headers, retry 0
2019.03.21 21:46:02 5: miele_waschmaschine: HandleSendQueue called, qlen = 3
2019.03.21 21:46:02 4: miele_waschmaschine: HandleSendQueue sends request type auth1 to URL https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=X&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F, No Data, No Header
timeout 2
2019.03.21 21:46:02 5: HttpUtils url=https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=X&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
2019.03.21 21:46:02 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.03.21 21:46:02 4: miele_waschmaschine: AddToQueue adds update, initial queue len: 2
2019.03.21 21:46:02 5: miele_waschmaschine: AddToQueue adds type update to URL https://api.mcs3.miele.com/v1/devices/X/?language=de, no data, header Authorization: Bearer $sid
Content-Type: application/json, retry 1
2019.03.21 21:46:02 5: miele_waschmaschine: HandleSendQueue called, qlen = 3
2019.03.21 21:46:02 5: miele_waschmaschine: HandleSendQueue - still waiting for reply to last request, delay sending from queue
2019.03.21 21:46:02 4: miele_waschmaschine: CheckAuth requeued request update after auth, retryCount 0 ...
2019.03.21 21:46:02 5: HttpUtils request header:
GET /thirdparty/login/?response_type=code&state=login&client_id=X&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Content-Length: 0
Content-Type: application/x-www-form-urlencoded

2019.03.21 21:46:03 4: https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=X&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F: HTTP response code 200
2019.03.21 21:46:03 5: HttpUtils https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=X&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F: Got data, length: 7388
2019.03.21 21:46:03 5: HttpUtils response header:
HTTP/1.1 200 OK
Date: Thu, 21 Mar 2019 20:46:02 GMT
Content-Type: text/html
Content-Length: 2163
Connection: close
Vary: Accept-Encoding
Content-Encoding: gzip
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.03.21 21:46:03 4: miele_waschmaschine: Read callback: request type was auth1 retry 0,
Body: <html lang="de">
<head>
    <!--Import Google Icon Font-->
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <!--Import materialize.css-->
    <link type="text/css" rel="stylesheet" href="/assets/css/materialize.min.css" media="screen,projection"/>
    <!--Import own css-->
    <link type="text/css" rel="stylesheet" href="/assets/css/mieleStyle.css" media="screen,projection"/>
    <!-- Suppress favicon request-->
    <link rel="shortcut icon" type="image/x-icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABILAAASCwAAAAAAAAAAAAAUAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/EwCL/xMAjP8TAIv/EgCL/xIAi/8TAIv/EgCL/xMAi/8SAIv/EwCL/xIAi/8TAIv/FACM/xQAjP8UAIz/FwON/yYUlf8bCY//KBaW/ysZmP8tG5j/JhSV/y4dmf8mFJX/KxmX/ygVlv8tG5j/JxSV/xQAjP8UAIz/EwCM/x4Lkf+BdsH/nJPO/7Ot2v+aks7/s63a/6Wd0/+9t9//lo3M/7Wv2/+noNT/vbff/5mQzf8mFJX/EwCL/xMAjP8cCJD/qaLV/8C64P+9uN//mpLO/4+GyP9pXLX/hnvE/3Fluv+1rtv/iH/F/4B2wf9zaLv/HQqR/xMAjP8UAIz/FwOO/zMhm/8mFZX/JxaV/y0bmP8fDZL/FwWO/xIAi/8VBI3/MiCa/yIRk/8SAIv/EgCL/xMAjP8UAIz/FACM/xQAjP8SAIv/EwCL/xMAi/8SAIv/EwCM/xQAjP8UAIz/FACM/xIAi/8TAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==">
    <!--Let browser know website is optimized for mobile-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta charset="utf-8">
</head>
<body id="mieleLoginSite">
<div class="mediumBox">
    <div class="center-btn">
        <img class="responsive-img"
             src="/assets/images/miele_logo.svg" width="150">
    </div>
    <h1 class="center-btn mediumFont">Login</h1>
    <form method="post" action="/oauth/auth">
        <div class="input-field">
            <i class="material-icons prefix">account_circle</i>
            <input required id="e-mail" type="email" name="email">
            <label for="e-mail">Email Adress</label>
        </div>
        <div class="input-field">
            <i class="material-icons prefix">https</i>
            <input required id="password" type="password" name="password">
            <label for="password">Password</label>
        </div>
        <input type="hidden" name="redirect_uri" value="https://api.mcs3.miele.com/thirdparty/login/">
        <input type="hidden" name="state" value="login">
        <input type="hidden" name="response_type" value="code">
        <input type="hidden" name="client_id" value="X">

        <div class="input-field">
            <i class="material-icons prefix">language</i>
            <select required name="vgInformationSelector" size="5">
                <option value="" disabled>Please select your country</option>
                <option value="et-EE">Miele Eesti</option>
                <option value="de-DE">Miele Deutschland</option>
                <option value="no-NO">Miele Norge</option>
                <option value="sr-RS">Miele Србија</option>
                <option value="nl-BE">Miele België</option>
                <option value="fi-FI">Miele Suomi</option>
                <option value="zh-HK">Miele Hong Kong</option>
                <option value="ru-RU">Miele Россия</option>
                <option value="en-AE">Miele United Arab Emirates</option>
                <option value="pt-PT">Miele Portugual</option>
                <option value="bg-BG">Miele България</option>
                <option value="de-CH">Miele Schweiz</option>
                <option value="en-IN">Miele India</option>
                <option value="de-SX">Miele Semi Pro</option>
                <option value="ja-JP">Miele Nihon</option>
                <option value="da-DK">Miele Danmark</option>
                <option value="ko-KR">Miele Hanguk</option>
                <option value="en-ZA">Miele South Africa</option>
                <option value="lt-LT">Miele Lietuva</option>
                <option value="es-CL">Miele Chile</option>
                <option value="de-LU">Miele Luxemburg</option>
                <option value="hr-HR">Miele Croatia</option>
                <option value="lv-LV">Miele Latvija</option>
                <option value="zh-CN">Miele Zhōngguó</option>
                <option value="el-GR">Miele Ελλάδα</option>
                <option value="it-IT">Miele Italia</option>
                <option value="es-MX">Miele México</option>
                <option value="fr-FR">Miele France</option>
                <option value="en-MY">Miele Malaysia</option>
                <option value="en-NZ">Miele New Zealand</option>
                <option value="ru-UA">Miele Україна</option>
                <option value="hu-HU">Miele Magyarország</option>
                <option value="es-ES">Miele España</option>
                <option value="ru-KZ">Miele Казахстан</option>
                <option value="sv-SE">Miele Sverige</option>
                <option value="de-AT">Miele Österreich</option>
                <option value="en-AU">Miele Australia</option>
                <option value="en-SG">Miele Singapore</option>
                <option value="en-TH">Miele Thailand</option>
                <option value="el-CY">Miele Kypros</option>
                <option value="sl-SI">Miele Slovenia</option>
                <option value="ru-BY">Miele Беларуси</option>
                <option value="cs-CZ">Miele Czechia</option>
                <option value="sk-SK">Miele Slovensko</option>
                <option value="en-GB">Miele UK</option>
                <option value="en-IE">Miele Ireland</option>
                <option value="pl-PL">Miele Polska</option>
                <option value="ro-RO">Miele România</option>
                <option value="en-CA">Miele Canada</option>
                <option value="nl-NL">Miele Nederland</option>
                <option value="tr-TR">Miele Türkiye</option>
                <option value="en-US">Miele USA</option>
            </select>
            <label>Country</label>
        </div>

        <br>
        <div class="center-btn">
            <input class="waves-effect waves-light btn redButton" type="submit" value="SUBMIT">
        </div>
    </form>
</div>
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="/assets/js/materialize.min.js"></script>
<script>
    $(document).ready(function () {
        $('select').material_select();
    });
</script>
</body>
</html>

2019.03.21 21:46:03 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html lang="de">\n<h...") at (eval 3537) line 1.

2019.03.21 21:46:03 5: miele_waschmaschine: ExtractSid called, context sid, num 1
2019.03.21 21:46:03 5: miele_waschmaschine: HandleSendQueue called, qlen = 3
2019.03.21 21:46:03 4: miele_waschmaschine: HandleSendQueue sends request type auth2 to URL https://api.mcs3.miele.com/oauth/auth,
data: email=X&password=X&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=X&vgInformationSelector=de-DE, No Header
timeout 2
2019.03.21 21:46:03 5: HttpUtils url=https://api.mcs3.miele.com/oauth/auth
2019.03.21 21:46:03 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.03.21 21:46:04 5: HttpUtils request header:
POST /oauth/auth HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Content-Length: 218
Content-Type: application/x-www-form-urlencoded

2019.03.21 21:46:04 4: https://api.mcs3.miele.com/oauth/auth: HTTP response code 401
2019.03.21 21:46:04 5: HttpUtils https://api.mcs3.miele.com/oauth/auth: Got data, length: 2991
2019.03.21 21:46:04 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Thu, 21 Mar 2019 20:46:04 GMT
Content-Type: text/plain
Content-Length: 2991
Connection: close
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.03.21 21:46:04 4: miele_waschmaschine: Read callback: request type was auth2 retry 0,
Body: <html lang="de">
<head>
    <!--Import Google Icon Font-->
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <!--Import materialize.css-->
    <link type="text/css" rel="stylesheet" href="/assets/css/materialize.min.css" media="screen,projection"/>
    <!--Import own css-->
    <link type="text/css" rel="stylesheet" href="/assets/css/mieleStyle.css" media="screen,projection"/>
    <!-- Suppress favicon request-->
    <link rel="shortcut icon" type="image/x-icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABILAAASCwAAAAAAAAAAAAAUAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/EwCL/xMAjP8TAIv/EgCL/xIAi/8TAIv/EgCL/xMAi/8SAIv/EwCL/xIAi/8TAIv/FACM/xQAjP8UAIz/FwON/yYUlf8bCY//KBaW/ysZmP8tG5j/JhSV/y4dmf8mFJX/KxmX/ygVlv8tG5j/JxSV/xQAjP8UAIz/EwCM/x4Lkf+BdsH/nJPO/7Ot2v+aks7/s63a/6Wd0/+9t9//lo3M/7Wv2/+noNT/vbff/5mQzf8mFJX/EwCL/xMAjP8cCJD/qaLV/8C64P+9uN//mpLO/4+GyP9pXLX/hnvE/3Fluv+1rtv/iH/F/4B2wf9zaLv/HQqR/xMAjP8UAIz/FwOO/zMhm/8mFZX/JxaV/y0bmP8fDZL/FwWO/xIAi/8VBI3/MiCa/yIRk/8SAIv/EgCL/xMAjP8UAIz/FACM/xQAjP8SAIv/EwCL/xMAi/8SAIv/EwCM/xQAjP8UAIz/FACM/xIAi/8TAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==">
    <!--Let browser know website is optimized for mobile-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta charset="utf-8">
</head>
<body id="mieleLoginSite">
<div class="mediumBox">
    <!--I tried to move the ugly base64 conversion to java but it didn't work out; original image: images/miele-logo-immer-besser.png-->
    <div class="center-btn">
        <img class="responsive-img"
             src="/assets/images/miele_logo.svg" width="150">
        <h1 class="mediumFont">Kontoverknüpfung fehlgeschlagen!</h1>
        Bitte überprüfen Sie ihre Zugangsdaten.
    </div>
</div>
<!--Import jQuery before materialize.js integrity browser checks with hash if script was modified-->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="/assets/js/materialize.min.js"></script>
</body>
</html>

2019.03.21 21:46:04 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html lang="de">\n<h...") at (eval 3539) line 1.

2019.03.21 21:46:04 5: miele_waschmaschine: ExtractSid called, context sid, num 2
2019.03.21 21:46:04 5: miele_waschmaschine: ExtractSid could not match buffer to IdRegex (?s)code=(DE_[0-9a-f]+)
2019.03.21 21:46:04 5: miele_waschmaschine: HandleSendQueue called, qlen = 2
2019.03.21 21:46:04 4: miele_waschmaschine: HandleSendQueue sends request type auth3 to URL https://api.mcs3.miele.com/thirdparty/token/,
data: grant_type=authorization_code&code=$sid&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&client_id=X&client_secret=X, No Header
timeout 2
2019.03.21 21:46:04 5: HttpUtils url=https://api.mcs3.miele.com/thirdparty/token/
2019.03.21 21:46:04 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.03.21 21:46:04 5: HttpUtils request header:
POST /thirdparty/token/ HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Content-Length: 203
Content-Type: application/x-www-form-urlencoded

2019.03.21 21:46:05 4: https://api.mcs3.miele.com/thirdparty/token/: HTTP response code 500
2019.03.21 21:46:05 5: HttpUtils https://api.mcs3.miele.com/thirdparty/token/: Got data, length: 112
2019.03.21 21:46:05 5: HttpUtils response header:
HTTP/1.1 500 Internal Server Error
Date: Thu, 21 Mar 2019 20:46:04 GMT
Content-Type: application/json
Content-Length: 112
Connection: close
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.03.21 21:46:05 4: miele_waschmaschine: Read callback: request type was auth3 retry 0,
Body: {"status":500,"message":"There was an error processing your request. It has been logged (ID af73ecced4978360)."}
2019.03.21 21:46:05 5: miele_waschmaschine: JSON Flatter called : prefix , ref is HASH(0x6a50e40)
2019.03.21 21:46:05 5: miele_waschmaschine: JSON Flatter sets status to 500
2019.03.21 21:46:05 5: miele_waschmaschine: JSON Flatter sets message to There was an error processing your request. It has been logged (ID af73ecced4978360).
2019.03.21 21:46:05 4: miele_waschmaschine: extracted JSON values to internal
2019.03.21 21:46:05 5: miele_waschmaschine: ExtractSid called, context sid, num 3
2019.03.21 21:46:05 5: miele_waschmaschine: Checking SID with JSON access_token
2019.03.21 21:46:05 5: miele_waschmaschine: HandleSendQueue called, qlen = 1
2019.03.21 21:46:05 4: miele_waschmaschine: HandleSendQueue sends request type update to URL https://api.mcs3.miele.com/v1/devices/X/?language=de, No Data,
header: Authorization: Bearer $sid
Content-Type: application/json
timeout 2
2019.03.21 21:46:05 5: HttpUtils url=https://api.mcs3.miele.com/v1/devices/X/?language=de
2019.03.21 21:46:05 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.03.21 21:46:05 5: HttpUtils request header:
GET /v1/devices/X/?language=de HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Authorization: Bearer $sid
Content-Type: application/json
Content-Length: 0

2019.03.21 21:46:06 4: https://api.mcs3.miele.com/v1/devices/X/?language=de: HTTP response code 401
2019.03.21 21:46:06 5: HttpUtils https://api.mcs3.miele.com/v1/devices/X/?language=de: Got data, length: 188
2019.03.21 21:46:06 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Thu, 21 Mar 2019 20:46:05 GMT
Content-Type: text/html
Content-Length: 188
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS
Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.03.21 21:46:06 4: miele_waschmaschine: Read callback: request type was update retry 1,
Body: <html>
<head><title>401 Authorization Required</title></head>
<body bgcolor="white">
<center><h1>401 Authorization Required</h1></center>
<hr><center>nginx</center>
</body>
</html>

2019.03.21 21:46:06 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html>\r\n<head><tit...") at (eval 3543) line 1.

2019.03.21 21:46:06 5: miele_waschmaschine: ExtractSid called, context reading, num
2019.03.21 21:46:06 5: miele_waschmaschine: CheckAuth is checking buffer with ReAuthRegex Unauthorized
2019.03.21 21:46:06 4: miele_waschmaschine: CheckAuth decided new authentication required
2019.03.21 21:46:06 4: miele_waschmaschine: Authentication still required but no retries left - did last authentication fail?
2019.03.21 21:46:06 5: miele_waschmaschine: Read starts parsing response to update with defined readings: 01,02,03,04,05,06
2019.03.21 21:46:06 5: miele_waschmaschine: ExtractReading remainigtime_h with json state_remainingTime_0 ...
2019.03.21 21:46:06 5: miele_waschmaschine: ExtractReading remainigtime_h did not match
2019.03.21 21:46:06 5: miele_waschmaschine: ExtractReading remainigtime_m with json state_remainingTime_1 ...
2019.03.21 21:46:06 5: miele_waschmaschine: ExtractReading remainigtime_m did not match
2019.03.21 21:46:06 5: miele_waschmaschine: ExtractReading elapsedtime_h with json state_elapsedTime_0 ...
2019.03.21 21:46:06 5: miele_waschmaschine: ExtractReading elapsedtime_h did not match
2019.03.21 21:46:06 5: miele_waschmaschine: ExtractReading elapsedtime_m with json state_elapsedTime_1 ...
2019.03.21 21:46:06 5: miele_waschmaschine: ExtractReading elapsedtime_m did not match
2019.03.21 21:46:06 5: miele_waschmaschine: ExtractReading spinningspeed with json state_spinningSpeed ...
2019.03.21 21:46:06 5: miele_waschmaschine: ExtractReading spinningspeed did not match
2019.03.21 21:46:06 5: miele_waschmaschine: ExtractReading state with json state_status_value_raw ...
2019.03.21 21:46:06 5: miele_waschmaschine: ExtractReading state did not match
2019.03.21 21:46:06 3: miele_waschmaschine: Read response to update didn't match any Reading
2019.03.21 21:46:06 5: miele_waschmaschine: HandleSendQueue called, qlen = 0
Raspberry Pi Rev.B, FB7390 (FHEM2FHEM), Sonos, Smarter Coffee
Osram Lightify:2m LED-Streifen, 5m-LED-Streifen, Gartenspot, Surface 28W, Classic E14,E27, Classic RGBW E27, PAR16 GU10, Plug
CUL868:FS20-ST, FS20-DI, FS20-FMS, FS20-ES1
HMUSB:HM-Sec-RHS,HM-Sec-MDIR2
Jeelink868:TX-29-IT, TFA30.315

Offline amenomade

  • Hero Member
  • *****
  • Beiträge: 4885
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #42 am: 21 März 2019, 22:18:24 »
By post /oauth/auth kriegst Du 401 (unauthorized). Er sollte hier 302 (redirect) kriegen. Danach kann er natürlich nicht weiter.

Also... es gibt ein Problem, aber ich kann im Moment nicht sehen, was es ist.
Bist Du sicher, dass dein client_id in sid02Data korrekt ist?

(bei mir funktioniert es an dieser Stelle. Ich habe allerdings später noch ein anderes Problem)
FHEM 5.9 Pi 3, EchoDot, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, und HM Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Online Laffer72

  • Jr. Member
  • **
  • Beiträge: 96
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #43 am: 21 März 2019, 22:32:37 »
neues Log:

2019.03.21 22:20:50 5: miele_waschmaschine: set called with reread
2019.03.21 22:20:50 4: miele_waschmaschine: GetUpdate called (reread)
2019.03.21 22:20:50 4: miele_waschmaschine: AddToQueue adds update, initial queue len: 0
2019.03.21 22:20:50 5: miele_waschmaschine: AddToQueue adds type update to URL https://api.mcs3.miele.com/v1/devices/X/?language=de, no data, header Authorization: Bearer $sid
Content-Type: application/json, retry 0
2019.03.21 22:20:50 5: miele_waschmaschine: HandleSendQueue called, qlen = 1
2019.03.21 22:20:50 4: miele_waschmaschine: HandleSendQueue sends request type update to URL https://api.mcs3.miele.com/v1/devices/X/?language=de, No Data,
header: Authorization: Bearer $sid
Content-Type: application/json
timeout 2
2019.03.21 22:20:50 5: HttpUtils url=https://api.mcs3.miele.com/v1/devices/X/?language=de
2019.03.21 22:20:50 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.03.21 22:20:50 5: HttpUtils request header:
GET /v1/devices/X/?language=de HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Authorization: Bearer $sid
Content-Type: application/json
Content-Length: 0

2019.03.21 22:20:50 4: https://api.mcs3.miele.com/v1/devices/X/?language=de: HTTP response code 401
2019.03.21 22:20:50 5: HttpUtils https://api.mcs3.miele.com/v1/devices/X/?language=de: Got data, length: 188
2019.03.21 22:20:50 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Thu, 21 Mar 2019 21:20:50 GMT
Content-Type: text/html
Content-Length: 188
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS
Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.03.21 22:20:50 4: miele_waschmaschine: Read callback: request type was update retry 0,
Body: <html>
<head><title>401 Authorization Required</title></head>
<body bgcolor="white">
<center><h1>401 Authorization Required</h1></center>
<hr><center>nginx</center>
</body>
</html>

2019.03.21 22:20:50 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html>\r\n<head><tit...") at (eval 4378) line 1.

2019.03.21 22:20:50 5: miele_waschmaschine: ExtractSid called, context reading, num
2019.03.21 22:20:50 5: miele_waschmaschine: CheckAuth is checking buffer with ReAuthRegex Unauthorized
2019.03.21 22:20:50 4: miele_waschmaschine: CheckAuth decided new authentication required
2019.03.21 22:20:50 4: miele_waschmaschine: Auth called with Steps: 1 2 3
2019.03.21 22:20:50 4: miele_waschmaschine: AddToQueue adds auth3, initial queue len: 0, prio
2019.03.21 22:20:50 5: miele_waschmaschine: AddToQueue prepends type auth3 to URL https://api.mcs3.miele.com/thirdparty/token/, data grant_type=authorization_code&code=$sid&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&client_id=X&client_secret=X, no headers, retry 0
2019.03.21 22:20:50 4: miele_waschmaschine: AddToQueue adds auth2, initial queue len: 1, prio
2019.03.21 22:20:50 5: miele_waschmaschine: AddToQueue prepends type auth2 to URL https://api.mcs3.miele.com/oauth/auth, data email=X&password=X&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=X&vgInformationSelector=de-DE, no headers, ignore redirects, retry 0
2019.03.21 22:20:50 4: miele_waschmaschine: AddToQueue adds auth1, initial queue len: 2, prio
2019.03.21 22:20:50 5: miele_waschmaschine: AddToQueue prepends type auth1 to URL https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=X&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F, no data, no headers, retry 0
2019.03.21 22:20:50 5: miele_waschmaschine: HandleSendQueue called, qlen = 3
2019.03.21 22:20:50 4: miele_waschmaschine: HandleSendQueue sends request type auth1 to URL https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=X&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F, No Data, No Header
timeout 2
2019.03.21 22:20:50 5: HttpUtils url=https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=X&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
2019.03.21 22:20:51 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.03.21 22:20:51 4: miele_waschmaschine: AddToQueue adds update, initial queue len: 2
2019.03.21 22:20:51 5: miele_waschmaschine: AddToQueue adds type update to URL https://api.mcs3.miele.com/v1/devices/X/?language=de, no data, header Authorization: Bearer $sid
Content-Type: application/json, retry 1
2019.03.21 22:20:51 5: miele_waschmaschine: HandleSendQueue called, qlen = 3
2019.03.21 22:20:51 5: miele_waschmaschine: HandleSendQueue - still waiting for reply to last request, delay sending from queue
2019.03.21 22:20:51 4: miele_waschmaschine: CheckAuth requeued request update after auth, retryCount 0 ...
2019.03.21 22:20:51 5: HttpUtils request header:
GET /thirdparty/login/?response_type=code&state=login&client_id=X&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Content-Length: 0
Content-Type: application/x-www-form-urlencoded

2019.03.21 22:20:51 4: https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=X&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F: HTTP response code 200
2019.03.21 22:20:51 5: HttpUtils https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=X&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F: Got data, length: 7388
2019.03.21 22:20:51 5: HttpUtils response header:
HTTP/1.1 200 OK
Date: Thu, 21 Mar 2019 21:20:51 GMT
Content-Type: text/html
Content-Length: 2163
Connection: close
Vary: Accept-Encoding
Content-Encoding: gzip
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.03.21 22:20:51 4: miele_waschmaschine: Read callback: request type was auth1 retry 0,
Body: <html lang="de">
<head>
    <!--Import Google Icon Font-->
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <!--Import materialize.css-->
    <link type="text/css" rel="stylesheet" href="/assets/css/materialize.min.css" media="screen,projection"/>
    <!--Import own css-->
    <link type="text/css" rel="stylesheet" href="/assets/css/mieleStyle.css" media="screen,projection"/>
    <!-- Suppress favicon request-->
    <link rel="shortcut icon" type="image/x-icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABILAAASCwAAAAAAAAAAAAAUAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/EwCL/xMAjP8TAIv/EgCL/xIAi/8TAIv/EgCL/xMAi/8SAIv/EwCL/xIAi/8TAIv/FACM/xQAjP8UAIz/FwON/yYUlf8bCY//KBaW/ysZmP8tG5j/JhSV/y4dmf8mFJX/KxmX/ygVlv8tG5j/JxSV/xQAjP8UAIz/EwCM/x4Lkf+BdsH/nJPO/7Ot2v+aks7/s63a/6Wd0/+9t9//lo3M/7Wv2/+noNT/vbff/5mQzf8mFJX/EwCL/xMAjP8cCJD/qaLV/8C64P+9uN//mpLO/4+GyP9pXLX/hnvE/3Fluv+1rtv/iH/F/4B2wf9zaLv/HQqR/xMAjP8UAIz/FwOO/zMhm/8mFZX/JxaV/y0bmP8fDZL/FwWO/xIAi/8VBI3/MiCa/yIRk/8SAIv/EgCL/xMAjP8UAIz/FACM/xQAjP8SAIv/EwCL/xMAi/8SAIv/EwCM/xQAjP8UAIz/FACM/xIAi/8TAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==">
    <!--Let browser know website is optimized for mobile-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta charset="utf-8">
</head>
<body id="mieleLoginSite">
<div class="mediumBox">
    <div class="center-btn">
        <img class="responsive-img"
             src="/assets/images/miele_logo.svg" width="150">
    </div>
    <h1 class="center-btn mediumFont">Login</h1>
    <form method="post" action="/oauth/auth">
        <div class="input-field">
            <i class="material-icons prefix">account_circle</i>
            <input required id="e-mail" type="email" name="email">
            <label for="e-mail">Email Adress</label>
        </div>
        <div class="input-field">
            <i class="material-icons prefix">https</i>
            <input required id="password" type="password" name="password">
            <label for="password">Password</label>
        </div>
        <input type="hidden" name="redirect_uri" value="https://api.mcs3.miele.com/thirdparty/login/">
        <input type="hidden" name="state" value="login">
        <input type="hidden" name="response_type" value="code">
        <input type="hidden" name="client_id" value="X">

        <div class="input-field">
            <i class="material-icons prefix">language</i>
            <select required name="vgInformationSelector" size="5">
                <option value="" disabled>Please select your country</option>
                <option value="et-EE">Miele Eesti</option>
                <option value="de-DE">Miele Deutschland</option>
                <option value="no-NO">Miele Norge</option>
                <option value="sr-RS">Miele Србија</option>
                <option value="nl-BE">Miele België</option>
                <option value="fi-FI">Miele Suomi</option>
                <option value="zh-HK">Miele Hong Kong</option>
                <option value="ru-RU">Miele Россия</option>
                <option value="en-AE">Miele United Arab Emirates</option>
                <option value="pt-PT">Miele Portugual</option>
                <option value="bg-BG">Miele България</option>
                <option value="de-CH">Miele Schweiz</option>
                <option value="en-IN">Miele India</option>
                <option value="de-SX">Miele Semi Pro</option>
                <option value="ja-JP">Miele Nihon</option>
                <option value="da-DK">Miele Danmark</option>
                <option value="ko-KR">Miele Hanguk</option>
                <option value="en-ZA">Miele South Africa</option>
                <option value="lt-LT">Miele Lietuva</option>
                <option value="es-CL">Miele Chile</option>
                <option value="de-LU">Miele Luxemburg</option>
                <option value="hr-HR">Miele Croatia</option>
                <option value="lv-LV">Miele Latvija</option>
                <option value="zh-CN">Miele Zhōngguó</option>
                <option value="el-GR">Miele Ελλάδα</option>
                <option value="it-IT">Miele Italia</option>
                <option value="es-MX">Miele México</option>
                <option value="fr-FR">Miele France</option>
                <option value="en-MY">Miele Malaysia</option>
                <option value="en-NZ">Miele New Zealand</option>
                <option value="ru-UA">Miele Україна</option>
                <option value="hu-HU">Miele Magyarország</option>
                <option value="es-ES">Miele España</option>
                <option value="ru-KZ">Miele Казахстан</option>
                <option value="sv-SE">Miele Sverige</option>
                <option value="de-AT">Miele Österreich</option>
                <option value="en-AU">Miele Australia</option>
                <option value="en-SG">Miele Singapore</option>
                <option value="en-TH">Miele Thailand</option>
                <option value="el-CY">Miele Kypros</option>
                <option value="sl-SI">Miele Slovenia</option>
                <option value="ru-BY">Miele Беларуси</option>
                <option value="cs-CZ">Miele Czechia</option>
                <option value="sk-SK">Miele Slovensko</option>
                <option value="en-GB">Miele UK</option>
                <option value="en-IE">Miele Ireland</option>
                <option value="pl-PL">Miele Polska</option>
                <option value="ro-RO">Miele România</option>
                <option value="en-CA">Miele Canada</option>
                <option value="nl-NL">Miele Nederland</option>
                <option value="tr-TR">Miele Türkiye</option>
                <option value="en-US">Miele USA</option>
            </select>
            <label>Country</label>
        </div>

        <br>
        <div class="center-btn">
            <input class="waves-effect waves-light btn redButton" type="submit" value="SUBMIT">
        </div>
    </form>
</div>
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="/assets/js/materialize.min.js"></script>
<script>
    $(document).ready(function () {
        $('select').material_select();
    });
</script>
</body>
</html>

2019.03.21 22:20:51 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html lang="de">\n<h...") at (eval 4382) line 1.

2019.03.21 22:20:51 5: miele_waschmaschine: ExtractSid called, context sid, num 1
2019.03.21 22:20:52 5: miele_waschmaschine: HandleSendQueue called, qlen = 3
2019.03.21 22:20:52 4: miele_waschmaschine: HandleSendQueue sends request type auth2 to URL https://api.mcs3.miele.com/oauth/auth,
data: email=X&password=X&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=X&vgInformationSelector=de-DE, No Header
timeout 2
2019.03.21 22:20:52 5: HttpUtils url=https://api.mcs3.miele.com/oauth/auth
2019.03.21 22:20:52 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.03.21 22:20:52 5: HttpUtils request header:
POST /oauth/auth HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Content-Length: 214
Content-Type: application/x-www-form-urlencoded

2019.03.21 22:20:52 4: https://api.mcs3.miele.com/oauth/auth: HTTP response code 401
2019.03.21 22:20:52 5: HttpUtils https://api.mcs3.miele.com/oauth/auth: Got data, length: 2991
2019.03.21 22:20:52 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Thu, 21 Mar 2019 21:20:52 GMT
Content-Type: text/plain
Content-Length: 2991
Connection: close
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.03.21 22:20:52 4: miele_waschmaschine: Read callback: request type was auth2 retry 0,
Body: <html lang="de">
<head>
    <!--Import Google Icon Font-->
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <!--Import materialize.css-->
    <link type="text/css" rel="stylesheet" href="/assets/css/materialize.min.css" media="screen,projection"/>
    <!--Import own css-->
    <link type="text/css" rel="stylesheet" href="/assets/css/mieleStyle.css" media="screen,projection"/>
    <!-- Suppress favicon request-->
    <link rel="shortcut icon" type="image/x-icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABILAAASCwAAAAAAAAAAAAAUAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/EwCL/xMAjP8TAIv/EgCL/xIAi/8TAIv/EgCL/xMAi/8SAIv/EwCL/xIAi/8TAIv/FACM/xQAjP8UAIz/FwON/yYUlf8bCY//KBaW/ysZmP8tG5j/JhSV/y4dmf8mFJX/KxmX/ygVlv8tG5j/JxSV/xQAjP8UAIz/EwCM/x4Lkf+BdsH/nJPO/7Ot2v+aks7/s63a/6Wd0/+9t9//lo3M/7Wv2/+noNT/vbff/5mQzf8mFJX/EwCL/xMAjP8cCJD/qaLV/8C64P+9uN//mpLO/4+GyP9pXLX/hnvE/3Fluv+1rtv/iH/F/4B2wf9zaLv/HQqR/xMAjP8UAIz/FwOO/zMhm/8mFZX/JxaV/y0bmP8fDZL/FwWO/xIAi/8VBI3/MiCa/yIRk/8SAIv/EgCL/xMAjP8UAIz/FACM/xQAjP8SAIv/EwCL/xMAi/8SAIv/EwCM/xQAjP8UAIz/FACM/xIAi/8TAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/FACM/xQAjP8UAIz/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==">
    <!--Let browser know website is optimized for mobile-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta charset="utf-8">
</head>
<body id="mieleLoginSite">
<div class="mediumBox">
    <!--I tried to move the ugly base64 conversion to java but it didn't work out; original image: images/miele-logo-immer-besser.png-->
    <div class="center-btn">
        <img class="responsive-img"
             src="/assets/images/miele_logo.svg" width="150">
        <h1 class="mediumFont">Kontoverknüpfung fehlgeschlagen!</h1>
        Bitte überprüfen Sie ihre Zugangsdaten.
    </div>
</div>
<!--Import jQuery before materialize.js integrity browser checks with hash if script was modified-->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="/assets/js/materialize.min.js"></script>
</body>
</html>

2019.03.21 22:20:52 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html lang="de">\n<h...") at (eval 4384) line 1.

2019.03.21 22:20:52 5: miele_waschmaschine: ExtractSid called, context sid, num 2
2019.03.21 22:20:52 5: miele_waschmaschine: ExtractSid could not match buffer to IdRegex (?s)code=(DE_[0-9a-f]+)
2019.03.21 22:20:53 5: miele_waschmaschine: HandleSendQueue called, qlen = 2
2019.03.21 22:20:53 4: miele_waschmaschine: HandleSendQueue sends request type auth3 to URL https://api.mcs3.miele.com/thirdparty/token/,
data: grant_type=authorization_code&code=$sid&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&client_id=X&client_secret=X, No Header
timeout 2
2019.03.21 22:20:53 5: HttpUtils url=https://api.mcs3.miele.com/thirdparty/token/
2019.03.21 22:20:53 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.03.21 22:20:53 5: HttpUtils request header:
POST /thirdparty/token/ HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Content-Length: 203
Content-Type: application/x-www-form-urlencoded

2019.03.21 22:20:53 4: https://api.mcs3.miele.com/thirdparty/token/: HTTP response code 500
2019.03.21 22:20:53 5: HttpUtils https://api.mcs3.miele.com/thirdparty/token/: Got data, length: 112
2019.03.21 22:20:53 5: HttpUtils response header:
HTTP/1.1 500 Internal Server Error
Date: Thu, 21 Mar 2019 21:20:53 GMT
Content-Type: application/json
Content-Length: 112
Connection: close
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.03.21 22:20:53 4: miele_waschmaschine: Read callback: request type was auth3 retry 0,
Body: {"status":500,"message":"There was an error processing your request. It has been logged (ID 4e6e9250a141ebdc)."}
2019.03.21 22:20:53 5: miele_waschmaschine: JSON Flatter called : prefix , ref is HASH(0x438c7a8)
2019.03.21 22:20:53 5: miele_waschmaschine: JSON Flatter sets status to 500
2019.03.21 22:20:53 5: miele_waschmaschine: JSON Flatter sets message to There was an error processing your request. It has been logged (ID 4e6e9250a141ebdc).
2019.03.21 22:20:53 4: miele_waschmaschine: extracted JSON values to internal
2019.03.21 22:20:53 5: miele_waschmaschine: ExtractSid called, context sid, num 3
2019.03.21 22:20:53 5: miele_waschmaschine: Checking SID with JSON access_token
2019.03.21 22:20:54 5: miele_waschmaschine: HandleSendQueue called, qlen = 1
2019.03.21 22:20:54 4: miele_waschmaschine: HandleSendQueue sends request type update to URL https://api.mcs3.miele.com/v1/devices/X/?language=de, No Data,
header: Authorization: Bearer $sid
Content-Type: application/json
timeout 2
2019.03.21 22:20:54 5: HttpUtils url=https://api.mcs3.miele.com/v1/devices/X/?language=de
2019.03.21 22:20:54 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.03.21 22:20:54 5: HttpUtils request header:
GET /v1/devices/X/?language=de HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Authorization: Bearer $sid
Content-Type: application/json
Content-Length: 0

2019.03.21 22:20:54 4: https://api.mcs3.miele.com/v1/devices/X/?language=de: HTTP response code 401
2019.03.21 22:20:54 5: HttpUtils https://api.mcs3.miele.com/v1/devices/X/?language=de: Got data, length: 188
2019.03.21 22:20:54 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Thu, 21 Mar 2019 21:20:54 GMT
Content-Type: text/html
Content-Length: 188
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS
Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.03.21 22:20:54 4: miele_waschmaschine: Read callback: request type was update retry 1,
Body: <html>
<head><title>401 Authorization Required</title></head>
<body bgcolor="white">
<center><h1>401 Authorization Required</h1></center>
<hr><center>nginx</center>
</body>
</html>

2019.03.21 22:20:54 3: miele_waschmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html>\r\n<head><tit...") at (eval 4388) line 1.

2019.03.21 22:20:54 5: miele_waschmaschine: ExtractSid called, context reading, num
2019.03.21 22:20:54 5: miele_waschmaschine: CheckAuth is checking buffer with ReAuthRegex Unauthorized
2019.03.21 22:20:54 4: miele_waschmaschine: CheckAuth decided new authentication required
2019.03.21 22:20:54 4: miele_waschmaschine: Authentication still required but no retries left - did last authentication fail?
2019.03.21 22:20:54 5: miele_waschmaschine: Read starts parsing response to update with defined readings: 01,02,03,04,05,06
2019.03.21 22:20:54 5: miele_waschmaschine: ExtractReading remainigtime_h with json state_remainingTime_0 ...
2019.03.21 22:20:54 5: miele_waschmaschine: ExtractReading remainigtime_h did not match
2019.03.21 22:20:54 5: miele_waschmaschine: ExtractReading remainigtime_m with json state_remainingTime_1 ...
2019.03.21 22:20:54 5: miele_waschmaschine: ExtractReading remainigtime_m did not match
2019.03.21 22:20:54 5: miele_waschmaschine: ExtractReading elapsedtime_h with json state_elapsedTime_0 ...
2019.03.21 22:20:54 5: miele_waschmaschine: ExtractReading elapsedtime_h did not match
2019.03.21 22:20:54 5: miele_waschmaschine: ExtractReading elapsedtime_m with json state_elapsedTime_1 ...
2019.03.21 22:20:54 5: miele_waschmaschine: ExtractReading elapsedtime_m did not match
2019.03.21 22:20:54 5: miele_waschmaschine: ExtractReading spinningspeed with json state_spinningSpeed ...
2019.03.21 22:20:54 5: miele_waschmaschine: ExtractReading spinningspeed did not match
2019.03.21 22:20:54 5: miele_waschmaschine: ExtractReading state with json state_status_value_raw ...
2019.03.21 22:20:54 5: miele_waschmaschine: ExtractReading state did not match
2019.03.21 22:20:54 3: miele_waschmaschine: Read response to update didn't match any Reading
2019.03.21 22:20:54 5: miele_waschmaschine: HandleSendQueue called, qlen = 0

Hatte in der sid02 bei Mail und Passwort versucht Sonderzeichen (@ und #) zu maskieren, habs jetzt wieder rückgängig gemacht. Es funktioniert aber trotzdem nicht (siehe log oben).
Raspberry Pi Rev.B, FB7390 (FHEM2FHEM), Sonos, Smarter Coffee
Osram Lightify:2m LED-Streifen, 5m-LED-Streifen, Gartenspot, Surface 28W, Classic E14,E27, Classic RGBW E27, PAR16 GU10, Plug
CUL868:FS20-ST, FS20-DI, FS20-FMS, FS20-ES1
HMUSB:HM-Sec-RHS,HM-Sec-MDIR2
Jeelink868:TX-29-IT, TFA30.315

Offline amenomade

  • Hero Member
  • *****
  • Beiträge: 4885
Antw:Miele 3rd party API in FHEM einbinden
« Antwort #44 am: 21 März 2019, 23:27:08 »
Wenn Du folgende URL in einem Browser eingibst:
https://api.mcs3.miele.com/thirdparty/login/?client_id=zzzDEIN_CLIENTIDzzzz&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=codedann dort dein User, Passwort, und Land eingibst, kriegst Du dann in der URL wo Du weitergeleitet wirst so ein Code:
?code=DE_faa74agd2f919e2bf3e88fe1adf68f4c?
FHEM 5.9 Pi 3, EchoDot, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, und HM Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus