FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: xerion am 16 Januar 2019, 22:26:52

Titel: Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 16 Januar 2019, 22:26:52
Hallo liebe FHEM-Gemeinde,

ich bin noch ziemlich frisch in der FHEM Welt unterwegs, konnte mir aber dank euch schon viele nützliche Features implementieren. Da ich leider kein Programmier bin, bin ich umso dankbarer das es dieses Forum gibt. Viele Anfänger Probleme konnte ich mit dem Forum lösen aber bei einer Implementierung komme ich einfach nicht weiter. Das Projekt, was ich vorhabe ist, sobald meine PV-Anlage entsprechend Überstrom produziert, dass die Waschmaschine eingeschaltet wird. Ich habe einen Speicher von SENEC und habe über HTTPMOD auch schon die Möglichkeit gefunden den Befehl zu bekommen. Nun möchte ich aber diesen Befehl nutzen um die Waschmaschine zu einzuschalten. Seit kurzen ist es möglich, dass man über die Miele API (https://www.miele.com/developer/swagger-ui/index.html#/) auch PUT Befehle senden kann. Über das Tool Postman konnte ich auch schon erfolgreich die API ansprechen und die Waschmaschine auslesen und fernsteuern. Zusätzlich habe ich die Kommunikation mit Burp Suite abgefangen. Es gibt zwar im Netz schon unterschiedliche PHP Skripte, aber entweder funktionieren die nicht mehr wegen geänderten Loginverfahren, oder sind speziell für andere System geschrieben oder können die PUT Befehl noch nicht umsetzen. Daher möchte ich es unabhängig von anderen Skripten, direkt in FHEM umsetzen, sofern das möglich ist.

Hier der Burp Auszug vom GET Befehl:
GET /v1/devices/?language=de HTTP/1.1
cache-control: no-cache
Postman-Token: xxxxxxxxxxxxxxxxxxxxxxxx
Authorization: Bearer DE_xxxxxxxxxxxxxxxxxxxxx
User-Agent: PostmanRuntime/7.6.0
Accept: */*
Host: api.mcs3.miele.com
Accept-Encoding: gzip, deflate
Connection: close


Hier der Burp Auszug vom PUT Befehl:
PUT /v1/devices/000149130299/actions HTTP/1.1
Content-Type: application/json
cache-control: no-cache
Postman-Token: xxxxxxxxxxxxxxxxxxx
Authorization: Bearer DE_xxxxxxxxxxxxxxxxxxxx
User-Agent: PostmanRuntime/7.6.0
Accept: */*
Host: api.mcs3.miele.com
Accept-Encoding: gzip, deflate
Content-Length: 19
Connection: close

{"processAction":1}


PS: Die Tokens wurden unkenntlich gemacht


Da die API aber OAUTH2 Authentifizierung nutzt, habe ich leider nichts passendes im Forum gefunden was ich für die Umsetzung nutzen kann. Meine erste Idee war, es über HTTPMOD umzusetzen. Dort bekomme ich aber immer wieder den Fehler {"code":415,"message":"HTTP 415 Unsupported Media Type"}

defmod Miele_API HTTPMOD https://api.mcs3.miele.com 60
attr Miele_API userattr get01Name get01Poll:0,1 get01URL getHeader1 requestHeader1
attr Miele_API enableControlSet 1
attr Miele_API get01Name data
attr Miele_API get01Poll 1
attr Miele_API get01URL https://api.mcs3.miele.com/v1/devices/?language=de
attr Miele_API getHeader1 Authorization: Bearer DE_xxxxxxxxxxxxxxxxx
attr Miele_API httpVersion 1.1
attr Miele_API reading01RegOpt s
attr Miele_API reading01Regex ^(.*)$
attr Miele_API requestHeader1 Authorization: Bearer DE_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
attr Miele_API room Waschmaschine
attr Miele_API verbose 5

setstate Miele_API 2019-01-16 21:47:35 reading01 HTTP/1.1 415 Unsupported Media Type
\
Date: Wed, 16 Jan 2019 20:47:35 GMT
\
Content-Type: application/json
\
Content-Length: 56
\
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
\

\
{"code":415,"message":"HTTP 415 Unsupported Media Type"}


Ich scheitere schon daran nur die Abfrage vom Status hinzubekommen, und mit der Authentifizierung bzw, Refresh Token habe ich mich noch nicht mal befasst, da der Token erstmal eine Gültigkeit von 30 Tagen hat. ;-)
Ich hoffe das mir jemand helfen kann und die Informationen für den Anfang ausreichen.
Ich denke das es mehrere Leute gibt die gerne die API von Miele über FHEM ansteuern möchten.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 16 Januar 2019, 22:58:43
ZitatHTTP 415 Unsupported Media Type
Setz mal ein Header mit Content-Type: application/json
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 16 Januar 2019, 23:03:22
Und attr enableCookies könnte für oauth2 helfen.
Wenn es nicht reicht, dann bite ein vollständiges "list" des HTTPMOD Devices und Log Auszug mit verbose 5 bitte (natürlich anonymsiert)
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 17 Januar 2019, 20:30:38
Hallo amenomade, danke für deine schnelle Rückmeldung. Leider haben die beiden Settings keine Verbesserung gebracht.

Hier der Auszug von "list":
Internals:
   BUSY       0
   DEF        https://api.mcs3.miele.com 60
   Interval   60
   LASTSEND   1547752867.82202
   MainURL    https://api.mcs3.miele.com
   ModuleVersion 3.5.4 - 9.11.2018
   NAME       Miele_API
   NR         78
   STATE      ???
   TRIGGERTIME 1547752926.80505
   TRIGGERTIME_FMT 2019-01-17 20:22:06
   TYPE       HTTPMOD
   addr       https://api.mcs3.miele.com:443
   auth       0
   buf       
   code       415
   compress   1
   conn       
   data       
   displayurl https://api.mcs3.miele.com/v1/devices/?language=de
   header     Authorization: Bearer DE_??????????????????????????ßß
   host       api.mcs3.miele.com
   httpheader HTTP/1.1 415 Unsupported Media Type
Date: Thu, 17 Jan 2019 19:21:07 GMT
Content-Type: application/json
Content-Length: 56
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.1
   hu_blocking 0
   hu_filecount 864
   hu_port    443
   hu_portSfx
   ignoreredirects 0
   loglevel   4
   path       /v1/devices/?language=de
   protocol   https
   redirects  0
   timeout    2
   url        https://api.mcs3.miele.com/v1/devices/?language=de
   value      0
   QUEUE:
   READINGS:
     2019-01-17 20:21:07   reading01       HTTP/1.1 415 Unsupported Media Type
Date: Thu, 17 Jan 2019 19:21:07 GMT
Content-Type: application/json
Content-Length: 56
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

{"code":415,"message":"HTTP 415 Unsupported Media Type"}
   REQUEST:
     data       
     header     Authorization: Bearer DE_?????????????????????????
     ignoreredirects 0
     retryCount 0
     type       get01
     url        https://api.mcs3.miele.com/v1/devices/?language=de
     value      0
   defptr:
     readingBase:
       reading01  reading
     readingNum:
       reading01  01
     readingOutdated:
     requestReadings:
       get01:
         reading01  reading 01
   lastpoll:
     data       1547752866.80353
   sslargs:
Attributes:
   enableControlSet 1
   enableCookies 1
   get01Name  data
   get01Poll  1
   get01URL   https://api.mcs3.miele.com/v1/devices/?language=de
   getHeader1 Authorization: Bearer DE_???????????????????????????????????
   httpVersion 1.1
   reading01RegOpt s
   reading01Regex ^(.*)$
   requestHeader1 Authorization: Bearer DE_???????????????????????????????
   requestHeader2 Content-Type: application/json
   room       Waschmaschine
   userattr   get01Name get01Poll:0,1 get01URL getHeader1 reading01RegOpt reading01Regex requestHeader1 requestHeader2
   verbose    5


und vom Logfile:2019.01.17 20:27:05 5 : Miele_API: get called with data
2019.01.17 20:27:05 5 : Miele_API: get found option data in attribute get01Name
2019.01.17 20:27:05 4 : Miele_API: get will now request data, no optional value
2019.01.17 20:27:05 4 : Miele_API: AddToQueue adds get01, initial queue len: 0
2019.01.17 20:27:05 5 : Miele_API: AddToQueue adds type get01 to URL https://api.mcs3.miele.com/v1/devices/?language=de, no data, header Authorization: Bearer DE_???????????????????????????????????, retry 0
2019.01.17 20:27:05 5 : Miele_API: HandleSendQueue called, qlen = 1
2019.01.17 20:27:05 4 : Miele_API: HandleSendQueue sends request type get01 to URL https://api.mcs3.miele.com/v1/devices/?language=de, No Data, header: Authorization: Bearer DE_??????????????????????????????????? timeout 2
2019.01.17 20:27:05 5 : HttpUtils url=https://api.mcs3.miele.com/v1/devices/?language=de
2019.01.17 20:27:05 4 : IP: api.mcs3.miele.com -> 157.97.106.171
2019.01.17 20:27:05 5 : HttpUtils request header: GET /v1/devices/?language=de HTTP/1.1 Host: api.mcs3.miele.com User-Agent: fhem Accept-Encoding: gzip,deflate Connection: Close Authorization: Bearer DE_??????????????????????????????????? Content-Length: 0 Content-Type: application/x-www-form-urlencoded
2019.01.17 20:27:05 4 : https://api.mcs3.miele.com/v1/devices/?language=de: HTTP response code 415
2019.01.17 20:27:05 5 : HttpUtils https://api.mcs3.miele.com/v1/devices/?language=de: Got data, length: 56
2019.01.17 20:27:05 5 : HttpUtils response header: HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 19:27:05 GMT Content-Type: application/json Content-Length: 56 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.01.17 20:27:05 4 : Miele_API: Read callback: request type was get01 retry 0, Body: {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 20:27:05 5 : Miele_API: GetCookies is looking for Cookies
2019.01.17 20:27:05 5 : Miele_API: ExtractSid called, context get, num 01
2019.01.17 20:27:05 4 : Miele_API: CheckAuth decided no authentication required
2019.01.17 20:27:05 5 : Miele_API: ExtractReading for context get, num 01 - no individual parse definition
2019.01.17 20:27:05 5 : Miele_API: Read starts parsing response to get01 with defined readings: 01
2019.01.17 20:27:05 5 : Miele_API: ExtractReading reading01 with regex /^(.*)$/s ...
2019.01.17 20:27:05 5 : Miele_API: 1 capture group(s), matchlist = HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 19:27:05 GMT Content-Type: application/json Content-Length: 56 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 {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 20:27:05 4 : Miele_API: ExtractReading for reading01-1 sets reading01 to HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 19:27:05 GMT Content-Type: application/json Content-Length: 56 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 {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 20:27:05 4 : Miele_API: Read response to get01 matched Reading(s) reading01
2019-01-17 20:27:05 HTTPMOD Miele_API reading01: HTTP/1.1 415 Unsupported Media Type  Date: Thu, 17 Jan 2019 19:27:05 GMT  Content-Type: application/json  Content-Length: 56  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    {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 20:27:05 5 : Miele_API: HandleSendQueue called, qlen = 0
2019.01.17 20:27:06 4 : Miele_API: GetUpdate called (update)
2019.01.17 20:27:06 4 : Miele_API: update timer modified: will call GetUpdate in 60.0 seconds at 2019-01-17 20:28:06
2019.01.17 20:27:06 4 : Miele_API: AddToQueue adds update, initial queue len: 0
2019.01.17 20:27:06 5 : Miele_API: AddToQueue adds type update to URL https://api.mcs3.miele.com, no data, header Authorization: Bearer DE_??????????????????????????????????? Content-Type: application/json, retry 0
2019.01.17 20:27:06 5 : Miele_API: HandleSendQueue called, qlen = 1
2019.01.17 20:27:06 4 : Miele_API: HandleSendQueue sends request type update to URL https://api.mcs3.miele.com, No Data, header: Authorization: Bearer DE_??????????????????????????????????? Content-Type: application/json timeout 2
2019.01.17 20:27:06 5 : HttpUtils url=https://api.mcs3.miele.com
2019.01.17 20:27:06 3 : Miele_API: Read callback: Error: https://api.mcs3.miele.com: malformed or unsupported URL
2019.01.17 20:27:06 4 : Miele_API: Read callback: request type was update retry 0, body empty
2019.01.17 20:27:06 5 : Miele_API: GetCookies is looking for Cookies
2019.01.17 20:27:06 5 : Miele_API: ExtractSid called, context reading, num
2019.01.17 20:27:06 4 : Miele_API: CheckAuth decided no authentication required
2019.01.17 20:27:06 5 : Miele_API: GetUpdate checks if poll required for data (01)
2019.01.17 20:27:06 4 : Miele_API: GetUpdate will request data
2019.01.17 20:27:06 4 : Miele_API: AddToQueue adds get01, initial queue len: 0
2019.01.17 20:27:06 5 : Miele_API: AddToQueue adds type get01 to URL https://api.mcs3.miele.com/v1/devices/?language=de, no data, header Authorization: Bearer DE_???????????????????????????????????, retry 0
2019.01.17 20:27:06 5 : Miele_API: HandleSendQueue called, qlen = 1
2019.01.17 20:27:06 5 : Miele_API: HandleSendQueue - minSendDelay not over, rescheduling
2019.01.17 20:27:07 5 : Miele_API: HandleSendQueue called, qlen = 1
2019.01.17 20:27:07 4 : Miele_API: HandleSendQueue sends request type get01 to URL https://api.mcs3.miele.com/v1/devices/?language=de, No Data, header: Authorization: Bearer DE_??????????????????????????????????? timeout 2
2019.01.17 20:27:07 5 : HttpUtils url=https://api.mcs3.miele.com/v1/devices/?language=de
2019.01.17 20:27:07 4 : IP: api.mcs3.miele.com -> 157.97.106.171
2019.01.17 20:27:07 5 : HttpUtils request header: GET /v1/devices/?language=de HTTP/1.1 Host: api.mcs3.miele.com User-Agent: fhem Accept-Encoding: gzip,deflate Connection: Close Authorization: Bearer DE_??????????????????????????????????? Content-Length: 0 Content-Type: application/x-www-form-urlencoded
2019.01.17 20:27:07 4 : https://api.mcs3.miele.com/v1/devices/?language=de: HTTP response code 415
2019.01.17 20:27:07 5 : HttpUtils https://api.mcs3.miele.com/v1/devices/?language=de: Got data, length: 56
2019.01.17 20:27:07 5 : HttpUtils response header: HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 19:27:07 GMT Content-Type: application/json Content-Length: 56 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.01.17 20:27:07 4 : Miele_API: Read callback: request type was get01 retry 0, Body: {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 20:27:08 5 : Miele_API: GetCookies is looking for Cookies
2019.01.17 20:27:08 5 : Miele_API: ExtractSid called, context get, num 01
2019.01.17 20:27:08 4 : Miele_API: CheckAuth decided no authentication required
2019.01.17 20:27:08 5 : Miele_API: ExtractReading for context get, num 01 - no individual parse definition
2019.01.17 20:27:08 5 : Miele_API: Read starts parsing response to get01 with defined readings: 01
2019.01.17 20:27:08 5 : Miele_API: ExtractReading reading01 with regex /^(.*)$/s ...
2019.01.17 20:27:08 5 : Miele_API: 1 capture group(s), matchlist = HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 19:27:07 GMT Content-Type: application/json Content-Length: 56 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 {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 20:27:08 4 : Miele_API: ExtractReading for reading01-1 sets reading01 to HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 19:27:07 GMT Content-Type: application/json Content-Length: 56 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 {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 20:27:08 4 : Miele_API: Read response to get01 matched Reading(s) reading01
2019-01-17 20:27:08 HTTPMOD Miele_API reading01: HTTP/1.1 415 Unsupported Media Type  Date: Thu, 17 Jan 2019 19:27:07 GMT  Content-Type: application/json  Content-Length: 56  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    {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 20:27:08 5 : Miele_API: HandleSendQueue called, qlen = 0

Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 17 Januar 2019, 20:46:33
Die Antwort 415 kommt von get01, nicht von der haupt Request.

Probier mal mit einem zusätzlichen HeadergetHeader2 accept: application/json; charset=utf-8
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 17 Januar 2019, 20:55:23
Das hat leider auch nicht geholfen. :(
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 17 Januar 2019, 21:03:51
Ein Stück Log wäre nicht schlecht...
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 17 Januar 2019, 21:07:03
Sorry.
2019.01.17 21:05:06 5 : Miele_API: get called with data
2019.01.17 21:05:06 5 : Miele_API: get found option data in attribute get01Name
2019.01.17 21:05:06 4 : Miele_API: get will now request data, no optional value
2019.01.17 21:05:06 4 : Miele_API: AddToQueue adds get01, initial queue len: 0
2019.01.17 21:05:06 5 : Miele_API: AddToQueue adds type get01 to URL https://api.mcs3.miele.com/v1/devices/?language=de, no data, header Authorization: Bearer DE_??????????????????????????????????? accept: application/json; charset=utf-8, retry 0
2019.01.17 21:05:06 5 : Miele_API: HandleSendQueue called, qlen = 1
2019.01.17 21:05:06 4 : Miele_API: HandleSendQueue sends request type get01 to URL https://api.mcs3.miele.com/v1/devices/?language=de, No Data, header: Authorization: Bearer DE_??????????????????????????????????? accept: application/json; charset=utf-8 timeout 2
2019.01.17 21:05:06 5 : HttpUtils url=https://api.mcs3.miele.com/v1/devices/?language=de
2019.01.17 21:05:06 4 : IP: api.mcs3.miele.com -> 157.97.106.171
2019.01.17 21:05:06 5 : HttpUtils request header: GET /v1/devices/?language=de HTTP/1.1 Host: api.mcs3.miele.com User-Agent: fhem Accept-Encoding: gzip,deflate Connection: Close Authorization: Bearer DE_??????????????????????????????????? accept: application/json; charset=utf-8 Content-Length: 0 Content-Type: application/x-www-form-urlencoded
2019.01.17 21:05:06 4 : https://api.mcs3.miele.com/v1/devices/?language=de: HTTP response code 415
2019.01.17 21:05:06 5 : HttpUtils https://api.mcs3.miele.com/v1/devices/?language=de: Got data, length: 56
2019.01.17 21:05:06 5 : HttpUtils response header: HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 20:05:06 GMT Content-Type: application/json Content-Length: 56 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.01.17 21:05:06 4 : Miele_API: Read callback: request type was get01 retry 0, Body: {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 21:05:06 5 : Miele_API: GetCookies is looking for Cookies
2019.01.17 21:05:06 5 : Miele_API: ExtractSid called, context get, num 01
2019.01.17 21:05:06 4 : Miele_API: CheckAuth decided no authentication required
2019.01.17 21:05:06 5 : Miele_API: ExtractReading for context get, num 01 - no individual parse definition
2019.01.17 21:05:06 5 : Miele_API: Read starts parsing response to get01 with defined readings: 01
2019.01.17 21:05:06 5 : Miele_API: ExtractReading reading01 with regex /^(.*)$/s ...
2019.01.17 21:05:06 5 : Miele_API: 1 capture group(s), matchlist = HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 20:05:06 GMT Content-Type: application/json Content-Length: 56 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 {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 21:05:06 4 : Miele_API: ExtractReading for reading01-1 sets reading01 to HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 20:05:06 GMT Content-Type: application/json Content-Length: 56 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 {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 21:05:06 4 : Miele_API: Read response to get01 matched Reading(s) reading01
2019-01-17 21:05:06 HTTPMOD Miele_API reading01: HTTP/1.1 415 Unsupported Media Type  Date: Thu, 17 Jan 2019 20:05:06 GMT  Content-Type: application/json  Content-Length: 56  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    {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 21:05:06 5 : Miele_API: HandleSendQueue called, qlen = 0
2019.01.17 21:05:11 4 : Miele_API: GetUpdate called (update)
2019.01.17 21:05:11 4 : Miele_API: update timer modified: will call GetUpdate in 60.0 seconds at 2019-01-17 21:06:11
2019.01.17 21:05:11 4 : Miele_API: AddToQueue adds update, initial queue len: 0
2019.01.17 21:05:11 5 : Miele_API: AddToQueue adds type update to URL https://api.mcs3.miele.com, no data, header Authorization: Bearer DE_??????????????????????????????????? Content-Type: application/json, retry 0
2019.01.17 21:05:11 5 : Miele_API: HandleSendQueue called, qlen = 1
2019.01.17 21:05:11 4 : Miele_API: HandleSendQueue sends request type update to URL https://api.mcs3.miele.com, No Data, header: Authorization: Bearer DE_??????????????????????????????????? Content-Type: application/json timeout 2
2019.01.17 21:05:11 5 : HttpUtils url=https://api.mcs3.miele.com
2019.01.17 21:05:11 3 : Miele_API: Read callback: Error: https://api.mcs3.miele.com: malformed or unsupported URL
2019.01.17 21:05:11 4 : Miele_API: Read callback: request type was update retry 0, body empty
2019.01.17 21:05:11 5 : Miele_API: GetCookies is looking for Cookies
2019.01.17 21:05:11 5 : Miele_API: ExtractSid called, context reading, num
2019.01.17 21:05:11 4 : Miele_API: CheckAuth decided no authentication required
2019.01.17 21:05:11 5 : Miele_API: GetUpdate checks if poll required for data (01)
2019.01.17 21:05:11 4 : Miele_API: GetUpdate will request data
2019.01.17 21:05:11 4 : Miele_API: AddToQueue adds get01, initial queue len: 0
2019.01.17 21:05:11 5 : Miele_API: AddToQueue adds type get01 to URL https://api.mcs3.miele.com/v1/devices/?language=de, no data, header Authorization: Bearer DE_??????????????????????????????????? accept: application/json; charset=utf-8, retry 0
2019.01.17 21:05:11 5 : Miele_API: HandleSendQueue called, qlen = 1
2019.01.17 21:05:11 5 : Miele_API: HandleSendQueue - minSendDelay not over, rescheduling
2019.01.17 21:05:12 5 : Miele_API: HandleSendQueue called, qlen = 1
2019.01.17 21:05:12 4 : Miele_API: HandleSendQueue sends request type get01 to URL https://api.mcs3.miele.com/v1/devices/?language=de, No Data, header: Authorization: Bearer DE_??????????????????????????????????? accept: application/json; charset=utf-8 timeout 2
2019.01.17 21:05:12 5 : HttpUtils url=https://api.mcs3.miele.com/v1/devices/?language=de
2019.01.17 21:05:12 4 : IP: api.mcs3.miele.com -> 157.97.106.171
2019.01.17 21:05:12 5 : HttpUtils request header: GET /v1/devices/?language=de HTTP/1.1 Host: api.mcs3.miele.com User-Agent: fhem Accept-Encoding: gzip,deflate Connection: Close Authorization: Bearer DE_??????????????????????????????????? accept: application/json; charset=utf-8 Content-Length: 0 Content-Type: application/x-www-form-urlencoded
2019.01.17 21:05:12 4 : https://api.mcs3.miele.com/v1/devices/?language=de: HTTP response code 415
2019.01.17 21:05:12 5 : HttpUtils https://api.mcs3.miele.com/v1/devices/?language=de: Got data, length: 56
2019.01.17 21:05:12 5 : HttpUtils response header: HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 20:05:12 GMT Content-Type: application/json Content-Length: 56 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.01.17 21:05:12 4 : Miele_API: Read callback: request type was get01 retry 0, Body: {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 21:05:12 5 : Miele_API: GetCookies is looking for Cookies
2019.01.17 21:05:12 5 : Miele_API: ExtractSid called, context get, num 01
2019.01.17 21:05:12 4 : Miele_API: CheckAuth decided no authentication required
2019.01.17 21:05:12 5 : Miele_API: ExtractReading for context get, num 01 - no individual parse definition
2019.01.17 21:05:12 5 : Miele_API: Read starts parsing response to get01 with defined readings: 01
2019.01.17 21:05:12 5 : Miele_API: ExtractReading reading01 with regex /^(.*)$/s ...
2019.01.17 21:05:12 5 : Miele_API: 1 capture group(s), matchlist = HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 20:05:12 GMT Content-Type: application/json Content-Length: 56 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 {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 21:05:12 4 : Miele_API: ExtractReading for reading01-1 sets reading01 to HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 20:05:12 GMT Content-Type: application/json Content-Length: 56 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 {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 21:05:12 4 : Miele_API: Read response to get01 matched Reading(s) reading01
2019-01-17 21:05:12 HTTPMOD Miele_API reading01: HTTP/1.1 415 Unsupported Media Type  Date: Thu, 17 Jan 2019 20:05:12 GMT  Content-Type: application/json  Content-Length: 56  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    {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 21:05:12 5 : Miele_API: HandleSendQueue called, qlen = 0
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 17 Januar 2019, 21:20:18
Es gibt mehrere Probleme.

1 - Ich würde erstmal die haupt Requests deaktivieren defmod Miele_API HTTPMOD https://api.mcs3.miele.com/ 0. Damit sollten die "Read Callbak Error unsupported URL" verschwinden. Die Log wird sauberer, es wird nur das get01 manuell durchgeführt. Besser zu analysieren, da wir dann sicher sind, wofür die Antwort kommt. Ausserdem hat es keinen Sinn, die reine API Url ohne etwas dahinten zu rufen.

2 - Es war mein Schuld: requestHeader2 bitte löschen. Das ist an der Stelle kein application/json.
getHeader2 aber behalten.

...und wieder die Log bitte ;)



Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 17 Januar 2019, 21:28:00
So das nächste Logfile ist übersichtliche geworden:
2019.01.17 21:23:06 5 : Miele_API: get called with data
2019.01.17 21:23:06 5 : Miele_API: get found option data in attribute get01Name
2019.01.17 21:23:06 4 : Miele_API: get will now request data, no optional value
2019.01.17 21:23:06 4 : Miele_API: AddToQueue adds get01, initial queue len: 0
2019.01.17 21:23:06 5 : Miele_API: AddToQueue adds type get01 to URL https://api.mcs3.miele.com/v1/devices/?language=de, no data, header Authorization: Bearer DE_??????????????????????????????????? accept: application/json; charset=utf-8, retry 0
2019.01.17 21:23:06 5 : Miele_API: HandleSendQueue called, qlen = 1
2019.01.17 21:23:06 4 : Miele_API: HandleSendQueue sends request type get01 to URL https://api.mcs3.miele.com/v1/devices/?language=de, No Data, header: Authorization: Bearer DE_??????????????????????????????????? accept: application/json; charset=utf-8 timeout 2
2019.01.17 21:23:06 5 : HttpUtils url=https://api.mcs3.miele.com/v1/devices/?language=de
2019.01.17 21:23:06 4 : IP: api.mcs3.miele.com -> 157.97.106.171
2019.01.17 21:23:06 5 : HttpUtils request header: GET /v1/devices/?language=de HTTP/1.1 Host: api.mcs3.miele.com User-Agent: fhem Accept-Encoding: gzip,deflate Connection: Close Authorization: Bearer DE_??????????????????????????????????? accept: application/json; charset=utf-8 Content-Length: 0 Content-Type: application/x-www-form-urlencoded
2019.01.17 21:23:06 4 : https://api.mcs3.miele.com/v1/devices/?language=de: HTTP response code 415
2019.01.17 21:23:06 5 : HttpUtils https://api.mcs3.miele.com/v1/devices/?language=de: Got data, length: 56
2019.01.17 21:23:06 5 : HttpUtils response header: HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 20:23:06 GMT Content-Type: application/json Content-Length: 56 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.01.17 21:23:06 4 : Miele_API: Read callback: request type was get01 retry 0, Body: {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 21:23:06 5 : Miele_API: GetCookies is looking for Cookies
2019.01.17 21:23:06 5 : Miele_API: ExtractSid called, context get, num 01
2019.01.17 21:23:06 4 : Miele_API: CheckAuth decided no authentication required
2019.01.17 21:23:06 5 : Miele_API: ExtractReading for context get, num 01 - no individual parse definition
2019.01.17 21:23:06 5 : Miele_API: Read starts parsing response to get01 with defined readings: 01
2019.01.17 21:23:06 5 : Miele_API: ExtractReading reading01 with regex /^(.*)$/s ...
2019.01.17 21:23:06 5 : Miele_API: 1 capture group(s), matchlist = HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 20:23:06 GMT Content-Type: application/json Content-Length: 56 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 {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 21:23:06 4 : Miele_API: ExtractReading for reading01-1 sets reading01 to HTTP/1.1 415 Unsupported Media Type Date: Thu, 17 Jan 2019 20:23:06 GMT Content-Type: application/json Content-Length: 56 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 {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 21:23:06 4 : Miele_API: Read response to get01 matched Reading(s) reading01
2019-01-17 21:23:06 HTTPMOD Miele_API reading01: HTTP/1.1 415 Unsupported Media Type  Date: Thu, 17 Jan 2019 20:23:06 GMT  Content-Type: application/json  Content-Length: 56  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    {"code":415,"message":"HTTP 415 Unsupported Media Type"}
2019.01.17 21:23:06 5 : Miele_API: HandleSendQueue called, qlen = 0

Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 17 Januar 2019, 21:47:54
Hmm... irgendwie mag er die Headers nicht. Ich vermute insbesondere Content-Length: 0 Content-Type: application/x-www-form-urlencoded

Wie sieht die "Raw" Request in Burp aus?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 17 Januar 2019, 21:51:18
Wenn ich den request über Postman durchführe (was funktioniert) kommt folgende RAW Information in Burp an:
GET /v1/devices/?language=de HTTP/1.1
cache-control: no-cache
Postman-Token: ????????????????????????????????
Authorization: Bearer DE_?????????????????????????????
User-Agent: PostmanRuntime/7.6.0
Accept: */*
Host: api.mcs3.miele.com
Accept-Encoding: gzip, deflate
Connection: close
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 17 Januar 2019, 22:11:49
Ja, das Content-type wird von fhem/httputils hinzugefügt, was Postman nicht macht.
Ich kann nicht die verschiedenen Möglichkeiten selbst testen, da ich bei "401 Unauthorized" bleibe.

Wenn Du in Burp mit "intercept on" die Request von Postman mit Action > Send to repeater kopierst, und dann im Reiter Repeater manuell das Header Content-Type: application/x-www-form-urlencoded hinzufügst, kriegst Du auch 415?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 17 Januar 2019, 22:53:11
Hab bei developer@miele einen Antrag für client_id / client_secret mit Dummy Account geschickt. Mal sehen, ob die es mir geben, es wird ggf. einfacher.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 18 Januar 2019, 20:58:41
Hallo amenomade erstmal vielen Dank dass du dich so intensiv um mein Problem kümmerst.
Wenn ich Content-Type: application/x-www-form-urlencoded über Burp hinzufüge, bekomme ich auch 415.
HTTP/1.1 415 Unsupported Media Type
Date: Fri, 18 Jan 2019 19:54:38 GMT
Content-Type: application/json
Content-Length: 56
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

{"code":415,"message":"HTTP 415 Unsupported Media Type"}
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 19 Januar 2019, 00:44:37
Dans probier mal mit "Content-Type: text" oder "Content-Type:" (leer)
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 19 Januar 2019, 11:41:46
Bei den beiden Varianten bekomme ich:
HTTP/1.1 500 Internal Server Error
Date: Sat, 19 Jan 2019 10:40:35 GMT
Content-Type: text/html
Content-Length: 186
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

<html>
<head><title>500 Internal Server Error</title></head>
<body bgcolor="white">
<center><h1>500 Internal Server Error</h1></center>
<hr><center>nginx</center>
</body>
</html>
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 19 Januar 2019, 16:58:00
Vielleicht kannst Du mir jetzt helfen: ich schaffe es nicht, mit Postman die Geräteliste zu erreichen, und kriege immer "Autentication failed", obwohl ich ein oauth2 Token generieren lassen habe... Wie hast Du es geschafft?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 19 Januar 2019, 17:58:11
Erzeugt habe ich den Token mit Postman über "Get New Access Token" unter den Reiter Authorization:
siehe "Get Token.jpg
Danach die entsprechenden Daten eingeben:
siehe Token Value.jpg
Den Type nicht als "OAuth 2.0" stehen lassen, sonder auf "Bearer Token" umstellen und unter "Token" den erhaltenen Token eintragen.
siehe Token.jpg
Dann solltest du die Daten im JSON Format erhalten.
siehe JSON.jpg

Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 19 Januar 2019, 18:50:18
Genauso habe ich auch gemacht, und beim GET /v1/devices/ kriege ich immer Authentication failed...
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 19 Januar 2019, 19:28:17
Zur Sicherheit, habe ich noch meinen Miele Trockner (nicht Smart, aber zumindest macht es ein Gerät in der Liste) registriert.
Geht immer noch nicht.

Ich habe aber gesehen, dass ich auch die Antwort 415 kriege, wenn ich irgendwelche Content-Type hinzufüge. Dann muss ich ein bisschen gucken, wie man bei HTTPMOD dieses Content-type urlencode vermeiden kann.

Ansonsten, wird es schwierig, dir weiter zu helfen, wenn ich nicht selbst experimentieren kann. Sorry.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 19 Januar 2019, 20:45:32
Das ist ja seltsam. Könnte natürlich daran liegen, dass kein Gerät vorhanden ist was mit der Cloud verbunden ist, kann ich aber auch nicht sicher sagen.
Wie kommen wir dann weiter kommen?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 19 Januar 2019, 21:18:52
Also... man kann ein bisschen weiter mit dem "get devices" und dem bestehenden Token experimentieren, aber blind werde ich das Verfahren zur Erneuerung des Tokens nicht hinkriegen.

Ich melde mich.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 19 Januar 2019, 22:37:04
Also: mit allen möglichen Content-Type kriege ich entweder "415 - unsupported media type" oder "500 - internal server error". Aber mit Content-Type: application/json bekomme ich mit meinem nicht funktionierenden Token "401 - unauthorized"

Dann vermute ich, es ist so richtig.
Hier meine Definition:

defmod Miele_API3 HTTPMOD https://api.mcs3.miele.com/v1/devices/?language=de 0
attr Miele_API3 enableControlSet 1
attr Miele_API3 requestHeader01 Authorization: Bearer DE_zzzzzz
attr Miele_API3 requestHeader02 Content-Type: application/json
attr Miele_API3 verbose 5


Dann manuell auslesen mit set Miele_API3 reread.
Versuch mal bitte (kreiere bitte ein neues sauberes Device, deswegen habe ich es Miele_API3 genannt)
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 20 Januar 2019, 13:42:16
Du bist perfekt! Vielen Vielen Dank. :)
Das wars jetzt bekomme ich die Daten, nur noch extraxtAllJSON aktiviert und schon waren alle Werte in den Readings.
Haben wir denn noch eine Möglichkeit, den Token automatisch zu refreshen und dann zu übergeben?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 20 Januar 2019, 16:11:05
Zitat von: xerion am 20 Januar 2019, 13:42:16
Haben wir denn noch eine Möglichkeit, den Token automatisch zu refreshen und dann zu übergeben?
Das ist bestimmt möglich. Wird aber mühsam, wenn ich nicht selbst experimentieren kann. Prinzipiell geht das so:
- reAuthRegex Unauthorized|Authentication failed => um zu wissen, wenn der Token nicht mehr funktioniert
- mit sid1 attribute, GET /thirdparty/login/
- mit sid2 attribute, POST /oauth/auth mit user/passwort, und "code" fangen
- mit sid3 attribute, POST /thirdparty/token und Token fangen


Alternativ gibt es auch anscheinend eine Möglichkeit, Tokens zu erneuern... (Refresh Token flow)

So was in der Art. Es ist aber sehr theoretisch ;) Ich werde mal gucken, was ich kann: Grunsätzlich kann ich schon Tokens generieren lassen (zumindest mit Postman), auch wenn die nicht funktionieren...
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 20 Januar 2019, 17:25:40
Also... Da mein Token nie funktioniert, wird logischerweise bei mir bei jedem "set reread" der Token wieder erneuert, aber am Ende habe ich auch logischerweise immer noch Unauthorized. Aber grundsätzlich wird mein Token ordentlich erneuert und die Request01 wird durch request01Header mit dem neuen Token gerufen !

defmod Miele_API3 HTTPMOD https://api.mcs3.miele.com/v1/devices/?language=de 0
attr Miele_API3 enableControlSet 1
attr Miele_API3 reAuthRegex Unauthorized
attr Miele_API3 requestHeader01 Authorization: Bearer $sid
attr Miele_API3 requestHeader02 Content-Type: application/json
attr Miele_API3 sid1URL https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=zzzzzMeinClientID&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
attr Miele_API3 sid2Data email=zzzzzMeinEmail&password=zzzzzMeinPasswort&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=zzzzzMeinClientID&vgInformationSelector=de-DE
attr Miele_API3 sid2IdRegex (?s)code=(DE_[0-9a-f]+)
attr Miele_API3 sid2IgnoreRedirects 1
attr Miele_API3 sid2URL https://api.mcs3.miele.com/oauth/auth
attr Miele_API3 sid3Data grant_type=authorization_code&code=$sid&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&client_id=zzzzzMeinClientID&client_secret=zzzzzMeinClientSecret
attr Miele_API3 sid3IdJSON access_token
attr Miele_API3 sid3URL https://api.mcs3.miele.com/thirdparty/token/
attr Miele_API3 verbose 5


Natürlich, alle zzzzzMein.* Parameter durch deine ersetzen.

Für den ersten Test ist $sid noch nicht bekannt, dann sollte er die Erneuerung anfordern. Der neue Token wird dann im Internal "sid" gespeichert.

Wenn weitere Erneuerungstests benötigt werden, dann solltest Du reAuthRegex auf irgendwas setzen, was mit dem erfolgreichen Aufruf der /v1/devices Seite stimmt, damit er die Erneuerung zwingt. Z.B. deine Devicenummer 000149130299 vom ersten Post. Wenn letztendlich alles geht, dann wieder auf Unauthorized... bis Du evtl. feststellst, dass beim abgelaufenden Token eine andere Fehlermledung kommt (laut Swagger Doku sollte es aber nicht sein). Dann ggf. einfach auf Unauthorized|andereMeldung setzen.

Wenn es nicht geht, dann wie immer die verbose 5 log und ein "list" deines HTTPMOD. (Vorsicht, viel zu anonymisieren)
Wenn Fragen zur Verständnis, gerne hier posten.
Danach können wir vielleicht mit der PUT Methode anfangen, wobei ich nicht weiss, ob HTTPMOD das kann ;)

EDIT: tatsächlich kann HTTPMOD (bzw. HttpUtils) nur GET und POST. Da bleiben nur alternative Methoden per perl Code...
EDIT2: die HTTPMOD Geschichte ist aber für dein Projekt nicht komplett umsonst, da Du schon mit {InternalVal("Miele_API3","sid","")} den Token holen kannst, und mit {fhem "set Miele_API3 reread";} eine Möglichkeit hast, um den zu erneueren.


Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 20 Januar 2019, 21:12:09
Wow. Das hat auch wieder funktioniert. Besten Dank. Wenn wir jetzt noch die PUT Geschichte hinbekommen wäre es perfekt.
Aber wie du schon sagt, das wird wohl mit HTTPMOD nicht gehen. Habe im Forum schon einen zweiten Eintrag gefunden der auch was über PUT umsetzen möchte, aber dort steht die Antwort noch aus. https://forum.fhem.de/index.php/topic,92178.msg846886.html#msg846886
Momentan sende ich das einfach mit einem Python Skript, aber dort wechselt sich ja nicht der nicht der Token automatisch.
Wäre vielleicht was über cURL möglich, so das man den Token dann als Variable übergeben kann?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 20 Januar 2019, 21:42:03
Ich habe ein bisschen wegen PUT überlegt. Es sollte einfach mit curl funktionieren, da kriegst Du aber keine Rückantwort zurück, wenn Du es non-blocking möchtest. Deswegen müsste man zuerst durch ein reread sicherstellen, dass der Token noch gültig ist.

Etwas in der Art (nicht getestet)

{ fhem "set Miele_API3 reread";
if (ReadingsVal("Miele_API3", "status", 0)==4) { #laut put preconditions in der Doku
   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}' &")
  }
}
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 20 Januar 2019, 23:32:07
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...
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion 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
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Fritz Muster am 05 März 2019, 11:43:37
Zitat von: amenomade am 20 Januar 2019, 23:32:07
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
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Fritz Muster 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 (https://www.miele.com/developer/) 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 (https://www.miele.com/developer/swagger-ui/index.html#/operations/Information/get_v1_devices__deviceId_) 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

Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: leuchte1 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
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: basi79 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
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin 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.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: basi79 am 14 März 2019, 11:30:34
Zitat von: basi79 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

hab auch heute eine erfreuliche eMail bekommen.. danke..für die Geduld...
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Laffer72 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

Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 21 März 2019, 20:58:15
Die Antwort ist klar:
ZitatHTTP/1.1 401 Unauthorized

Zeig bitte ein "list" von deinem HTTPMOD und die gesamte Log bei einem "reread".
(! bitte anonymisieren !)
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Laffer72 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.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade 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)
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Laffer72 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
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade 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)
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Laffer72 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).
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade 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=code
dann dort dein User, Passwort, und Land eingibst, kriegst Du dann in der URL wo Du weitergeleitet wirst so ein Code:
?code=DE_faa74agd2f919e2bf3e88fe1adf68f4c?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Laffer72 am 22 März 2019, 00:13:48
Bei mir kommt nur:
Konto-Verknüpfung fehlgeschlagen!
Bitte überprüfen Sie ihre Zugangsdaten

Ich denke, ich sollte mal die die Leute von der Miele-Api kontaktieren.
Irgendwas scheint da nicht richtig zu sein.

Danke Dir amenomade, daß Du Dich so bemüht hast mir zu helfen.
Schönen Abend noch.

Reinhard
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 22 März 2019, 11:10:48
ZitatBei mir kommt nur:
Konto-Verknüpfung fehlgeschlagen!
Bitte überprüfen Sie ihre Zugangsdaten
Das ist schon OK. Was mit interessiert, ist was in der zurückgegeben URL kommt, ob dort eine Code "DE_xxxxxx" in der URL kommt
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 22 März 2019, 11:47:55
Ich antworte mal, da ich das gleiche Problem habe. Ja, der Code in der URL kommt.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Laffer72 am 22 März 2019, 13:37:13
jetzt hab ichs nochmal probiert.
Bei mir kommt nur:
https://api.mcs3.miele.com/oauth/auth
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Wuppi68 am 22 März 2019, 13:39:37
tacker mich mal dran ... API Zugriff ist gerade per Mail angefragt ;-)
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 22 März 2019, 14:11:02
Zitat von: Laffer72 am 22 März 2019, 13:37:13
jetzt hab ichs nochmal probiert.
Bei mir kommt nur:
https://api.mcs3.miele.com/oauth/auth

Das bedeutet, die Zugangsdaten (Email, Passwort, Region) passen nicht zu deinem client_id.
Hinweis: die Region ist entscheidend: wenn Du dich bei miele.de registriert hast, musst Du DE nehmen. Miele Norge wird nicht gehen.

Die richtige Antwort sollte in der zurückgegebenen Url ein ?code=ad54ca3f5837da87fcdas87fc oder ?code=DE_ad54ca3f5837da87fcdas87fc enthalten

Kannst Du dich mit diesen Email/Passwort auf der Webseite https://www.miele.de/ anmelden?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 22 März 2019, 14:17:57
Zitat von: volschin am 22 März 2019, 11:47:55
Ich antworte mal, da ich das gleiche Problem habe. Ja, der Code in der URL kommt.
Und Du bist schon ein Stück weiter als Laffer72
Da bräuchte ich, wie gewohnt, ein "list" von deinem HTTPMOD Device und die Log bei einem reread (alles anonymisiert)
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 22 März 2019, 14:26:47
Danke für Dein Hilfsangebot, aber meist sitzt ja das Problem vor dem Bildschirm.   :-[
Ich hatte einen Schreibfehler in sid3Data.
Jetzt kommt auch ein 200 und die Readings werden angelegt. Jetzt muss ich nur noch rausfinden, welche Readings mein Waschtrockner unterstützt.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Laffer72 am 22 März 2019, 16:11:54
Stimmt, das Problem scheint vor dem Bildschirm zu sitzen  :-[

Nachdem ich mich auch nicht auf der Miele-Seite einloggen konnte, habe ich ein neues Passwort angefordert und mit dem klappts es jetzt.
Asche über mein Haupt. Sorry für die Mühen die ich bereitet habe. Ist ja wirklich peinlich...
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 24 März 2019, 17:49:28
Ich habe jetzt mit den folgenden Readings für meinen Waschtrockner gearbeitet:
attr WTH730 reading01JSON state_remainingTime_0
attr WTH730 reading01Name remainingtime_h
attr WTH730 reading02JSON state_remainingTime_1
attr WTH730 reading02Name remainingtime_m
attr WTH730 reading03JSON state_elapsedTime_0
attr WTH730 reading03Name elapsedtime_h
attr WTH730 reading04JSON state_elapsedTime_1
attr WTH730 reading04Name elapsedtime_m
attr WTH730 reading05JSON state_spinningSpeed
attr WTH730 reading05Name spinningspeed
attr WTH730 reading06JSON state_status_value_raw
attr WTH730 reading06Name state
attr WTH730 reading07JSON state_status_value_localized
attr WTH730 reading07Name state_value
attr WTH730 reading08JSON state_dryingStep_value_localized
attr WTH730 reading08Name dryingStep
attr WTH730 reading09JSON state_targetTemperature_01_value_localized
attr WTH730 reading09Name targetTemperature
attr WTH730 reading10JSON state_programType_value_localized
attr WTH730 reading10Name programType_value
attr WTH730 reading11JSON state_programType_value_raw
attr WTH730 reading11Name programType
attr WTH730 reading12JSON state_signalFailure
attr WTH730 reading12Name signalFailure
attr WTH730 reading13JSON state_programPhase_value_raw
attr WTH730 reading13Name programPhase
attr WTH730 reading14JSON state_programPhase_value_localized
attr WTH730 reading14Name programPhase_value
attr WTH730 reading15JSON state_ventilationStep_value_localized
attr WTH730 reading15Name ventilationStep
attr WTH730 reading16JSON state_signalDoor
attr WTH730 reading16Name signalDoor
attr WTH730 reading20JSON state_light
attr WTH730 reading20Name light

Ich habe aber festgestellt, dass obwohl die Felder im JSON vorhanden sind, diese teilweise nicht angesprochen werden.

Während er also durch das Programm läuft
2019-03-24 13:40:01 HTTPMOD WTH730 programPhase: 260
2019-03-24 14:04:01 HTTPMOD WTH730 programPhase: 261
2019-03-24 14:30:01 HTTPMOD WTH730 programPhase: 266
2019-03-24 14:44:02 HTTPMOD WTH730 programPhase: 526
2019-03-24 15:04:01 HTTPMOD WTH730 programPhase: 514
2019-03-24 16:22:01 HTTPMOD WTH730 programPhase: 530
2019-03-24 16:28:02 HTTPMOD WTH730 programPhase: 519
2019-03-24 16:38:02 HTTPMOD WTH730 7
2019-03-24 16:38:02 HTTPMOD WTH730 state_value: Ende
2019-03-24 16:38:02 HTTPMOD WTH730 programPhase: 267

werden anscheinend
nie mit irgendwelchen Werten gefüllt.

Hat da jemand andere oder ähnliche Erfahrungen gemacht?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 24 März 2019, 20:12:39
Wie sieht das ganze JSON aus? Sind da die Felder auch leer?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 25 März 2019, 03:18:48
Ja, sind auch dort leer.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Fritz Muster am 25 März 2019, 09:20:39
Zitat von: volschin am 24 März 2019, 17:49:28
werden anscheinend

  • state_dryingStep_value_localized
  • state_programType_value_localized
  • state_programType_value_raw
  • state_programPhase_value_localized
  • state_ventilationStep_value_localized
nie mit irgendwelchen Werten gefüllt.

Hat da jemand andere oder ähnliche Erfahrungen gemacht?

Bei meiner Waschmaschine ist es ähnlich.

Es gibt Readings die keine Werte beinhalten, es gibt aber auch Readings wie z.B "state_programType_value_localized" die immer den gleichen Wert enthalten, egal in welchem Programm die WMA gerade läuft. Allerdings die Readings welche ich benötige (remainigTime, elapsedTime und programmphase) funktionieren bei mir ohne Probleme.

Ich warte einfach mal ab was da zukünftig noch so kommt.  Laut Miele API Webpage ist das Ganze ja auch noch open BETA.

Grüße Fritz
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 29 März 2019, 08:59:44
Ok, dann weiß ich schon mal, dass es nicht an meinem WT hängt.
Witzig finde ich das mit programPhase. Die Zahl, die er überträgt, korrespondiert mit der aktuellen Anzeige im Gerät, also Waschen, Spülen, Schleudern etc.
Vielleicht lässt sich das für etwas verwenden.
Ich lasse z.B. nach Trockenvorgängen meine Maschine bei Programmende noch rund eine halbe Stunde im Knitterschutz abkühlen.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Wuppi68 am 01 April 2019, 16:20:52
bei mir klappt es jetzt auch :-) :-)

Danke

Integer Werte sollten localized eigentlich immer Arabisch sein ;-)

Werde es bei der nächsten Wäsche aber mal genauer verfolgen, was da so alles passiert ;-)
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xasher am 02 April 2019, 11:38:58
Hallo zusammen,

ich würde mich gerne auch einklinken. Ich habe mich für die API registriert und meine Daten erhalten.
Ich habe auch Interesse meine Geäte einzubinden (Trockner, Waschmaschine, Spülmaschine und Backofen).
Ich bekomme die 200 auch bei allen Geräten zurückgeliefert.

Ich komm nur nicht dahinter, wie man an die Readings kommt. Mir fehlt da wohl völlig das Verständnis  :(

Kann mir vielleicht jemand Starthilfe geben?

Grüße,
Alex
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xasher am 02 April 2019, 13:31:28
Hallo nochmals,

ich habe es inzwischen hinbekommen. Für mich war die einfachste Lösung, das verbose=5 zu setzen und die Werte im Log herauszulsesen. Über das Swagger-Ui funktioniert es aber auch:

2019.04.02 13:29:23 5: miele_geschirrspueler: JSON Flatter sets ident_type_key_localized to Ger▒tetyp
2019.04.02 13:29:23 5: miele_geschirrspueler: JSON Flatter sets ident_type_value_localized to Geschirrsp▒ler
2019.04.02 13:29:23 5: miele_geschirrspueler: JSON Flatter sets ident_type_value_raw to 7


Hat jemand noch eine Lösung für das Umlautproblem?

Grüße,
Alex
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 02 April 2019, 20:20:49
Da kannst Du evtl. mit (get|set|reading)[0-9]*Decode arbeiten.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: det. am 12 April 2019, 20:36:34
Danke an alle hier,
Mit Hilfe dieses Treats habe ich seit Gestern meinen Geschirrspüler erfolgreich eingebunden. Hatte den vor ca. 2 Jahren vorsorglich mit Smart Connect gekauft. Jetzt sehe ich ob der Aus oder in Betrieb ist, und wie lange schon und wie lange noch das dauert.
Irgendwie erinnert mich das an die Frage ,,warum sich der Hund die ... leckt". Will sagen, einen praktischen Nutzen kann ich derzeit nicht erkennen, außer der Befriedigung das es geht.
Habt Ihr dazu Ideen?
Weitere Miele Geräte scheitern zum Glück an der Langlebigkeit des vorhandenen nicht smarten Waschautomaten und Ablufttrockners.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 20 April 2019, 17:59:42
Ist doch oben beschrieben, z.B. die Steuerung in Verbindung mit einer Solaranlage, bzw. eine akustische oder visuelle Benachrichtigung, wenn die Maschine durch ist. OK, das zweite ist beim Geschirrspüler weniger interessant, bei de Waschmaschine aber schon.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: det. am 20 April 2019, 19:50:17
Da mir doch inzwischen ein halbwegs sinnvoller Nutzen eingefallen ist, habe ich mal bei Miele angefragt, ob die Datenabfrage zum Klarspülerfüllstand und zum Salzvorrat für den GS6860 noch in die API eingebaut wird. In der iOS App sind diese Daten vorhanden, werden also vom Gerät bereitgestellt.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Cobra am 02 Mai 2019, 21:07:13
Hallo zusammen,


ich klink mich hier auch mal ein da ich nicht weiterkomme.
Zuerst bekomm ich die Meldung 200 zurück und kurz danach auch die Meldung 401 Unauthorized

Hier mal das List meines Gerätes

Internals:
   BUSY       0
   CFGFN     
   CHANGED   
   DEF        https://api.mcs3.miele.com/v1/devices/00011xxxxx/?language=de 120
   FUUID      5ccb3ca4-f33f-366a-8f0f-98bafc562c2cee60
   Interval   120
   JSONEnabled 1
   LASTSEND   1556824105.88251
   LastAuthTry 2019-05-02 21:08:17
   MainURL    https://api.mcs3.miele.com/v1/devices/00011xxxx/?language=de
   ModuleVersion 3.5.9 - 13.2.2019
   NAME       myMieleWaschmaschine
   NOTIFYDEV  global
   NR         13020
   NTFY_ORDER 50-myMieleWaschmaschine
   STATE      ???
   TRIGGERTIME 1556824193.11517
   TRIGGERTIME_FMT 2019-05-02 21:09:53
   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/00011xxxxx/?language=de
   header     Authorization: Bearer DE_c166b5de92e263655c22b571fee98769
Content-Type: application/json
   host       api.mcs3.miele.com
   httpheader HTTP/1.1 401 Unauthorized
Date: Thu, 02 May 2019 19:08:26 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 1
   hu_port    443
   hu_portSfx
   ignoreredirects 0
   loglevel   4
   path       /v1/devices/00011xxxx/?language=de
   protocol   https
   redirects  0
   sid        DE_c166b5de92e263655c22b571fee98769
   timeout    2
   url        https://api.mcs3.miele.com/v1/devices/00011xxxxx/?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/000119245250/?language=de
     value      0
   sslargs:
Attributes:
   enableControlSet 1
   reAuthRegex Unauthorized
   requestHeader01 Authorization: Bearer $sid
   requestHeader02 Content-Type: application/json
   sid1URL    https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=MeineClientID&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
   sid2Data   email=meine@email.de&password=MeinPasswort&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=MeineClientID&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=MeineClientID&client_secret=MeineClientSecret
   sid3IdJSON access_token
   sid3URL    https://api.mcs3.miele.com/thirdparty/token/
   userattr   requestHeader01 requestHeader02 sid1URL sid2Data sid2IdRegex sid2IgnoreRedirects:0,1 sid2URL sid3Data sid3IdJSON sid3URL
   verbose    3





Und hier das Log auf Verbose 5 beim Reread:

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

2019.05.02 20:57:21 4: https://api.mcs3.miele.com/v1/devices/000119245250/?language=de: HTTP response code 401
2019.05.02 20:57:21 5: HttpUtils https://api.mcs3.miele.com/v1/devices/000119245250/?language=de: Got data, length: 29
2019.05.02 20:57:21 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Thu, 02 May 2019 18:57:21 GMT
Content-Type: application/vnd.miele.v1+json;charset=UTF-8
Content-Length: 29
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.05.02 20:57:21 4: myMieleWaschmaschine: Read callback: request type was update retry 0,
Body: { "message": "Unauthorized" }
2019.05.02 20:57:21 5: myMieleWaschmaschine: JSON Flatter called : prefix , ref is HASH(0x6990940)
2019.05.02 20:57:21 5: myMieleWaschmaschine: JSON Flatter sets message to Unauthorized
2019.05.02 20:57:21 4: myMieleWaschmaschine: extracted JSON values to internal
2019.05.02 20:57:21 5: myMieleWaschmaschine: ExtractSid called, context reading, num
2019.05.02 20:57:21 5: myMieleWaschmaschine: CheckAuth is checking buffer with ReAuthRegex Unauthorized
2019.05.02 20:57:21 4: myMieleWaschmaschine: CheckAuth decided new authentication required
2019.05.02 20:57:21 4: myMieleWaschmaschine: Auth called with Steps: 1 2 3
2019.05.02 20:57:21 4: myMieleWaschmaschine: AddToQueue adds auth3, initial queue len: 0, prio
2019.05.02 20:57:21 5: myMieleWaschmaschine: 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=xxxx&client_secret=xxxx, no headers, retry 0
2019.05.02 20:57:21 4: myMieleWaschmaschine: AddToQueue adds auth2, initial queue len: 1, prio
2019.05.02 20:57:21 5: myMieleWaschmaschine: AddToQueue prepends type auth2 to URL https://api.mcs3.miele.com/oauth/auth, data email=xxxxx&password=3MGwD6v4&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=xxxxx&vgInformationSelector=de-DE, no headers, ignore redirects, retry 0
2019.05.02 20:57:21 4: myMieleWaschmaschine: AddToQueue adds auth1, initial queue len: 2, prio
2019.05.02 20:57:21 5: myMieleWaschmaschine: AddToQueue prepends type auth1 to URL https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=xxxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F, no data, no headers, retry 0
2019.05.02 20:57:21 5: myMieleWaschmaschine: HandleSendQueue called, qlen = 3
2019.05.02 20:57:21 4: myMieleWaschmaschine: HandleSendQueue sends request type auth1 to URL https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=xxxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F, No Data, No Header
timeout 2
2019.05.02 20:57:21 5: HttpUtils url=https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=xxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
2019.05.02 20:57:21 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.05.02 20:57:21 4: myMieleWaschmaschine: AddToQueue adds update, initial queue len: 2
2019.05.02 20:57:21 5: myMieleWaschmaschine: AddToQueue adds type update to URL https://api.mcs3.miele.com/v1/devices/000119245250/?language=de, no data, header Authorization: Bearer $sid
Content-Type: application/json, retry 1
2019.05.02 20:57:21 5: myMieleWaschmaschine: HandleSendQueue called, qlen = 3
2019.05.02 20:57:21 5: myMieleWaschmaschine: HandleSendQueue - still waiting for reply to last request, delay sending from queue
2019.05.02 20:57:21 4: myMieleWaschmaschine: CheckAuth requeued request update after auth, retryCount 0 ...
2019.05.02 20:57:21 5: HttpUtils request header:
GET /thirdparty/login/?response_type=code&state=login&client_id=xxxxx&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.05.02 20:57:23 5: myMieleWaschmaschine: HandleSendQueue called, qlen = 3
2019.05.02 20:57:23 5: myMieleWaschmaschine: HandleSendQueue - still waiting for reply to last request, delay sending from queue
2019.05.02 20:57:23 4: https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=xxxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F: HTTP response code 200
2019.05.02 20:57:23 5: HttpUtils https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=xxxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F: Got data, length: 7610
2019.05.02 20:57:23 5: HttpUtils response header:
HTTP/1.1 200 OK
Date: Thu, 02 May 2019 18:57:23 GMT
Content-Type: text/html
Content-Length: 2174
Connection: close
Vary: Accept-Encoding
Content-Encoding: gzip
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.05.02 20:57:23 4: myMieleWaschmaschine: 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="xxxxx">

        <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.05.02 20:57:23 3: myMieleWaschmaschine: error while parsing JSON data: malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "<html lang="de">\n<h...") at (eval 29086763) line 1.

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

2019.05.02 20:57:26 5: myMieleWaschmaschine: HandleSendQueue called, qlen = 2
2019.05.02 20:57:26 5: myMieleWaschmaschine: HandleSendQueue - still waiting for reply to last request, delay sending from queue
2019.05.02 20:57:27 5: myMieleWaschmaschine: HandleSendQueue called, qlen = 2
2019.05.02 20:57:27 5: myMieleWaschmaschine: HandleSendQueue - still waiting for reply to last request, delay sending from queue
2019.05.02 20:57:28 3: myMieleWaschmaschine: Read callback: Error: read from https://api.mcs3.miele.com:443 timed out
2019.05.02 20:57:28 4: myMieleWaschmaschine: Read callback: request type was auth2 retry 0, body empty
2019.05.02 20:57:28 5: myMieleWaschmaschine: ExtractSid called, context sid, num 2
2019.05.02 20:57:28 5: myMieleWaschmaschine: ExtractSid could not match buffer to IdRegex (?s)code=(DE_[0-9a-f]+)
2019.05.02 20:57:30 5: myMieleWaschmaschine: HandleSendQueue called, qlen = 2
2019.05.02 20:57:30 4: myMieleWaschmaschine: HandleSendQueue sends request type auth3 to URL https://api.mcs3.miele.com/thirdparty/token/,
data: grant_type=authorization_code&code=DE_492051e092691803a2e5f643f5f45ee4&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&client_id=xxxxx&client_secret=xxxxx, No Header
timeout 2
2019.05.02 20:57:30 5: HttpUtils url=https://api.mcs3.miele.com/thirdparty/token/
2019.05.02 20:57:30 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.05.02 20:57:30 5: HttpUtils request header:
POST /thirdparty/token/ HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Content-Length: 234
Content-Type: application/x-www-form-urlencoded

2019.05.02 20:57:32 5: myMieleWaschmaschine: HandleSendQueue called, qlen = 1
2019.05.02 20:57:32 5: myMieleWaschmaschine: HandleSendQueue - still waiting for reply to last request, delay sending from queue
2019.05.02 20:57:32 4: https://api.mcs3.miele.com/thirdparty/token/: HTTP response code 401
2019.05.02 20:57:32 5: HttpUtils https://api.mcs3.miele.com/thirdparty/token/: Got data, length: 29
2019.05.02 20:57:32 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Thu, 02 May 2019 18:57:32 GMT
Content-Type: application/json
Content-Length: 29
Connection: close
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.05.02 20:57:32 4: myMieleWaschmaschine: Read callback: request type was auth3 retry 0,
Body: {"message":"code is invalid"}
2019.05.02 20:57:32 5: myMieleWaschmaschine: JSON Flatter called : prefix , ref is HASH(0x6a4d6f0)
2019.05.02 20:57:32 5: myMieleWaschmaschine: JSON Flatter sets message to code is invalid
2019.05.02 20:57:32 4: myMieleWaschmaschine: extracted JSON values to internal
2019.05.02 20:57:32 5: myMieleWaschmaschine: ExtractSid called, context sid, num 3
2019.05.02 20:57:32 5: myMieleWaschmaschine: Checking SID with JSON access_token
2019.05.02 20:57:33 5: myMieleWaschmaschine: HandleSendQueue called, qlen = 1
2019.05.02 20:57:33 4: myMieleWaschmaschine: HandleSendQueue sends request type update to URL https://api.mcs3.miele.com/v1/devices/000119245250/?language=de, No Data,
header: Authorization: Bearer DE_492051e092691803a2e5f643f5f45ee4
Content-Type: application/json
timeout 2
2019.05.02 20:57:33 5: HttpUtils url=https://api.mcs3.miele.com/v1/devices/000119245250/?language=de
2019.05.02 20:57:33 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.05.02 20:57:33 5: HttpUtils request header:
GET /v1/devices/000119245250/?language=de HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Authorization: Bearer DE_492051e092691803a2e5f643f5f45ee4
Content-Type: application/json
Content-Length: 0

2019.05.02 20:57:33 4: https://api.mcs3.miele.com/v1/devices/000119245250/?language=de: HTTP response code 401
2019.05.02 20:57:33 5: HttpUtils https://api.mcs3.miele.com/v1/devices/000119245250/?language=de: Got data, length: 29
2019.05.02 20:57:33 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Thu, 02 May 2019 18:57:33 GMT
Content-Type: application/vnd.miele.v1+json;charset=UTF-8
Content-Length: 29
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.05.02 20:57:33 4: myMieleWaschmaschine: Read callback: request type was update retry 1,
Body: { "message": "Unauthorized" }
2019.05.02 20:57:33 5: myMieleWaschmaschine: JSON Flatter called : prefix , ref is HASH(0x6c79cf8)
2019.05.02 20:57:33 5: myMieleWaschmaschine: JSON Flatter sets message to Unauthorized
2019.05.02 20:57:33 4: myMieleWaschmaschine: extracted JSON values to internal
2019.05.02 20:57:33 5: myMieleWaschmaschine: ExtractSid called, context reading, num
2019.05.02 20:57:33 5: myMieleWaschmaschine: CheckAuth is checking buffer with ReAuthRegex Unauthorized
2019.05.02 20:57:33 4: myMieleWaschmaschine: CheckAuth decided new authentication required
2019.05.02 20:57:33 4: myMieleWaschmaschine: Authentication still required but no retries left - did last authentication fail?
2019.05.02 20:57:33 5: myMieleWaschmaschine: Read starts parsing response to update with defined readings:
2019.05.02 20:57:33 3: myMieleWaschmaschine: Read response to update didn't match any Reading
2019.05.02 20:57:33 5: myMieleWaschmaschine: HandleSendQueue called, qlen = 0



Wo könnte noch der Fehler liegen?

Gruß Cobra
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: det. am 02 Mai 2019, 21:23:52
Hallo Cobra,

Kann Dir nicht wirklich helfen, bei mir ging es, nachdem ich mehrfach die Schritte lt. Beitrag hier im Forum kontrolliert hatte und auch noch den letzten kleinen Fehler gefunden und beseitigt hatte - bis zum letzten funktionierenden Reading am 2019-04-29 09:59:39
Danach 401 - mglw gab es da Änderungen an der API? Kann das noch jemand bestätigen?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Cobra am 02 Mai 2019, 21:29:29
Hallo Det.

Danke für die Info.

Wenn du seither auch Probleme hast dann leg ich das ganze noch ein paar Tage auf Eis und warte mal ob sich auch andere mit dem gleichen Problem hier melden. Dann wissen wir zumindest ob es sich lohnt den Fehler in der eigenen Installation zu suchen oder ob es an der API liegt.
Hab nämlich erst am 29.4. abends damit angefangen das Gerät anzulegen.

Gruß Cobra
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 02 Mai 2019, 21:53:33
Macht mal bitte den Test hier: https://forum.fhem.de/index.php/topic,95989.msg922006.html#msg922006
und sagt Bescheid

Wobei:
Zitat2019.05.02 20:57:28 3: myMieleWaschmaschine: Read callback: Error: read from https://api.mcs3.miele.com:443 timed out
2019.05.02 20:57:28 4: myMieleWaschmaschine: Read callback: request type was auth2 retry 0, body empty
deutet auf irgendwelche Unverfügbarkeit von der Cloud API.
Jetzt aber funktioniert der Test hieroben, zumindest bei mir
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Cobra am 02 Mai 2019, 22:15:07
Hey Amenomade,

bei mir kommt auch eine entsprechende URL zurück:

https://api.mcs3.miele.com/thirdparty/login/?code=DE_bd0d0b944cc09f6043be2e3ddfe5f275&state=login (https://api.mcs3.miele.com/thirdparty/login/?code=DE_bd0d0b944cc09f6043be2e3ddfe5f275&state=login)

So wie du ja weiter oben geschrieben hast ist es egal ob da steht Verknüpfung fehlgeschlagen solange so ein Code zurückkommt, oder?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 02 Mai 2019, 22:24:33
Und ein reread in Fhem bringt immer noch "timed out" ?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Cobra am 02 Mai 2019, 23:47:26
Ne, weiterhin 401 Unauthorized

Gerade nochmals versucht, hier das LOG:

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

2019.05.02 23:49:29 4: https://api.mcs3.miele.com/v1/devices/000119245250/?language=de: HTTP response code 401
2019.05.02 23:49:29 5: HttpUtils https://api.mcs3.miele.com/v1/devices/000119245250/?language=de: Got data, length: 29
2019.05.02 23:49:29 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Thu, 02 May 2019 21:49:29 GMT
Content-Type: application/vnd.miele.v1+json;charset=UTF-8
Content-Length: 29
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.05.02 23:49:29 4: myMieleWaschmaschine: Read callback: request type was update retry 0,
Body: { "message": "Unauthorized" }
2019.05.02 23:49:29 5: myMieleWaschmaschine: JSON Flatter called : prefix , ref is HASH(0x6b1e128)
2019.05.02 23:49:29 5: myMieleWaschmaschine: JSON Flatter sets message to Unauthorized
2019.05.02 23:49:29 4: myMieleWaschmaschine: extracted JSON values to internal
2019.05.02 23:49:29 5: myMieleWaschmaschine: ExtractSid called, context reading, num
2019.05.02 23:49:29 5: myMieleWaschmaschine: CheckAuth is checking buffer with ReAuthRegex Unauthorized
2019.05.02 23:49:29 4: myMieleWaschmaschine: CheckAuth decided new authentication required
2019.05.02 23:49:29 4: myMieleWaschmaschine: Auth called with Steps: 1 2 3
2019.05.02 23:49:29 4: myMieleWaschmaschine: AddToQueue adds auth3, initial queue len: 0, prio
2019.05.02 23:49:29 5: myMieleWaschmaschine: 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=xxxx&client_secret=xxxxx, no headers, retry 0
2019.05.02 23:49:29 4: myMieleWaschmaschine: AddToQueue adds auth2, initial queue len: 1, prio
2019.05.02 23:49:29 5: myMieleWaschmaschine: AddToQueue prepends type auth2 to URL https://api.mcs3.miele.com/oauth/auth, data email=xxxx&password=xxxx&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=xxxxx&vgInformationSelector=de-DE, no headers, ignore redirects, retry 0
2019.05.02 23:49:29 4: myMieleWaschmaschine: AddToQueue adds auth1, initial queue len: 2, prio
2019.05.02 23:49:29 5: myMieleWaschmaschine: AddToQueue prepends type auth1 to URL https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=xxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F, no data, no headers, retry 0
2019.05.02 23:49:29 5: myMieleWaschmaschine: HandleSendQueue called, qlen = 3
2019.05.02 23:49:29 4: myMieleWaschmaschine: HandleSendQueue sends request type auth1 to URL https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=xxxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F, No Data, No Header
timeout 2
2019.05.02 23:49:29 5: HttpUtils url=https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=xxxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
2019.05.02 23:49:29 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.05.02 23:49:29 4: myMieleWaschmaschine: AddToQueue adds update, initial queue len: 2
2019.05.02 23:49:29 5: myMieleWaschmaschine: AddToQueue adds type update to URL https://api.mcs3.miele.com/v1/devices/000119245250/?language=de, no data, header Authorization: Bearer $sid
Content-Type: application/json, retry 1
2019.05.02 23:49:29 5: myMieleWaschmaschine: HandleSendQueue called, qlen = 3
2019.05.02 23:49:29 5: myMieleWaschmaschine: HandleSendQueue - still waiting for reply to last request, delay sending from queue
2019.05.02 23:49:29 4: myMieleWaschmaschine: CheckAuth requeued request update after auth, retryCount 0 ...
2019.05.02 23:49:29 5: HttpUtils request header:
GET /thirdparty/login/?response_type=code&state=login&client_id=xxxxx&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.05.02 23:49:29 4: https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=xxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F: HTTP response code 200
2019.05.02 23:49:29 5: HttpUtils https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=xxxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F: Got data, length: 7610
2019.05.02 23:49:29 5: HttpUtils response header:
HTTP/1.1 200 OK
Date: Thu, 02 May 2019 21:49:29 GMT
Content-Type: text/html
Content-Length: 2174
Connection: close
Vary: Accept-Encoding
Content-Encoding: gzip
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.05.02 23:49:29 4: myMieleWaschmaschine: 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="xxxx">

        <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.05.02 23:49:29 3: myMieleWaschmaschine: error while parsing JSON data: malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "<html lang="de">\n<h...") at (eval 29128979) line 1.

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

2019.05.02 23:49:31 4: https://api.mcs3.miele.com/oauth/auth: HTTP response code 302
2019.05.02 23:49:31 5: HttpUtils https://api.mcs3.miele.com/oauth/auth: Got data, length: 0
2019.05.02 23:49:31 5: HttpUtils response header:
HTTP/1.1 302 Found
Date: Thu, 02 May 2019 21:49:31 GMT
Connection: close
Location: https://api.mcs3.miele.com/thirdparty/login/?code=DE_9bd4f9d409125ddaa6e46ed42bff17c6&state=login
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.05.02 23:49:31 4: myMieleWaschmaschine: Read callback: request type was auth2 retry 0, body empty
2019.05.02 23:49:31 5: myMieleWaschmaschine: ExtractSid called, context sid, num 2
2019.05.02 23:49:31 4: myMieleWaschmaschine: ExtractSid set sid to DE_9bd4f9d409125ddaa6e46ed42bff17c6
2019.05.02 23:49:31 5: myMieleWaschmaschine: HandleSendQueue called, qlen = 2
2019.05.02 23:49:31 4: myMieleWaschmaschine: HandleSendQueue sends request type auth3 to URL https://api.mcs3.miele.com/thirdparty/token/,
data: grant_type=authorization_code&code=DE_9bd4f9d409125ddaa6e46ed42bff17c6&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&client_id=xxxx&client_secret=xxxxx, No Header
timeout 2
2019.05.02 23:49:31 5: HttpUtils url=https://api.mcs3.miele.com/thirdparty/token/
2019.05.02 23:49:31 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.05.02 23:49:31 5: HttpUtils request header:
POST /thirdparty/token/ HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Content-Length: 234
Content-Type: application/x-www-form-urlencoded

2019.05.02 23:49:31 4: https://api.mcs3.miele.com/thirdparty/token/: HTTP response code 200
2019.05.02 23:49:31 5: HttpUtils https://api.mcs3.miele.com/thirdparty/token/: Got data, length: 151
2019.05.02 23:49:31 5: HttpUtils response header:
HTTP/1.1 200 OK
Date: Thu, 02 May 2019 21:49:31 GMT
Content-Type: application/json;charset=utf-8
Content-Length: 151
Connection: close
Location: https://api.mcs3.miele.com/thirdparty/login/
Strict-Transport-Security: max-age=15724800; includeSubDomains
2019.05.02 23:49:31 4: myMieleWaschmaschine: Read callback: request type was auth3 retry 0,
Body: {"access_token":"DE_f06b326333594bc5cefe70613f4f3327","refresh_token":"DE_d9b4d6f232d0b418e07b716a9fc35ff3","token_type":"Bearer","expires_in":2592000}
2019.05.02 23:49:31 5: myMieleWaschmaschine: JSON Flatter called : prefix , ref is HASH(0x6884970)
2019.05.02 23:49:31 5: myMieleWaschmaschine: JSON Flatter sets access_token to DE_f06b326333594bc5cefe70613f4f3327
2019.05.02 23:49:31 5: myMieleWaschmaschine: JSON Flatter sets expires_in to 2592000
2019.05.02 23:49:31 5: myMieleWaschmaschine: JSON Flatter sets token_type to Bearer
2019.05.02 23:49:31 5: myMieleWaschmaschine: JSON Flatter sets refresh_token to DE_d9b4d6f232d0b418e07b716a9fc35ff3
2019.05.02 23:49:31 4: myMieleWaschmaschine: extracted JSON values to internal
2019.05.02 23:49:31 5: myMieleWaschmaschine: ExtractSid called, context sid, num 3
2019.05.02 23:49:31 5: myMieleWaschmaschine: Checking SID with JSON access_token
2019.05.02 23:49:31 4: myMieleWaschmaschine: ExtractSid set sid to DE_f06b326333594bc5cefe70613f4f3327
2019.05.02 23:49:32 5: myMieleWaschmaschine: HandleSendQueue called, qlen = 1
2019.05.02 23:49:32 4: myMieleWaschmaschine: HandleSendQueue sends request type update to URL https://api.mcs3.miele.com/v1/devices/000119245250/?language=de, No Data,
header: Authorization: Bearer DE_f06b326333594bc5cefe70613f4f3327
Content-Type: application/json
timeout 2
2019.05.02 23:49:32 5: HttpUtils url=https://api.mcs3.miele.com/v1/devices/000119245250/?language=de
2019.05.02 23:49:32 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.05.02 23:49:32 5: HttpUtils request header:
GET /v1/devices/000119245250/?language=de HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Authorization: Bearer DE_f06b326333594bc5cefe70613f4f3327
Content-Type: application/json
Content-Length: 0

2019.05.02 23:49:32 4: https://api.mcs3.miele.com/v1/devices/000119245250/?language=de: HTTP response code 401
2019.05.02 23:49:32 5: HttpUtils https://api.mcs3.miele.com/v1/devices/000119245250/?language=de: Got data, length: 29
2019.05.02 23:49:32 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Thu, 02 May 2019 21:49:32 GMT
Content-Type: application/vnd.miele.v1+json;charset=UTF-8
Content-Length: 29
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.05.02 23:49:32 4: myMieleWaschmaschine: Read callback: request type was update retry 1,
Body: { "message": "Unauthorized" }
2019.05.02 23:49:32 5: myMieleWaschmaschine: JSON Flatter called : prefix , ref is HASH(0x6c414e0)
2019.05.02 23:49:32 5: myMieleWaschmaschine: JSON Flatter sets message to Unauthorized
2019.05.02 23:49:32 4: myMieleWaschmaschine: extracted JSON values to internal
2019.05.02 23:49:32 5: myMieleWaschmaschine: ExtractSid called, context reading, num
2019.05.02 23:49:32 5: myMieleWaschmaschine: CheckAuth is checking buffer with ReAuthRegex Unauthorized
2019.05.02 23:49:32 4: myMieleWaschmaschine: CheckAuth decided new authentication required
2019.05.02 23:49:32 4: myMieleWaschmaschine: Authentication still required but no retries left - did last authentication fail?
2019.05.02 23:49:32 5: myMieleWaschmaschine: Read starts parsing response to update with defined readings: 06
2019.05.02 23:49:32 5: myMieleWaschmaschine: ExtractReading state with json state_status_value_raw ...
2019.05.02 23:49:32 5: myMieleWaschmaschine: ExtractReading state with json state_status_value_raw did not match a key directly - trying regex match to create a list
2019.05.02 23:49:32 5: myMieleWaschmaschine: ExtractReading state with json /^state_status_value_raw/ got keylist
2019.05.02 23:49:32 5: myMieleWaschmaschine: ExtractReading state did not match
2019.05.02 23:49:32 3: myMieleWaschmaschine: Read response to update didn't match any Reading
2019.05.02 23:49:32 5: myMieleWaschmaschine: HandleSendQueue called, qlen = 0
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 03 Mai 2019, 07:13:53
Das ist aber schon mal viel besser: du kriegst jetzt von sid3 ein Token (Bearer); vorher warst Du bei sid2 schon weg.

Nur dann, wenn er die "devices" Seite mit diesem Token aufruft, scheint es nicht zu funktionieren. Das muss ich mir anschauen. Heute Abend oder eher am Wochenende.

EDIT: versuch mal nur testweise, deine User/Passwort und den Language selector noch am Ende von sid3Data hinzufügen:
<was es schon gibt>&username=EMAIL&password=PASSWORT&vg=de-DE
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: det. am 03 Mai 2019, 09:21:17
Zitat von: amenomade am 03 Mai 2019, 07:13:53
EDIT: versuch mal nur testweise, deine User/Passwort und den Language selector noch am Ende von sid3Data hinzufügen:
<was es schon gibt>&username=EMAIL&password=PASSWORT&vg=de-DE
Danke, aber das ändert leider nichts an der Sache.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xasher am 03 Mai 2019, 17:04:40
Hallo zusammen,

auch wenn ich zur Lösung nicht beitragen kann, aber bei mir war das letzte Reading am     
2019-04-29 09:45:43. Danach kam 401
Das Problem scheint also mehrere zu betreffen. Davor ging es sehr gut eigentlich.
Direkt in der Miele Api: https://www.miele.com/developer/swagger-ui/index.html (https://www.miele.com/developer/swagger-ui/index.html)
kommt nachdem ich die BearerID eingebe und eine "Authorization" mit meiner ClientID durchführen möchte die Meldung: "TypeError: NetworkError when attempting to fetch resource."

Grüße,
Alex
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 04 Mai 2019, 13:20:19
Die Probleme scheinen bei den Miele-Servern zu liegen.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 04 Mai 2019, 13:44:25
Wenn ihr euch über https://www.miele.de/ > Mein Konto anmeldet, bzw. wenn ihr die App nutzt, funktioniert es und seht ihr eure Geräte?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 04 Mai 2019, 13:47:36
Ja, die App nutzt aber nicht die 3rd Party-API.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 04 Mai 2019, 13:49:33
Ja klar, nur um sicher zu stellen, dass die die Zugangsdaten nicht irgendwie zerstören haben
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: det. am 04 Mai 2019, 14:05:46
Zitat von: amenomade am 04 Mai 2019, 13:44:25
Wenn ihr euch über https://www.miele.de/ (https://www.miele.de/) > Mein Konto anmeldet, bzw. wenn ihr die App nutzt, funktioniert es und seht ihr eure Geräte?
Ja da ist alles wie gewünscht vorhanden
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 04 Mai 2019, 14:25:58
Kann jemand mit gültigen Zugangsdaten und Geräte mit Postman (siehe Anfang der Diskussion)  probieren? Bei mir gibt es auch Unauthorized, aber das hatte ich schon immer, da ich kein gültiges Device mit meinem Test-Konto verknüpft habe.

Oder wer mir vertraut kann mir seine Zugangsdaten inkl. ClientId ClientSecret per PN schicken (Passwort kann man vorher ändern, und danach zurücksetzen), damit ich selbst testen kann. Wie ihr wollt. Aber da zwinge ich niemanden und kann schon verstehen, dass ihr das nicht wollt.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: det. am 04 Mai 2019, 14:44:17
siehe pm
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 04 Mai 2019, 14:45:10
Hab von det. bekommen. Die andere brauchen nicht zu schicken, danke.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 04 Mai 2019, 14:55:58
Das geht mit Postman auch nicht. Laut TE ging das aber. Ich gehe davon aus, dass die API nicht mehr richtig funktioniert. Kann sich jemand bei developer@miele.com melden?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: tjareson am 06 Mai 2019, 11:37:34
Hallo zusammen,

habe hier den gleichen Fehler - 401.
Hat das schon jemand an Miele weitergegeben?
Ansonsten kann ich das machen, wenn mir jemand kurz umreissen kann, an welcher Stelle es genau stecken bleibt, da ich mit REST api nicht sonderlich vertraut bin.

besten Gruß
Tjareson
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 06 Mai 2019, 13:24:26
ZitatAnsonsten kann ich das machen, wenn mir jemand kurz umreissen kann, an welcher Stelle es genau stecken bleibt, da ich mit REST api nicht sonderlich vertraut bin.
Die Erneuerung des oauth Token ist efolgreich. Der Aufruf der Seite https://api.mcs3.miele.com/v1/devices/?language=de oder /v1/device/[deviceid] mit in den Headers "Authorization: Bearer NEUES_TOKEN" funktioniert dann nicht mehr.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: tjareson am 06 Mai 2019, 23:15:22
Ok, Danke. Ich habe das mal heute so bei Miele mitgeteilt an die developer email. Wäre vielleicht sinnvoll, wenn andere betroffene das auch machen würden.
Im Moment verhält sich übrigens auch die Miele-App etwas sonderbar. Unter der Funktion "Vorrat" taucht der Hinweis auf fehlende Internetverbindung auf, obwohl der Rest geht. Das ist ürbigens auch nicht nur bei mir so. 
Mit cloud scheint es da im Moment ein Thema zu geben...

Tjareson
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xasher am 10 Mai 2019, 11:24:41
Das Problem scheint sich ja nicht von selbst zu lösen. Ich habe jetzt ebenfalls an Miele geschrieben.
Mich verwundert, dass es teilweise bei einigen Anwendern geht, bei anderen nicht. Unabhängig von FHEM geht es auf der Miele API Webseite bei mir auch nicht...

Grüße,
Alex
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 10 Mai 2019, 15:05:37
Kann mich nicht erinnern, dass hier jemand gesagt hat, dass die 3rd party API noch geht. Lediglich die App (zumindest iOS) geht, die benutzt aber nicht die 3rd party API.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: det. am 10 Mai 2019, 18:02:13
Da man offenbar keine negativen Bewertungen mehr abgeben kann - für die Kindergartenkinder: Ja, ja es haben noch weitere Leute an Miele geschrieben, aber das hier kundzutun ohne eine Antwort bekommen zu haben, macht überhaupt keinen Sinn. Warten wir ab, die Geräte funktionieren genauso gut bis dahin ohne Fhem.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 10 Mai 2019, 18:21:54
Naja... Das habt ihr akzeptiert: https://www.miele.com/developer/terms-of-use.html
Zitat1.5 Modifications

Miele reserves the right to update or to modify the Miele 3rd-party API and its terms and conditions of use from time to time at its own discretion.

Miele shall inform you in the event of modifications to the Miele 3rd-party API and its terms and conditions of use and point out the modified terms. Should you no longer wish to continue the licence under the modified terms, you may terminate the licence granted to you at any time by ending your access to the API.

Miele reserves the right to modify, temporarily suspend or permanently discontinue the Miele 3rd-party API at any time and without notice.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 12 Mai 2019, 14:18:09
Hallo zusammen,

ich kann leider auch nur bestätigen, dass ich seit unbestimmter Zeit das Problem habe und das Unauthorized zurück kommt.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xasher am 13 Mai 2019, 15:00:04
Hallo,

in der Hoffnung nicht mehr negativbewertungsverdächtig zu sein, will ich die Antwort von Miele posten:

Zitat
Dear Alex

Thank you for your email. Due to a server movement we've problems with some of our accounts.
May we ask you to help us finding the issue.
Please be so kind:
-          Generate a new access token
-          Send a new request to the API
-          If the failure still exist, please tell us the time of the day of your request.

Thank you very much for your support.

Kind regards
Miele 3rd party API Team

Vielleicht können das mehrere machen, damit die Nachvollziehbarkeit durch mehr Daten höher ist.
Anbei gleich die Frage: Wie bekommt man ein neues Access_token?

Grüße,
Alex
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 13 Mai 2019, 15:17:49
Wenn du in deinem httpmod "set xx reread" ausführst, sollte ein neuer Token angefordert werden, sofern dein Status unauthorized ist.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: demel42 am 13 Mai 2019, 16:25:26
Hallo,

ich bin zwar kein FHEM-Anwender sondern benutze IP-Symcon, aber ich/wir habe(n) das gleiche Problem (https://www.symcon.de/forum/threads/34249-Miele-Home-XKM-3100W-Protokollanalyse/page14 (https://www.symcon.de/forum/threads/34249-Miele-Home-XKM-3100W-Protokollanalyse/page14)).
Seit dem 29.4. geht der bislang funktionierende Datenabruf nicht mehr. Ich weis nicht genau, wieviele User mein Modul benutzen, aber ein paar haben sich gemeldet wegen genau dieses Problems.

Ich habe diverse Mails schon mit Miele (developer@miele.com) ausgetauscht, wenig sinnvolle Antworten bekommt und habe seit mehr einer Woche auf meine letzten Mails gar nichts mehr gehört.

Erst hatte Miele geantwortet, das sie Serverproblem hatten, die aber beseitig seien. Dann gab es eine Antwort von Miele war analog zu der o.g. Mail an xasher. Habe ich natürlich gemacht, hat aber nichts gebracht. Und dann hatte Sie alternative Vorschläge was den HTTP-Header angeht ...

In der API-Beschreibung von Miele (https://www.miele.com/developer/swagger-ui/index.html (https://www.miele.com/developer/swagger-ui/index.html)) gibt es die Möglichkeit die Abrufe direkt zu testen mit entsprechender Eingabemöglichkeit.
Dort wird auch ausgegeben, wie passende wget-Aufrufe aussehen sollten; damit kann man die Abrufe auch auf der Shell nachvollziehen.
Aber weder so, noch mit der Test-Funktionen auf dieser offiziellen Seite gab's mehr als den "Unauthorized"-Fehler.
Das habe ich nochmal ausführlich geschildert, aber keine Antwort mehr bekommen.

Meine einige Hoffnung liegt im Augenblick darin, das das Problem irgendwann gelöst wird. Es wäre aus meiner Sicht hilfreich, wenn möglichst viele Leute sich bei Miele (developer@miele.com) melden.

Gruß
demel
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xasher am 13 Mai 2019, 18:15:06
Zitat von: xerion am 13 Mai 2019, 15:17:49
Wenn du in deinem httpmod "set xx reread" ausführst, sollte ein neuer Token angefordert werden, sofern dein Status unauthorized ist.

Das habe ich auch schon gemacht. Was mir nicht klar ist, wo sieht man den neuen token? In den (meinen) Readings auf jeden Fall nicht.

Grüße,
Alex
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 13 Mai 2019, 18:16:04
Im Internal sid
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 15 Mai 2019, 12:20:59
Hallo zusammen, es gibt scheinbar gute Nachrichten.
Ich habe gerade noch einmal ein reread ausgeführt und siehe da, Verbindung steht wieder. :)
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 01 August 2019, 18:39:10
Heute von Miele bekommen:
Zitat

Dear users of the Miele 3rd Party API,



Today marks the end of the beta phase of the Miele 3rd Party API. Tomorrow we will officially release version 1.0 of the API. We would like to express our thanks to all participants of the beta phase and also thank you for the feedback we received. Not all wishes and suggestions could be considered directly, but we promise to continuously add changes and improvements and will welcome your feedback and suggestions at any time (included them in our backlog).



What's new (changes)?

First of all we have adapted our Terms of Use, this was necessary to allow commercial users to use the API.

In addition, we made small adjustments to individual endpoints, for example the spinningSpeed is now localized.

We have also increased the number of possible actions. Before an action is executed on a device, a GET action can be used to check which actions are available.



What's next?

We are going to change the registration process. With this new process, there is no need to request login information via email. Client ID and client secret can be created directly on developer.miele.com.
However, with this change it is necessary for all API users to create new credentials. The old credentials will expire 30 days after the introduction date of the new registration.
We will soon inform you about the date of the change by email.



Thanks again for participating in the beta program.



Best regards

Your Miele 3rd Party API Team

Miele & Cie. KG | Carl-Miele-Straße 29 | 33332 Gütersloh | Germany
developer@miele.com | developer.miele.com
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Fritz Muster am 09 August 2019, 09:56:35
Hallo in die Runde,

ich komme seit dem 05.08. nicht mehr auf die Miele Cloud (401 Unauthorized). Ich habe bereits neue Client ID und Client Secret beantragt und auch schon bekommen und eingepflegt. Zugriff funktioniert weder mit der neuen noch mit den alten ID/Secret.

Funktioniert bei Euch der Zugriff?

Danke und Grüße
Fritz
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 12 August 2019, 15:53:50
Bist Du einmal auf der Miele-Seite gewesen und hast das "Authorize" durchgeführt?

Bei mir funktionierte es danach wieder auch mit den alten Credentials.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 12 August 2019, 22:31:15
Zitat von: volschin am 12 August 2019, 15:53:50
Bist Du einmal auf der Miele-Seite gewesen und hast das "Authorize" durchgeführt?

Bei mir funktionierte es danach wieder auch mit den alten Credentials.

Ich kann volschin nur zustimmen, habe auch auf der Miele Seite "Autohorize" erneut durchgeführt mit den vorhandenen Daten und die Verbindung war sofort wieder vorhanden....
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Fritz Muster am 15 August 2019, 15:11:29
Zitat von: volschin am 12 August 2019, 15:53:50
Bist Du einmal auf der Miele-Seite gewesen und hast das "Authorize" durchgeführt?

Ja, habe ich gemacht. Bekomme aber im Moment nicht mehr "401 Unauthorized" sondern jetzt "500 Internal Server" Error.

Eigentlich bin ich mir ziemlich sicher das ich am Device/Attributen nichts geändert habe, EIGENTLICH!! ;-)

Wenn etwas Zeit da ist, werde ich mal ein neues Device anlegen und prüfen ob das funktioniert.

Danke und Grüße
Fritz
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 16 August 2019, 08:02:59
Ich habe jetzt auch den Fehler 500

Gesendet von meinem JSN-L21 mit Tapatalk

Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 16 August 2019, 08:06:54
Kann ich so bestätigen.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Fritz Muster am 16 August 2019, 11:06:01
Danke für die Rückmeldung!

Viele Grüße
Fritz
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 16 August 2019, 11:11:56
Fakt ist aber leider auch, dass die Schnittstelle über die swagger-UI der Developer-Seite anscheinend sauber funktioniert.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 16 August 2019, 11:58:43
Problem liegt anscheinend in der Beschaffung des Bearer Tokens.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 16 August 2019, 12:28:12
Bearer Token hart anstatt $sid eingetragen und es läuft. Ist also definitiv ein Problem der Tokenbeschaffung.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 17 August 2019, 10:33:13
Für mich sieht das nach erster Analyse sehr nach Bug aus. Ich frage mit einem fehlerhaften Bearer-Token an und müsste eigentlich einen 401 Unauthorized bekommen, es kommt aber ein 500.
Dadurch kann auch kein Authorization Flow gestartet werden.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 17 August 2019, 10:40:01
Ich habe jetzt
reAuthRegex 500 Internal Server Error
gesetzt und schon funzt es wieder.

Bis Miele die nächste Änderung macht.  :(
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 17 August 2019, 11:08:04
Danke..... funktioniert bei mir auch wieder.

Gesendet von meinem JSN-L21 mit Tapatalk

Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Fritz Muster am 19 August 2019, 09:24:15
Zitat von: volschin am 17 August 2019, 10:40:01
Ich habe jetzt
reAuthRegex 500 Internal Server Error
gesetzt und schon funzt es wieder.

Bis Miele die nächste Änderung macht.  :(

Habe das mal in meinem kleinen Tutorial (https://forum.fhem.de/index.php/topic,95989.msg915870.html#msg915870) angepasst.

Grüße Fritz

Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: alkazaa am 28 August 2019, 17:18:42
Hallo,
ich verfolge diesen thread mit großem Interesse, da ich auch versuche, ein Miele-Gerät in FHEM einzubinden.
Ich bekomme aber nur die berüchtigte Meldung
HTTP/1.1 401 Unauthorized
Date: Wed, 28 Aug 2019 15:00:23 GMT
Content-Type: text/html
Connection: close

obwohl ich über die Miele 3rd party API problemlos auf mein Gerät zugreifen kann.

Hier das listing meines httpmod device:
Internals:
   BUSY       0
   CHANGED   
   DEF        https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de 120
   FUUID      5d62d5f7-f33f-a50b-2bed-a45707ea58fbae04
   Interval   120
   JSONEnabled 1
   LASTSEND   1567003583.32655
   MainURL    https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de
   ModuleVersion 3.5.9 - 13.2.2019
   NAME       Dunsthaube
   NOTIFYDEV  global
   NR         61
   NTFY_ORDER 50-Dunsthaube
   STATE      ???
   TRIGGERTIME 1567003703.32461
   TRIGGERTIME_FMT 2019-08-28 16:48:23
   TYPE       HTTPMOD
   addr       https://api.mcs3.miele.com:443
   auth       0
   code       401
   compress   1
   conn       
   data       
   displayurl https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de
   header     Authorization: Bearer $sid
Content-Type: application/json
   host       api.mcs3.miele.com
   httpheader HTTP/1.1 401 Unauthorized
Date: Wed, 28 Aug 2019 14:46:23 GMT
Content-Type: text/html
Connection: close
   httpversion 1.0
   hu_blocking 0
   hu_filecount 334
   hu_port    443
   hu_portSfx
   ignoreredirects 0
   loglevel   4
   path       /v1/devices/000xxxxxxxxx/?language=de
   protocol   https
   redirects  0
   timeout    2
   url        https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de
   value      0
   QUEUE:
   READINGS:
     2019-08-26 19:11:22   Drehgeschwindigkeit-1 Drehgeschwindigkeit
     2019-08-26 19:11:22   Drehgeschwindigkeit-2 U/min
   REQUEST:
     data       
     header     Authorization: Bearer $sid
Content-Type: application/json
     ignoreredirects 0
     retryCount 0
     type       update
     url        https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de
     value      0
   sslargs:
Attributes:
   disable    0
   enableControlSet 1
   reAuthRegex 500 Internal Server Error
   reading01JSON Drehgeschwindigkeit
   reading01Name state_spinningSpeed
   requestHeader01 Authorization: Bearer $sid
   requestHeader02 Content-Type: application/json
   room       Haus
   sid1URL    https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=meine_clientID&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
   sid2Data   email=mailadresse@gmx.de&password=xxxxxxxx&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=meine_clientID&vgInformationSelector=de-DE
   sid2IdRegex (?s)code=(DE_[0-9a-f]+)
   sid2IgnoreRedirects 1
   sid2URL    https://api.mcs3.miele.com/oauth2/auth
   sid3Data   grant_type=authorization_code&code=$sid&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&client_id=meine_clientID&client_secret=mein_secret
   sid3IdJSON access_token
   sid3URL    https://api.mcs3.miele.com/thirdparty/token/
   userattr   reading01JSON reading01Name requestHeader01 requestHeader02 sid1URL sid2Data sid2IdRegex sid2IgnoreRedirects:0,1 sid2URL sid3Data sid3IdJSON sid3URL
   verbose    5


Im Vergleich zu anderen listings weiter vorne in diesem thread fiel mir auf, dass bei meinem listing folgende Zeilen fehlen, die in den anderen listings nach der Zeile "Connection: close" auftauchen:
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


Was fehlt in meiner FHEM Installation?

Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 28 August 2019, 18:29:35
Versuch mit
reAuthRegex 500.Internal.Server.Error|Unauthorized|default.backend...401
Ansonsten, bitte Log mit verbose 5 liefern

EDIT: Regex korrigiert
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: alkazaa am 28 August 2019, 19:35:24
Danke für die schnelle Reaktion!
(Das ist ein tolles Forum hier!!)

Also, nach dem geänderten reAuthRegex passiert folgendes (log Auszug mit verbose 5):
2019.08.28 19:12:24 4: Dunsthaube: GetUpdate called (update)
2019.08.28 19:12:24 4: Dunsthaube: update timer modified: will call GetUpdate in 120.0 seconds at 2019-08-28 19:14:24
2019.08.28 19:12:24 4: Dunsthaube: AddToQueue adds update, initial queue len: 0
2019.08.28 19:12:24 5: Dunsthaube: AddToQueue adds type update to URL https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de, no data, header Authorization: Bearer $sid
Content-Type: application/json, retry 0
2019.08.28 19:12:24 5: Dunsthaube: HandleSendQueue called, qlen = 1
2019.08.28 19:12:24 4: Dunsthaube: HandleSendQueue sends request type update to URL https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de, No Data,
header: Authorization: Bearer $sid
Content-Type: application/json
timeout 2
2019.08.28 19:12:24 5: HttpUtils url=https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de
2019.08.28 19:12:24 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.08.28 19:12:24 5: HttpUtils request header:
GET /v1/devices/000xxxxxxxxx/?language=de HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Authorization: Bearer $sid
Content-Type: application/json

2019.08.28 19:12:24 4: https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de: HTTP response code 401
2019.08.28 19:12:24 5: HttpUtils https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de: Got data, length: 21
2019.08.28 19:12:24 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Wed, 28 Aug 2019 17:12:24 GMT
Content-Type: text/html
Connection: close
2019.08.28 19:12:24 4: Dunsthaube: Read callback: request type was update retry 0,
Body: default backend - 401
2019.08.28 19:12:24 3: Dunsthaube: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "default backend - 40...") at (eval 2270) line 1.

2019.08.28 19:12:24 5: Dunsthaube: ExtractSid called, context reading, num
2019.08.28 19:12:24 5: Dunsthaube: CheckAuth is checking buffer with ReAuthRegex 500 Internal Server Error
2019.08.28 19:12:24 4: Dunsthaube: CheckAuth decided no authentication required
2019.08.28 19:12:24 5: Dunsthaube: Read starts parsing response to update with defined readings: 01
2019.08.28 19:12:24 5: Dunsthaube: ExtractReading state_spinningSpeed with json Drehgeschwindigkeit ...
2019.08.28 19:12:24 5: Dunsthaube: ExtractReading state_spinningSpeed did not match
2019.08.28 19:12:24 3: Dunsthaube: Read response to update didn't match any Reading
2019.08.28 19:12:24 5: Dunsthaube: HandleSendQueue called, qlen = 0
2019.08.28 19:12:54 5: Dunsthaube: set called with reread
2019.08.28 19:12:54 4: Dunsthaube: GetUpdate called (reread)
2019.08.28 19:12:54 4: Dunsthaube: AddToQueue adds update, initial queue len: 0
2019.08.28 19:12:54 5: Dunsthaube: AddToQueue adds type update to URL https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de, no data, header Authorization: Bearer $sid
Content-Type: application/json, retry 0
2019.08.28 19:12:54 5: Dunsthaube: HandleSendQueue called, qlen = 1
2019.08.28 19:12:54 4: Dunsthaube: HandleSendQueue sends request type update to URL https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de, No Data,
header: Authorization: Bearer $sid
Content-Type: application/json
timeout 2
2019.08.28 19:12:54 5: HttpUtils url=https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de
2019.08.28 19:12:54 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.08.28 19:12:54 5: HttpUtils request header:
GET /v1/devices/000xxxxxxxxx/?language=de HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Authorization: Bearer $sid
Content-Type: application/json

2019.08.28 19:12:54 4: https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de: HTTP response code 401
2019.08.28 19:12:54 5: HttpUtils https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de: Got data, length: 21
2019.08.28 19:12:54 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Wed, 28 Aug 2019 17:12:54 GMT
Content-Type: text/html
Connection: close
2019.08.28 19:12:54 4: Dunsthaube: Read callback: request type was update retry 0,
Body: default backend - 401
2019.08.28 19:12:54 3: Dunsthaube: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "default backend - 40...") at (eval 2279) line 1.

2019.08.28 19:12:54 5: Dunsthaube: ExtractSid called, context reading, num
2019.08.28 19:12:54 5: Dunsthaube: CheckAuth is checking buffer with ReAuthRegex reAuthRegex 500.Internal.Server.Error|Unauthorized|default.backend...401
2019.08.28 19:12:54 4: Dunsthaube: CheckAuth decided new authentication required
2019.08.28 19:12:54 4: Dunsthaube: Auth called with Steps: 1 2 3
2019.08.28 19:12:54 4: Dunsthaube: AddToQueue adds auth3, initial queue len: 0, prio
2019.08.28 19:12:54 5: Dunsthaube: 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=my_client-ID&client_secret=my_client-secret, no headers, retry 0
2019.08.28 19:12:54 4: Dunsthaube: AddToQueue adds auth2, initial queue len: 1, prio
2019.08.28 19:12:54 5: Dunsthaube: AddToQueue prepends type auth2 to URL https://api.mcs3.miele.com/oauth2/auth, data email=email@gmx.de&password=*******&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=my_client-ID&vgInformationSelector=de-DE, no headers, ignore redirects, retry 0
2019.08.28 19:12:54 4: Dunsthaube: AddToQueue adds auth1, initial queue len: 2, prio
2019.08.28 19:12:54 5: Dunsthaube: AddToQueue prepends type auth1 to URL https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=my_client-ID&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F, no data, no headers, retry 0
2019.08.28 19:12:54 5: Dunsthaube: HandleSendQueue called, qlen = 3
2019.08.28 19:12:54 4: Dunsthaube: HandleSendQueue sends request type auth1 to URL https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=my_client-ID&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F, No Data, No Header
timeout 2
2019.08.28 19:12:54 5: HttpUtils url=https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=my_client-ID&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
2019.08.28 19:12:54 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.08.28 19:12:54 4: Dunsthaube: AddToQueue adds update, initial queue len: 2
2019.08.28 19:12:54 5: Dunsthaube: AddToQueue adds type update to URL https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de, no data, header Authorization: Bearer $sid
Content-Type: application/json, retry 1
2019.08.28 19:12:54 5: Dunsthaube: HandleSendQueue called, qlen = 3
2019.08.28 19:12:54 5: Dunsthaube: HandleSendQueue - still waiting for reply to last request, delay sending from queue
2019.08.28 19:12:54 4: Dunsthaube: CheckAuth requeued request update after auth, retryCount 0 ...
2019.08.28 19:12:55 5: HttpUtils request header:
GET /thirdparty/login/?response_type=code&state=login&client_id=my_client-ID&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

2019.08.28 19:12:55 4: https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=my_client-ID&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F: HTTP response code 200
2019.08.28 19:12:55 5: HttpUtils https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=my_client-ID&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F: Got data, length: 6307
2019.08.28 19:12:55 5: HttpUtils response header:
HTTP/1.1 200 OK
Date: Wed, 28 Aug 2019 17:12:55 GMT
Content-Type: text/html
Content-Length: 2210
Connection: close
Vary: Accept-Encoding
Content-Encoding: gzip
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: PUT, GET, POST, 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.08.28 19:12:55 4: Dunsthaube: Read callback: request type was auth1 retry 0,
Body: <html lang="de">
<head>
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta charset="utf-8">
<!-- 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==">
<!--Import Google Icon Font-->
<!--Import materialize.css-->
<!--Import own css-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="/assets/css/materialize.min.css?1556550173384">
<link type="text/css" rel="stylesheet" href="/assets/css/mieleStyle.css?1556550173387"
media="screen,projection"/>
<!-- Import scrips -->
<!-- Compiled and minified JavaScript -->
<script src="/assets/js/materialize.min.js?1556550173386"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
M.FormSelect.init(document.querySelectorAll('select'));
});
</script>
</head>
<body id="mieleLoginSite">
<div class="container">
<div class="row">
<div class="col s12 m8 offset-m2 offset-l2 l8">
<div class="center">
<img class="responsive-img"
src="/assets/images/miele_logo.svg" width="150" alt="miele.com"/>
</div>
<h1 class="center 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 Address</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>
<!-- add here all hidden inputs -->
<input type="hidden" name="response_type" value="code">
<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="client_id" value="my_client-ID">
<div class="input-field" style="margin-top: 25px;">
<i class="material-icons prefix no-margin">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>
<div class="center">
<button class="btn waves-effect waves-light miele-red"
type="submit">Submit</button>
</div>
</form>
</div>
</div>
</body>
</html>
2019.08.28 19:12:55 3: Dunsthaube: 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 2281) line 1.

2019.08.28 19:12:55 5: Dunsthaube: ExtractSid called, context sid, num 1
2019.08.28 19:12:55 5: Dunsthaube: HandleSendQueue called, qlen = 3
2019.08.28 19:12:55 4: Dunsthaube: HandleSendQueue sends request type auth2 to URL https://api.mcs3.miele.com/oauth2/auth,
data: email=email@gmx.de&password=*******&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=my_client-ID&vgInformationSelector=de-DE, No Header
timeout 2
2019.08.28 19:12:55 5: HttpUtils url=https://api.mcs3.miele.com/oauth2/auth
2019.08.28 19:12:55 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.08.28 19:12:56 5: HttpUtils request header:
POST /oauth2/auth HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Content-Length: 221
Content-Type: application/x-www-form-urlencoded

2019.08.28 19:12:56 4: https://api.mcs3.miele.com/oauth2/auth: HTTP response code 401
2019.08.28 19:12:56 5: HttpUtils https://api.mcs3.miele.com/oauth2/auth: Got data, length: 21
2019.08.28 19:12:56 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Wed, 28 Aug 2019 17:12:56 GMT
Content-Type: text/html
Connection: close
2019.08.28 19:12:56 4: Dunsthaube: Read callback: request type was auth2 retry 0,
Body: default backend - 401
2019.08.28 19:12:56 3: Dunsthaube: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "default backend - 40...") at (eval 2285) line 1.

2019.08.28 19:12:56 5: Dunsthaube: ExtractSid called, context sid, num 2
2019.08.28 19:12:56 5: Dunsthaube: ExtractSid could not match buffer to IdRegex (?s)code=(DE_[0-9a-f]+)
2019.08.28 19:12:56 5: Dunsthaube: HandleSendQueue called, qlen = 2
2019.08.28 19:12:56 4: Dunsthaube: 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=my_client-ID&client_secret=my_client-secret, No Header
timeout 2
2019.08.28 19:12:56 5: HttpUtils url=https://api.mcs3.miele.com/thirdparty/token/
2019.08.28 19:12:56 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.08.28 19:12:57 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.08.28 19:12:57 4: https://api.mcs3.miele.com/thirdparty/token/: HTTP response code 500
2019.08.28 19:12:57 5: HttpUtils https://api.mcs3.miele.com/thirdparty/token/: Got data, length: 42
2019.08.28 19:12:57 5: HttpUtils response header:
HTTP/1.1 500 Internal Server Error
Date: Wed, 28 Aug 2019 17:12:57 GMT
Content-Type: text/plain
Content-Length: 42
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: PUT, GET, POST, 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.08.28 19:12:57 4: Dunsthaube: Read callback: request type was auth3 retry 0,
Body: no vg given. grant_type=AUTHORIZATION_CODE
2019.08.28 19:12:57 3: Dunsthaube: error while parsing JSON data: 'null' expected, at character offset 0 (before "no vg given. grant_t...") at (eval 2287) line 1.

2019.08.28 19:12:57 5: Dunsthaube: ExtractSid called, context sid, num 3
2019.08.28 19:12:57 5: Dunsthaube: Checking SID with JSON access_token
2019.08.28 19:12:57 5: Dunsthaube: HandleSendQueue called, qlen = 1
2019.08.28 19:12:57 4: Dunsthaube: HandleSendQueue sends request type update to URL https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de, No Data,
header: Authorization: Bearer $sid
Content-Type: application/json
timeout 2
2019.08.28 19:12:57 5: HttpUtils url=https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de
2019.08.28 19:12:57 4: IP: api.mcs3.miele.com -> 157.97.106.171
2019.08.28 19:12:58 5: HttpUtils request header:
GET /v1/devices/000xxxxxxxxx/?language=de HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Authorization: Bearer $sid
Content-Type: application/json

2019.08.28 19:12:58 4: https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de: HTTP response code 401
2019.08.28 19:12:58 5: HttpUtils https://api.mcs3.miele.com/v1/devices/000xxxxxxxxx/?language=de: Got data, length: 21
2019.08.28 19:12:58 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Date: Wed, 28 Aug 2019 17:12:58 GMT
Content-Type: text/html
Connection: close
2019.08.28 19:12:58 4: Dunsthaube: Read callback: request type was update retry 1,
Body: default backend - 401
2019.08.28 19:12:58 3: Dunsthaube: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "default backend - 40...") at (eval 2289) line 1.

2019.08.28 19:12:58 5: Dunsthaube: ExtractSid called, context reading, num
2019.08.28 19:12:58 5: Dunsthaube: CheckAuth is checking buffer with ReAuthRegex reAuthRegex 500.Internal.Server.Error|Unauthorized|default.backend...401
2019.08.28 19:12:58 4: Dunsthaube: CheckAuth decided new authentication required
2019.08.28 19:12:58 4: Dunsthaube: Authentication still required but no retries left - did last authentication fail?
2019.08.28 19:12:58 5: Dunsthaube: Read starts parsing response to update with defined readings: 01
2019.08.28 19:12:58 5: Dunsthaube: ExtractReading state_spinningSpeed with json Drehgeschwindigkeit ...
2019.08.28 19:12:58 5: Dunsthaube: ExtractReading state_spinningSpeed did not match
2019.08.28 19:12:58 3: Dunsthaube: Read response to update didn't match any Reading
2019.08.28 19:12:58 5: Dunsthaube: HandleSendQueue called, qlen = 0


Dabei ist die Aktivität um 19:12:24 das letzte der alle 2 Minuten stattfindenden "GetUpdate called (update)", und ab 19:12:54 passiert das manuell gestartete reread ("set called with reread").

Nochmals Danke fürs Kümmern!
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 28 August 2019, 20:08:26
Er kriegt kein DE_xxxxx Code.

Wenn die folgende Seite in einem Browser aufrufst:
https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=DEIN_CLIENTID&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
(mit richtigem DEIN_CLIENTID), und dich dort anmeldest, kriegst Du in der zurückgelieferte URL
https://api.mcs3.miele.com/thirdparty/login/?code=DE_xxxxxxxxxxxxxxxxxxxxxxxxxx&state=login?
(nur die URL ist interessant, der Inhalt der Seite ist unrelevant - vermutlich ist es "Kontoverknüpfung fehlgeschlagen!", macht aber nichts)

Wenn nicht, prüfe dein ClientID und deine Zugangsdaten, die stimmen nicht miteinander

Wenn OK, dann prüfe in deiner HTTPMOD Definition die gleiche Daten: ClientID, ClientSecret, user, passwort
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: alkazaa am 28 August 2019, 20:39:27
Sorry, ich hätte sagen sollen, dass ich den Test schon gemacht hatte, und es gab so einen DE_xxxxx code in der URL.

Und über https://www.miele.com/developer/swagger-ui/index.html kann ich mich mit der client_ID, dem client_secret sowie der email-adresse und passwort (alle per Strg_C und Strg-V aus FHEM rüberkopiert) erfolgreich "authorizen" lassen. Ich kann dann anschließend z.B. den  "GET ​/v1​/devices​/" Test-case ausführen und finde in der Antwort die korrekte Seriennummer des Geräts.

Ich denke, irgendwas anderes muss bei meinem setup faul sein.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 28 August 2019, 21:07:57
Zitat von: alkazaa am 28 August 2019, 20:39:27
Sorry, ich hätte sagen sollen, dass ich den Test schon gemacht hatte, und es gab so einen DE_xxxxx code in der URL.
Kommt aber nicht zurück beim HTTPMOD. Ist dein Client-Secret bei sid1URL und sid2Data richtig? Email und Passwort auch?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 28 August 2019, 21:26:29
Nach
ZitatPOST /oauth2/auth HTTP/1.0
Host: api.mcs3.miele.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
Content-Length: 221
Content-Type: application/x-www-form-urlencoded

Soll folgendes zurückkommen:
Zitat2019.08.28 21:13:41 4: https://api.mcs3.miele.com/oauth/auth: HTTP response code 302
2019.08.28 21:13:41 5: HttpUtils https://api.mcs3.miele.com/oauth/auth: Got data, length: 0
2019.08.28 21:13:41 5: HttpUtils response header:
HTTP/1.1 302 Found

Date: Wed, 28 Aug 2019 19:13:41 GMT

Connection: close

Location: https://api.mcs3.miele.com/thirdparty/login/?code=DE_4ef03cdabd95bacexxxxxxxxxxxxxxxx&state=login

Access-Control-Allow-Origin: *

Access-Control-Allow-Credentials: true

Access-Control-Allow-Methods: PUT, GET, POST, OPTIONS

Du kriegst aber
Zitat2019.08.28 19:12:56 4: https://api.mcs3.miele.com/oauth2/auth: HTTP response code 401
2019.08.28 19:12:56 5: HttpUtils https://api.mcs3.miele.com/oauth2/auth: Got data, length: 21
2019.08.28 19:12:56 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized

Also.... Zugangsdaten: clientID clientSecret email passwort, etwas stimmt nicht
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 29 August 2019, 11:04:04
Du hast laut Log den AuthRegex 500 drin, den hat Miele aber schon wieder gefixt. Wieder Unauthorized eintragen.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 29 August 2019, 11:24:07
Zitat von: volschin am 29 August 2019, 11:04:04
Du hast laut Log den AuthRegex 500 drin, den hat Miele aber schon wieder gefixt. Wieder Unauthorized eintragen.

Ne, das hat er schon korrigiert:
Zitat2019.08.28 19:12:54 5: Dunsthaube: CheckAuth is checking buffer with ReAuthRegex reAuthRegex 500.Internal.Server.Error|Unauthorized|default.backend...401
2019.08.28 19:12:54 4: Dunsthaube: CheckAuth decided new authentication required
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: alkazaa am 29 August 2019, 19:09:21
OK, ich kann Erfolg melden:

NachdemreAuthRegex 500.Internal.Server.Error|Unauthorized|default.backend...401zunächst nichts gebracht hat, obwohl ich ALLE client_ID, client_secret, email, password mit Ctrl-C, Ctrl-V nochmal neu in die entsprechenden Attribute reingeschrieben hat, habe ich das device gelöscht und neu angelegt. Die attr-Blöcke aus dem "Fritz Muster" tutorial habe ch dazu in notepadd++ vorbereitet und als ganzes in der FHEM f18 GUI ausgeführt (zuvor hatte ich jeden attr Befehl einzeln abgesetzt, was natürlich die Fehlerwahrscheinlichkeit erhöht hatte).

Wie auch immer, jetzt bekomme ich beim Internal 'httpheader'
HTTP/1.1 200 OK
Date: Thu, 29 Aug 2019 16:57:43 GMT
Content-Type: application/json
Content-Length: 550
Connection: close
Vary: Accept-Encoding
Content-Encoding: gzip
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: PUT, GET, POST, 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



Warum es jetzt geht, da kann ich nur spekulieren: wenn ich es richtig erkannt habe, sorgt anemomades reAuthRegex dafür dass mehrere 'geduldige' retries bei der Anmeldung durchgeführt werden. Das könnte dazu passen, dass ich zur Zeit mit einem LTE-Router der Magenta-Firma arbeiten muss, da die Glasfaser zu meinem Haus von einem Bagger zerfressen wurde. Und die Datenrate mit dem LTE Teil ist arg langsam.

Danke nochmals, jetzt kann ich  mich im nächsten Schritt um die Definition der Readings kümmern.

Beste Grüße
Franz
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: deune am 14 April 2020, 07:15:54
Hallo Franz,

der letzte Post ist schon etwas her, aber vielleicht bist Du auch irgendwie weiter gekommen.
Darf ich fragen, ob Du Deine Miele Geräte zufriedenstellend eingebunden hast und ob Du dies auch berichten würdest?

Ich stehe nun auch für zwei Geräten, die ich gerne einbinden würde.

Herzliche Grüße
Holger
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 14 April 2020, 18:13:52
Zitat von: deune am 14 April 2020, 07:15:54
Hallo Franz,

der letzte Post ist schon etwas her, aber vielleicht bist Du auch irgendwie weiter gekommen.
Darf ich fragen, ob Du Deine Miele Geräte zufriedenstellend eingebunden hast und ob Du dies auch berichten würdest?

Ich stehe nun auch für zwei Geräten, die ich gerne einbinden würde.

Herzliche Grüße
Holger
Hallo,

ich nutze die Anbindung noch nach wie vor für unsere Waschmaschine. Funktioniert also noch.


Gesendet von meinem JSN-L21 mit Tapatalk

Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Olaf am 08 Mai 2020, 12:10:59
Ich würde gerne unsere Spülmaschine einbinden, bekomme es aber leider bisher nicht hin.

Ich habe mich dabei an dieses Muster gehalten:
https://forum.fhem.de/index.php/topic,95989.msg915870.html#msg915870

Mittlerweile bekommt man den Developer Account, wenn man sich hier registriert (statt E-Mail an developer@miele.com): https://www.miele.com/f/com/en/register_api.aspx

Meine Definition sieht wie folgt aus:

defmod Spuelmaschine HTTPMOD https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de 120
attr Spuelmaschine reAuthRegex 500.Internal.Server.Error|Unauthorized|default.backend...401
attr Spuelmaschine requestHeader01 Authorization: Bearer $sid
attr Spuelmaschine requestHeader02 Content-Type: application/json
attr Spuelmaschine sid1URL  https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
attr Spuelmaschine sid2Data email=xxxxxxx@xxxxxx.xxx&password=xxxxxxxxxxxxxxxx&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&vgInformationSelector=de-DE
attr Spuelmaschine sid2IdRegex (?s)code=(DE_[0-9a-f]+)
attr Spuelmaschine sid2IgnoreRedirects 1
attr Spuelmaschine sid2URL https://api.mcs3.miele.com/oauth/auth
attr Spuelmaschine sid3Data grant_type=authorization_code&code=$sid&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&client_id=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
attr Spuelmaschine sid3IdJSON access_token
attr Spuelmaschine sid3URL https://api.mcs3.miele.com/thirdparty/token/
attr Spuelmaschine verbose 3
attr Spuelmaschine reading01Name remainigtime_h
attr Spuelmaschine reading01JSON state_remainingTime_0
attr Spuelmaschine reading02Name remainigtime_m
attr Spuelmaschine reading02JSON state_remainingTime_1
attr Spuelmaschine reading03Name elapsedtime_h
attr Spuelmaschine reading03JSON state_elapsedTime_0
attr Spuelmaschine reading04Name elapsedtime_m
attr Spuelmaschine reading04JSON state_elapsedTime_1
attr Spuelmaschine reading05Name spinningspeed
attr Spuelmaschine reading05JSON state_spinningSpeed
attr Spuelmaschine reading06Name state
attr Spuelmaschine reading06JSON state_status_value_raw
attr Spuelmaschine room EG Küche
attr Spuelmaschine alias Spülmaschine
attr Spuelmaschine group Geräte

define at_Spuelmaschine at +*00:02:00 {\
fhem "set Spuelmaschine reread";;\
if (ReadingsVal("Spuelmaschine", "state", 0)==4) {\
system("curl -X PUT \"https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/actions\" -H  \"accept: */*\" -H  \"Content-Type: application/json\" -H \"Authorization: Bearer ".InternalVal("Spuelmaschine","sid", "")."\" -d '{\"processAction\":1}' &")\
}\
}
attr at_Spuelmaschine room System
attr at_Spuelmaschine alias Spülmaschine auswerten
attr at_Spuelmaschine group Routinen


Zugangsdaten stimmen, d.h. ich kann mich in Miele@Mobile einloggen und sehe dort die Spülmaschine. Ich habe auch den Test gemacht und erhalte (nach dem Hinweis, dass ich die Zugangsdaten prüfen solle), eine URL mit DE_xxxxxx.

Mein Log sieht wie folgt aus:

2020.05.08 11:02:35 5 : Spuelmaschine: set called with reread
2020.05.08 11:02:35 5 : Spuelmaschine: GetUpdate called (reread)
2020.05.08 11:02:35 5 : Spuelmaschine: AddToQueue adds type update to URL https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de, no data, header Authorization: Bearer $sid Content-Type: application/json, retry 0, initial queue len: 0
2020.05.08 11:02:35 5 : Spuelmaschine: HandleSendQueue called, qlen = 1
2020.05.08 11:02:35 4 : Spuelmaschine: HandleSendQueue sends update with timeout 2 to https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de, No Data, header: Authorization: Bearer $sid Content-Type: application/json
2020.05.08 11:02:35 5 : HttpUtils url=https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de
2020.05.08 11:02:35 4 : IP: api.mcs3.miele.com -> 137.117.150.39
2020-05-08 11:02:35 HTTPMOD Spuelmaschine reread
2020-05-08 11:02:35 at at_Spuelmaschine Next: 11:04:35
2020.05.08 11:02:35 5 : HttpUtils request header: GET /v1/devices/00010xxxxxxx/?language=de HTTP/1.0 Host: api.mcs3.miele.com User-Agent: fhem Accept-Encoding: gzip,deflate Authorization: Bearer $sid Content-Type: application/json
2020.05.08 11:02:35 4 : https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de: HTTP response code 401
2020.05.08 11:02:35 5 : HttpUtils https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de: Got data, length: 21
2020.05.08 11:02:35 5 : HttpUtils response header: HTTP/1.1 401 Unauthorized Server: openresty/1.15.8.2 Date: Fri, 08 May 2020 09:02:35 GMT Content-Type: text/html Connection: close Strict-Transport-Security: max-age=15724800; includeSubDomains
2020.05.08 11:02:35 4 : Spuelmaschine: Read callback: request type was update retry 0, header: HTTP/1.1 401 Unauthorized Server: openresty/1.15.8.2 Date: Fri, 08 May 2020 09:02:35 GMT Content-Type: text/html Connection: close Strict-Transport-Security: max-age=15724800; includeSubDomains, body length 21
2020.05.08 11:02:35 5 : Spuelmaschine: Read callback: body default backend - 401
2020.05.08 11:02:35 4 : Spuelmaschine: Read found no charset header (bodyDecode was set to auto)
2020.05.08 11:02:35 3 : Spuelmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "default backend - 40...") at (eval 77776) line 1.
2020.05.08 11:02:35 5 : Spuelmaschine: GetCookies is looking for Cookies
2020.05.08 11:02:35 5 : Spuelmaschine: ExtractSid called, context reading, num
2020.05.08 11:02:35 4 : Spuelmaschine: checking for redirects, code=401, ignore=0
2020.05.08 11:02:35 4 : Spuelmaschine: no redirects to handle
2020.05.08 11:02:35 5 : Spuelmaschine: GetRegex found precompiled reAuthRegex for  as (?^:500.Internal.Server.Error|Unauthorized|default.backend...401)
2020.05.08 11:02:35 5 : Spuelmaschine: CheckAuth is checking buffer with ReAuthRegex (?^:500.Internal.Server.Error|Unauthorized|default.backend...401)
2020.05.08 11:02:35 4 : Spuelmaschine: CheckAuth decided new authentication required
2020.05.08 11:02:35 4 : Spuelmaschine: Auth called with Steps: 1 2 3
2020.05.08 11:02:35 5 : Spuelmaschine: 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=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, no headers, retry 0, initial queue len: 0
2020.05.08 11:02:35 5 : Spuelmaschine: AddToQueue prepends type auth2 to URL https://api.mcs3.miele.com/oauth/auth, data email=xxxxxxx@xxxxxx.xxx&password=xxxxxxxxxxxxxxxx&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&vgInformationSelector=de-DE, no headers, ignore redirects, retry 0, initial queue len: 1
2020.05.08 11:02:35 5 : Spuelmaschine: AddToQueue prepends type auth1 to URL https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F, no data, no headers, retry 0, initial queue len: 2
2020.05.08 11:02:35 5 : Spuelmaschine: HandleSendQueue called, qlen = 3
2020.05.08 11:02:35 5 : Spuelmaschine: HandleSendQueue - minSendDelay not over, rescheduling
2020.05.08 11:02:35 5 : Spuelmaschine: AddToQueue adds type update to URL https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de, no data, header Authorization: Bearer $sid Content-Type: application/json, retry 1, initial queue len: 3
2020.05.08 11:02:35 5 : Spuelmaschine: HandleSendQueue called, qlen = 4
2020.05.08 11:02:35 5 : Spuelmaschine: HandleSendQueue - minSendDelay not over, rescheduling
2020.05.08 11:02:35 4 : Spuelmaschine: CheckAuth requeued request update after auth, retryCount 0 ...
2020.05.08 11:02:36 5 : Spuelmaschine: HandleSendQueue called, qlen = 4
2020.05.08 11:02:36 4 : Spuelmaschine: HandleSendQueue sends auth1 with timeout 2 to https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F, No Data, No Header
2020.05.08 11:02:36 5 : HttpUtils url=https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
2020.05.08 11:02:36 4 : IP: api.mcs3.miele.com -> 137.117.150.39
2020.05.08 11:02:37 5 : HttpUtils request header: GET /thirdparty/login/?response_type=code&state=login&client_id=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&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
2020.05.08 11:02:37 4 : https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F: HTTP response code 200
2020.05.08 11:02:37 5 : HttpUtils https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F: Got data, length: 6383
2020.05.08 11:02:37 5 : HttpUtils response header: HTTP/1.1 200 OK Server: openresty/1.15.8.2 Date: Fri, 08 May 2020 09:02:37 GMT Content-Type: text/html Content-Length: 2223 Connection: close Strict-Transport-Security: max-age=15724800; includeSubDomains Vary: Accept-Encoding Content-Encoding: gzip Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: PUT, GET, POST, OPTIONS Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
2020.05.08 11:02:37 4 : Spuelmaschine: Read callback: request type was auth1 retry 0, header: HTTP/1.1 200 OK Server: openresty/1.15.8.2 Date: Fri, 08 May 2020 09:02:37 GMT Content-Type: text/html Content-Length: 2223 Connection: close Strict-Transport-Security: max-age=15724800; includeSubDomains Vary: Accept-Encoding Content-Encoding: gzip Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: PUT, GET, POST, OPTIONS Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization, body length 6383
2020.05.08 11:02:37 5 : Spuelmaschine: Read callback: body <html lang="de"> <head> <!--Let browser know website is optimized for mobile--> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta charset="utf-8"> <!-- 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=="> <!--Import Google Icon Font--> <!--Import materialize.css--> <!--Import own css--> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link rel="stylesheet" href="/assets/css/materialize.min.css?1556550173384"> <link type="text/css" rel="stylesheet" href="/assets/css/mieleStyle.css?1556550173387" media="screen,projection"/> <!-- Import scrips --> <!-- Compiled and minified JavaScript --> <script src="/assets/js/materialize.min.js?1556550173386"></script> <!--Hotfix for selection error on IOS 13, see MIELCLD3-4504--> <script src="/assets/js/selectHotfix.js"></script> <script> document.addEventListener('DOMContentLoaded', function () { M.FormSelect.init(document.querySelectorAll('select')); }); </script> </head> <body id="mieleLoginSite"> <div class="container"> <div class="row"> <div class="col s12 m8 offset-m2 offset-l2 l8"> <div class="center"> <img class="responsive-img" src="/assets/images/miele_logo.svg" width="150" alt="miele.com"/> </div> <h1 class="center 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 Address</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> <!-- add here all hidden inputs --> <input type="hidden" name="response_type" value="code"> <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="client_id" value="0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx"> <div class="input-field" style="margin-top: 25px;"> <i class="material-icons prefix no-margin">language</i> <select required name="vgInformationSelector" size="5"> <option value="" disabled>Please select your country</option> <option value="en-AU">Miele Australia</option> <option value="nl-BE">Miele België</option> <option value="en-CA">Miele Canada</option> <option value="es-CL">Miele Chile</option> <option value="hr-HR">Miele Croatia</option> <option value="cs-CZ">Miele Czechia</option> <option value="da-DK">Miele Danmark</option> <option value="de-DE">Miele Deutschland</option> <option value="et-EE">Miele Eesti</option> <option value="es-ES">Miele España</option> <option value="fr-FR">Miele France</option> <option value="ko-KR">Miele Hanguk</option> <option value="zh-HK">Miele Hong Kong</option> <option value="en-IE">Miele Ireland</option> <option value="en-IL">Miele Israel</option> <option value="it-IT">Miele Italia</option> <option value="el-CY">Miele Kypros</option> <option value="lv-LV">Miele Latvija</option> <option value="lt-LT">Miele Lietuva</option> <option value="de-LU">Miele Luxemburg</option> <option value="hu-HU">Miele Magyarország</option> <option value="en-MY">Miele Malaysia</option> <option value="es-MX">Miele México</option> <option value="nl-NL">Miele Nederland</option> <option value="en-NZ">Miele New Zealand</option> <option value="ja-JP">Miele Nihon</option> <option value="no-NO">Miele Norge</option> <option value="pl-PL">Miele Polska</option> <option value="pt-PT">Miele Portugual</option> <option value="ro-RO">Miele România</option> <option value="de-CH">Miele Schweiz</option> <option value="en-SG">Miele Singapore</option> <option value="sl-SI">Miele Slovenia</option> <option value="sk-SK">Miele Slovensko</option> <option value="en-ZA">Miele South Africa</option> <option value="fi-FI">Miele Suomi</option> <option value="sv-SE">Miele Sverige</option> <option value="en-TH">Miele Thailand</option> <option value="tr-TR">Miele Türkiye</option> <option value="en-GB">Miele UK</option> <option value="en-US">Miele USA</option> <option value="en-AE">Miele United Arab Emirates</option> <option value="zh-CN">Miele Zhōngguó</option> <option value="de-AT">Miele Österreich</option> <option value="el-GR">Miele Ελλάδα</option> <option value="ru-BY">Miele Беларуси</option> <option value="bg-BG">Miele България</option> <option value="ru-KZ">Miele Казахстан</option> <option value="ru-RU">Miele Россия</option> <option value="sr-RS">Miele Србија</option> <option value="ru-UA">Miele Україна</option> </select> <label>Country</label> </div> <div class="center"> <button class="btn waves-effect waves-light miele-red" type="submit">Submit</button> </div> </form> </div> </div> </div> </body> </html>
2020.05.08 11:02:37 4 : Spuelmaschine: Read found no charset header (bodyDecode was set to auto)
2020.05.08 11:02:37 3 : Spuelmaschine: 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 77778) line 1.
2020.05.08 11:02:37 5 : Spuelmaschine: GetCookies is looking for Cookies
2020.05.08 11:02:37 5 : Spuelmaschine: ExtractSid called, context sid, num 1
2020.05.08 11:02:37 4 : Spuelmaschine: checking for redirects, code=200, ignore=0
2020.05.08 11:02:37 4 : Spuelmaschine: no redirects to handle
2020.05.08 11:02:37 5 : Spuelmaschine: HandleSendQueue called, qlen = 3
2020.05.08 11:02:37 4 : Spuelmaschine: HandleSendQueue sends auth2 with timeout 2 to https://api.mcs3.miele.com/oauth/auth, data: email=xxxxxxx@xxxxxx.xxx&password=xxxxxxxxxxxxxxxx&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&vgInformationSelector=de-DE, No Header
2020.05.08 11:02:37 5 : HttpUtils url=https://api.mcs3.miele.com/oauth/auth
2020.05.08 11:02:37 4 : IP: api.mcs3.miele.com -> 137.117.150.39
2020.05.08 11:02:38 5 : HttpUtils request header: POST /oauth/auth HTTP/1.0 Host: api.mcs3.miele.com User-Agent: fhem Accept-Encoding: gzip,deflate Content-Length: 219 Content-Type: application/x-www-form-urlencoded
2020.05.08 11:02:38 4 : https://api.mcs3.miele.com/oauth/auth: HTTP response code 200
2020.05.08 11:02:38 5 : HttpUtils https://api.mcs3.miele.com/oauth/auth: Got data, length: 4618
2020.05.08 11:02:38 5 : HttpUtils response header: HTTP/1.1 200 OK Server: openresty/1.15.8.2 Date: Fri, 08 May 2020 09:02:38 GMT Content-Type: text/plain Content-Length: 4618 Connection: close Vary: Accept-Encoding Strict-Transport-Security: max-age=15724800; includeSubDomains Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: PUT, GET, POST, OPTIONS Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
2020.05.08 11:02:38 4 : Spuelmaschine: Read callback: request type was auth2 retry 0, header: HTTP/1.1 200 OK Server: openresty/1.15.8.2 Date: Fri, 08 May 2020 09:02:38 GMT Content-Type: text/plain Content-Length: 4618 Connection: close Vary: Accept-Encoding Strict-Transport-Security: max-age=15724800; includeSubDomains Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: PUT, GET, POST, OPTIONS Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization, body length 4618
2020.05.08 11:02:38 5 : Spuelmaschine: Read callback: body <html lang="de"> <head> <!--Import Google Icon Font--> <!--Import materialize.css--> <!--Import own css--> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link type="text/css" rel="stylesheet" href="/assets/css/materialize.min.css" media="screen,projection"/> <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="container"> <div class="row"> <div class="col s12 m8 offset-m2 offset-l2 l8"> <div class="center"> <img class="responsive-img" src="/assets/images/miele_logo.svg" width="150" alt="miele.com"/> </div> <h1 class="center mediumFont">Zugriff erteilen</h1> <div class="center mediumFont smaller">Die Anwendung FHEM möchte auf Ihre Gerätedaten zugreifen:</div> </div> </div> <div class="row"> <div class="col s12 m8 offset-m2 offset-l3 l6"> <ul> <li class="center">Funktionsmerkmale Ihrer Miele-Geräte</li> <li class="center">Gerätenutzungsdaten Ihrer Miele-Geräte</li> <li class="center">Gerätezustandsdaten Ihrer Miele-Geräte</li> <li class="center">Steuerung Ihrer Miele-Geräte</li> </ul> </div> </div> <div class="row"> <div class="col s12 m8 offset-m2 offset-l3 l6"> <p class="center"> Der Zugriff auf die o.g. Daten ist erforderlich, damit die Anwendung Ihnen Ihre vernetzten Miele-Geräte sowie deren Status- und Geräteinformationen anzeigen kann. Mit Ihrer Einwilligung erlauben Sie der Anwendung Zugriff auf Ihre Daten. Sie können Ihre Einwilligung jederzeit widerrufen. Ihren Widerruf richten Sie bitte mit dem Betreff ,,Revoke Consent" an <a href="mailto:developer@miele.com?subject=Revoke%20Consent&body=Hereby%20I%20would%20like%20to%20revoke%20my%20consent%20for%20the%20client%200a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx%20and%20the%20user%20account%20mertgen%40gmx.net.">developer@miele.com</a> . Weitere Informationen zu der Datenverarbeitung durch Miele, insbesondere zu Ihren Rechten als Betroffener, können Sie der <a href="http://www.miele.de/datenschutz">Miele Datenschutzerklärung</a> entnehmen. Für die Nutzung der Anwendung beachten Sie bitte die Nutzungs- und Datenschutzbestimmungen von FHEM. </p> <div class="center"> <form class="hidden" method="get" action="https://api.mcs3.miele.com/thirdparty/login/"> <input type="hidden" name="code" value="DE_3b84a2dfb559f792aba68f93e6864294"> <input type="hidden" name="state" value="login"> <input id="button" class="waves-effect waves-light btn miele-red" type="submit" value="ZULASSEN"> </form> <form class="hidden" method="get" action="https://api.mcs3.miele.com/thirdparty/login/"> <input type="hidden" name="error" value="access_denied"> <input id="button" class="waves-effect waves-light btn miele-gray" type="submit" value="ABBRECHEN"> </form> </div> </div> </div> </div> </body> </html>
2020.05.08 11:02:38 4 : Spuelmaschine: Read found no charset header (bodyDecode was set to auto)
2020.05.08 11:02:38 3 : Spuelmaschine: 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 77780) line 1.
2020.05.08 11:02:38 5 : Spuelmaschine: GetCookies is looking for Cookies
2020.05.08 11:02:38 5 : Spuelmaschine: ExtractSid called, context sid, num 2
2020.05.08 11:02:38 5 : Spuelmaschine: GetRegex found precompiled IdRegex for sid2 as (?^:(?s)code=(DE_[0-9a-f]+))
2020.05.08 11:02:38 5 : Spuelmaschine: ExtractSid could not match buffer to IdRegex (?^:(?s)code=(DE_[0-9a-f]+))
2020.05.08 11:02:38 4 : Spuelmaschine: checking for redirects, code=200, ignore=1
2020.05.08 11:02:38 4 : Spuelmaschine: no redirects to handle
2020.05.08 11:02:39 5 : Spuelmaschine: HandleSendQueue called, qlen = 2
2020.05.08 11:02:39 4 : Spuelmaschine: HandleSendQueue sends auth3 with timeout 2 to 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=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, No Header
2020.05.08 11:02:39 5 : HttpUtils url=https://api.mcs3.miele.com/thirdparty/token/
2020.05.08 11:02:39 4 : IP: api.mcs3.miele.com -> 137.117.150.39
2020.05.08 11:02:39 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
2020.05.08 11:02:39 4 : https://api.mcs3.miele.com/thirdparty/token/: HTTP response code 500
2020.05.08 11:02:39 5 : HttpUtils https://api.mcs3.miele.com/thirdparty/token/: Got data, length: 42
2020.05.08 11:02:39 5 : HttpUtils response header: HTTP/1.1 500 Internal Server Error Server: openresty/1.15.8.2 Date: Fri, 08 May 2020 09:02:39 GMT Content-Type: text/plain Content-Length: 42 Connection: close Strict-Transport-Security: max-age=15724800; includeSubDomains Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: PUT, GET, POST, OPTIONS Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
2020.05.08 11:02:39 4 : Spuelmaschine: Read callback: request type was auth3 retry 0, header: HTTP/1.1 500 Internal Server Error Server: openresty/1.15.8.2 Date: Fri, 08 May 2020 09:02:39 GMT Content-Type: text/plain Content-Length: 42 Connection: close Strict-Transport-Security: max-age=15724800; includeSubDomains Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: PUT, GET, POST, OPTIONS Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization, body length 42
2020.05.08 11:02:39 5 : Spuelmaschine: Read callback: body no vg given. grant_type=AUTHORIZATION_CODE
2020.05.08 11:02:39 4 : Spuelmaschine: Read found no charset header (bodyDecode was set to auto)
2020.05.08 11:02:39 3 : Spuelmaschine: error while parsing JSON data: 'null' expected, at character offset 0 (before "no vg given. grant_t...") at (eval 77785) line 1.
2020.05.08 11:02:39 5 : Spuelmaschine: GetCookies is looking for Cookies
2020.05.08 11:02:39 5 : Spuelmaschine: ExtractSid called, context sid, num 3
2020.05.08 11:02:39 5 : Spuelmaschine: Checking SID with JSON access_token
2020.05.08 11:02:39 4 : Spuelmaschine: checking for redirects, code=500, ignore=0
2020.05.08 11:02:39 4 : Spuelmaschine: no redirects to handle
2020.05.08 11:02:40 5 : Spuelmaschine: HandleSendQueue called, qlen = 1
2020.05.08 11:02:40 4 : Spuelmaschine: HandleSendQueue sends update with timeout 2 to https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de, No Data, header: Authorization: Bearer $sid Content-Type: application/json
2020.05.08 11:02:40 5 : HttpUtils url=https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de
2020.05.08 11:02:40 4 : IP: api.mcs3.miele.com -> 137.117.150.39
2020.05.08 11:02:40 5 : HttpUtils request header: GET /v1/devices/00010xxxxxxx/?language=de HTTP/1.0 Host: api.mcs3.miele.com User-Agent: fhem Accept-Encoding: gzip,deflate Authorization: Bearer $sid Content-Type: application/json
2020.05.08 11:02:40 4 : https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de: HTTP response code 401
2020.05.08 11:02:40 5 : HttpUtils https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de: Got data, length: 21
2020.05.08 11:02:40 5 : HttpUtils response header: HTTP/1.1 401 Unauthorized Server: openresty/1.15.8.2 Date: Fri, 08 May 2020 09:02:40 GMT Content-Type: text/html Connection: close Strict-Transport-Security: max-age=15724800; includeSubDomains
2020.05.08 11:02:40 4 : Spuelmaschine: Read callback: request type was update retry 1, header: HTTP/1.1 401 Unauthorized Server: openresty/1.15.8.2 Date: Fri, 08 May 2020 09:02:40 GMT Content-Type: text/html Connection: close Strict-Transport-Security: max-age=15724800; includeSubDomains, body length 21
2020.05.08 11:02:40 5 : Spuelmaschine: Read callback: body default backend - 401
2020.05.08 11:02:40 4 : Spuelmaschine: Read found no charset header (bodyDecode was set to auto)
2020.05.08 11:02:40 3 : Spuelmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "default backend - 40...") at (eval 77787) line 1.
2020.05.08 11:02:40 5 : Spuelmaschine: GetCookies is looking for Cookies
2020.05.08 11:02:40 5 : Spuelmaschine: ExtractSid called, context reading, num
2020.05.08 11:02:40 4 : Spuelmaschine: checking for redirects, code=401, ignore=0
2020.05.08 11:02:40 4 : Spuelmaschine: no redirects to handle
2020.05.08 11:02:40 5 : Spuelmaschine: GetRegex found precompiled reAuthRegex for  as (?^:500.Internal.Server.Error|Unauthorized|default.backend...401)
2020.05.08 11:02:40 5 : Spuelmaschine: CheckAuth is checking buffer with ReAuthRegex (?^:500.Internal.Server.Error|Unauthorized|default.backend...401)
2020.05.08 11:02:40 4 : Spuelmaschine: CheckAuth decided new authentication required
2020.05.08 11:02:40 4 : Spuelmaschine: Authentication still required but no retries left - did last authentication fail?
2020.05.08 11:02:40 5 : Spuelmaschine: Read starts parsing response to update with defined readings: 01,02,03,04,05,06
2020.05.08 11:02:40 5 : Spuelmaschine: ExtractReading remainigtime_h with json state_remainingTime_0 ...
2020.05.08 11:02:40 5 : Spuelmaschine: ExtractReading remainigtime_h did not match
2020.05.08 11:02:40 5 : Spuelmaschine: ExtractReading remainigtime_m with json state_remainingTime_1 ...
2020.05.08 11:02:40 5 : Spuelmaschine: ExtractReading remainigtime_m did not match
2020.05.08 11:02:40 5 : Spuelmaschine: ExtractReading elapsedtime_h with json state_elapsedTime_0 ...
2020.05.08 11:02:40 5 : Spuelmaschine: ExtractReading elapsedtime_h did not match
2020.05.08 11:02:40 5 : Spuelmaschine: ExtractReading elapsedtime_m with json state_elapsedTime_1 ...
2020.05.08 11:02:40 5 : Spuelmaschine: ExtractReading elapsedtime_m did not match
2020.05.08 11:02:40 5 : Spuelmaschine: ExtractReading spinningspeed with json state_spinningSpeed ...
2020.05.08 11:02:40 5 : Spuelmaschine: ExtractReading spinningspeed did not match
2020.05.08 11:02:40 5 : Spuelmaschine: ExtractReading state with json state_status_value_raw ...
2020.05.08 11:02:40 5 : Spuelmaschine: ExtractReading state did not match
2020.05.08 11:02:40 4 : Spuelmaschine: Read response to update didn't match any Reading
2020.05.08 11:02:40 5 : Spuelmaschine: HandleSendQueue called, qlen = 0
2020.05.08 11:02:41 5 : Spuelmaschine: GetUpdate called (update)
2020.05.08 11:02:41 5 : Spuelmaschine: update timer modified: will call GetUpdate in 120.0 seconds at 2020-05-08 11:04:41
2020.05.08 11:02:41 5 : Spuelmaschine: AddToQueue adds type update to URL https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de, no data, header Authorization: Bearer $sid Content-Type: application/json, retry 0, initial queue len: 0
2020.05.08 11:02:41 5 : Spuelmaschine: HandleSendQueue called, qlen = 1
2020.05.08 11:02:41 4 : Spuelmaschine: HandleSendQueue sends update with timeout 2 to https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de, No Data, header: Authorization: Bearer $sid Content-Type: application/json
2020.05.08 11:02:41 5 : HttpUtils url=https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de
2020.05.08 11:02:41 4 : IP: api.mcs3.miele.com -> 137.117.150.39
2020.05.08 11:02:41 5 : HttpUtils request header: GET /v1/devices/00010xxxxxxx/?language=de HTTP/1.0 Host: api.mcs3.miele.com User-Agent: fhem Accept-Encoding: gzip,deflate Authorization: Bearer $sid Content-Type: application/json
2020.05.08 11:02:41 4 : https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de: HTTP response code 401
2020.05.08 11:02:41 5 : HttpUtils https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de: Got data, length: 21
2020.05.08 11:02:41 5 : HttpUtils response header: HTTP/1.1 401 Unauthorized Server: openresty/1.15.8.2 Date: Fri, 08 May 2020 09:02:41 GMT Content-Type: text/html Connection: close Strict-Transport-Security: max-age=15724800; includeSubDomains
2020.05.08 11:02:41 4 : Spuelmaschine: Read callback: request type was update retry 0, header: HTTP/1.1 401 Unauthorized Server: openresty/1.15.8.2 Date: Fri, 08 May 2020 09:02:41 GMT Content-Type: text/html Connection: close Strict-Transport-Security: max-age=15724800; includeSubDomains, body length 21
2020.05.08 11:02:41 5 : Spuelmaschine: Read callback: body default backend - 401
2020.05.08 11:02:41 4 : Spuelmaschine: Read found no charset header (bodyDecode was set to auto)
2020.05.08 11:02:41 3 : Spuelmaschine: error while parsing JSON data: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "default backend - 40...") at (eval 77789) line 1.
...


Das Device sieht aktuell wie folgt aus:

Internals:
   BUSY       0
   CFGFN      /opt/fhem/mycfg/59_miele.cfg
   DEF        https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de 120
   FUUID      5eb5004b-f33f-2e30-9838-a1752f1d0e1e88e2
   Interval   120
   JSONEnabled 1
   LASTSEND   1588932406.11815
   LastAuthTry 2020-05-08 12:06:42
   MainURL    https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de
   ModuleVersion 3.5.22 - 7.2.2020
   NAME       Spuelmaschine
   NOTIFYDEV  global
   NR         1014
   NTFY_ORDER 50-Spuelmaschine
   STATE      ???
   TRIGGERTIME 1588932521.9524
   TRIGGERTIME_FMT 2020-05-08 12:08:41
   TYPE       HTTPMOD
   addr       https://api.mcs3.miele.com:443
   auth       0
   code       401
   compress   1
   conn       
   data       
   displayurl https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de
   header     Authorization: Bearer $sid
Content-Type: application/json
   host       api.mcs3.miele.com
   httpheader HTTP/1.1 401 Unauthorized
Server: openresty/1.15.8.2
Date: Fri, 08 May 2020 10:06:46 GMT
Content-Type: text/html
Connection: close
Strict-Transport-Security: max-age=15724800; includeSubDomains
   httpversion 1.0
   hu_blocking 0
   hu_filecount 1015
   hu_port    443
   hu_portSfx
   ignoreredirects 1
   loglevel   4
   path       /v1/devices/00010xxxxxxx/?language=de
   protocol   https
   redirects  0
   timeout    2
   url        https://api.mcs3.miele.com/v1/devices/00010xxxxxxx/?language=de
   value      0
   CompiledRegexes:
   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/00010xxxxxxx/?language=de
     value      0
   sslargs:
Attributes:
   alias      Spülmaschine
   group      Geräte
   reAuthRegex 500.Internal.Server.Error|Unauthorized|default.backend...401
   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
   room       EG Küche
   sid1URL    https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
   sid2Data   email=xxxxxxx@xxxxxx.xxx&password=xxxxxxxxxxxxxxxx&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&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=0a9a9061-f42a-xxxx-xxxx-xxxxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
   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    5


Ich bin wie immer für jeden Tipp dankbar.

VG, Olaf
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 10 Mai 2020, 00:59:54
Zitat2020.05.08 11:02:38 5 : Spuelmaschine: GetRegex found precompiled IdRegex for sid2 as (?^:(?s)code=(DE_[0-9a-f]+))
2020.05.08 11:02:38 5 : Spuelmaschine: ExtractSid could not match buffer to IdRegex (?^:(?s)code=(DE_[0-9a-f]+))
Er findet den Token nicht.

Wenn Du in einem Browser folgendes 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=codeund dich dort anmeldest, was kommt zurück als WeiterleitungsURL?

EDIT: Es kann sein, dass die API sich geändert hat, weil:
Zitat2020.05.08 11:02:38 5 : Spuelmaschine: Read callback: body  (...)  value="DE_3b84a2dfb559f792aba68f93e6864294"> <input type="hidden" (...)
Da ist der Token
Versuche mit:
sid2IdRegex (?s)value="(DE_[0-9a-f]+)
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: Olaf am 10 Mai 2020, 18:25:55
Das
sid2IdRegex (?s)value="(DE_[0-9a-f]+)
hat es gebracht.

Jetzt bekomme ich als httpheader:

HTTP/1.1 200 OK
Server: openresty/1.15.8.2
Date: Sun, 10 May 2020 16:23:51 GMT
Content-Type: application/json
Content-Length: 584
Connection: close
Strict-Transport-Security: max-age=15724800; includeSubDomains
access-control-allow-credentials: true
access-control-allow-headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
access-control-allow-methods: PUT, GET, POST, OPTIONS
access-control-allow-origin: *
Content-Encoding: gzip
Strict-Transport-Security: max-age=15724800; includeSubDomains
Vary: Accept-Encoding


Vielen Dank!
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: choenig am 14 Juni 2020, 11:10:50
Hi,

ich habe schon vor geraumer Zeit ein Modul für die Miele 3rd-Party Cloud API geschrieben. Jetzt habe ich das Modul veröffentlich (Ist noch im Beta-Stadium, Benutzung auf eigene Gefahr).

Wer es mal testen möchte, kann hier mal vorbeischauen :)

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

LG
Christian
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: speedAmaster am 19 Oktober 2020, 12:27:54
Hallo,
ich wollte mich an meiner Miele Waschmaschine versuchen - macht mit meiner PV jetzt wirklich Sinn.
Leider bekomme ich sonderbare Fehler.

Ich habe mich bei Miele angemeldet und habe meine ClientID und ClientSecret erhalten, email und PW funktionieren.
Mein CFG sieht die folgt aus:
defmod Waschmaschine HTTPMOD https://api.mcs3.miele.com/v1/devices/000148773697/?language=de 120
attr Waschmaschine room Technik
attr Waschmaschine enableControlSet 1
attr Waschmaschine reAuthRegex 500.Internal.Server.Error|Unauthorized|default.backend...401
attr Waschmaschine requestHeader01 Authorization: Bearer $sid
attr Waschmaschine requestHeader02 Content-Type: application/json
attr Waschmaschine sid1URL  https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=7c5ab07d-xxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
attr Waschmaschine sid2Data email=a@b.de&password=enthält_ein_!&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=7c5ab07d-xxxx&vgInformationSelector=de-DE
attr Waschmaschine sid2IdRegex (?s)code=(DE_[0-9a-f]+)
attr Waschmaschine sid2IgnoreRedirects 1
attr Waschmaschine sid2URL https://api.mcs3.miele.com/oauth/auth
attr Waschmaschine sid3Data grant_type=authorization_code&code=$sid&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&client_id=7c5ab07d-xxxx&client_secret=yyyy
attr Waschmaschine sid3IdJSON access_token
attr Waschmaschine sid3URL https://api.mcs3.miele.com/thirdparty/token/
attr Waschmaschine verbose 5
attr Waschmaschine icon scene_washing_machine


Ich habe mal den ersten Link in meinen Browser eingegeben
https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=7c5ab07d-xxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
erhalte dann eine LOGIN Seite (in welche ich mich einlogge), erhalte dann
Zugriff erteilen
Die Anwendung FHEM möchte auf Ihre Gerätedaten zugreifen:

    Funktionsmerkmale Ihrer Miele-Geräte
    Gerätenutzungsdaten Ihrer Miele-Geräte
    Gerätezustandsdaten Ihrer Miele-Geräte
    Steuerung Ihrer Miele-Geräte

wo ich dann "Zustimme"
erhalte dann im Browser
Kontoverknüpfung fehlgeschlagen! Bitte überprüfen Sie ihre Zugangsdaten.
{"code":405,"message":"HTTP 405 Method Not Allowed"}

im FHEM selbst erhalte ich
HTTP/1.1 401 Unauthorized
Date: Mon, 19 Oct 2020 10:26:55 GMT
Content-Type: text/html
Connection: close
Strict-Transport-Security: max-age=15724800; includeSubDomains


woran könnte dies denn liegen? an meinem "!" im Passwort?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 19 Oktober 2020, 12:54:34
Zitat von: speedAmaster am 19 Oktober 2020, 12:27:54
Hallo,
ich wollte mich an meiner Miele Waschmaschine versuchen - macht mit meiner PV jetzt wirklich Sinn.
Leider bekomme ich sonderbare Fehler.

Ich habe mich bei Miele angemeldet und habe meine ClientID und ClientSecret erhalten, email und PW funktionieren.
Mein CFG sieht die folgt aus:
defmod Waschmaschine HTTPMOD https://api.mcs3.miele.com/v1/devices/000148773697/?language=de 120
attr Waschmaschine room Technik
attr Waschmaschine enableControlSet 1
attr Waschmaschine reAuthRegex 500.Internal.Server.Error|Unauthorized|default.backend...401
attr Waschmaschine requestHeader01 Authorization: Bearer $sid
attr Waschmaschine requestHeader02 Content-Type: application/json
attr Waschmaschine sid1URL  https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=7c5ab07d-xxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
attr Waschmaschine sid2Data email=a@b.de&password=enthält_ein_!&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&state=login&response_type=code&client_id=7c5ab07d-xxxx&vgInformationSelector=de-DE
attr Waschmaschine sid2IdRegex (?s)code=(DE_[0-9a-f]+)
attr Waschmaschine sid2IgnoreRedirects 1
attr Waschmaschine sid2URL https://api.mcs3.miele.com/oauth/auth
attr Waschmaschine sid3Data grant_type=authorization_code&code=$sid&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F&client_id=7c5ab07d-xxxx&client_secret=yyyy
attr Waschmaschine sid3IdJSON access_token
attr Waschmaschine sid3URL https://api.mcs3.miele.com/thirdparty/token/
attr Waschmaschine verbose 5
attr Waschmaschine icon scene_washing_machine


Ich habe mal den ersten Link in meinen Browser eingegeben
https://api.mcs3.miele.com/thirdparty/login/?response_type=code&state=login&client_id=7c5ab07d-xxxx&scope=&redirect_uri=https%3A%2F%2Fapi.mcs3.miele.com%2Fthirdparty%2Flogin%2F
erhalte dann eine LOGIN Seite (in welche ich mich einlogge), erhalte dann
Zugriff erteilen
Die Anwendung FHEM möchte auf Ihre Gerätedaten zugreifen:

    Funktionsmerkmale Ihrer Miele-Geräte
    Gerätenutzungsdaten Ihrer Miele-Geräte
    Gerätezustandsdaten Ihrer Miele-Geräte
    Steuerung Ihrer Miele-Geräte

wo ich dann "Zustimme"
erhalte dann im Browser
Kontoverknüpfung fehlgeschlagen! Bitte überprüfen Sie ihre Zugangsdaten.
{"code":405,"message":"HTTP 405 Method Not Allowed"}

im FHEM selbst erhalte ich
HTTP/1.1 401 Unauthorized
Date: Mon, 19 Oct 2020 10:26:55 GMT
Content-Type: text/html
Connection: close
Strict-Transport-Security: max-age=15724800; includeSubDomains


woran könnte dies denn liegen? an meinem "!" im Passwort?
Ich würde dir empfehlen das neue Miele Modul dafür zu nutzen und nicht mehr httpmod.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: amenomade am 19 Oktober 2020, 13:25:51
Zitat von: xerion am 19 Oktober 2020, 12:54:34
Ich würde dir empfehlen das neue Miele Modul dafür zu nutzen und nicht mehr httpmod.

Ich als ursprünglicher Autor des HTTPMODs auch :)
Ich gewährleiste keinen Support mehr fürs HTTPMOD, da das Modul von Christian inzwischen viel mehr kann. Support fürs Modul mache ich aber gerne noch ab und zu ;)

Das Modul findest Du hier: https://forum.fhem.de/index.php/topic,112114.msg1064214.html#msg1064214
... bis Christian es endlich in svn eincheckt (private joke) ;)
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: speedAmaster am 19 Oktober 2020, 15:23:58
in der Tat! super vielen Dank an euch beide!!

somit kann dieser Stream wohl "geschlossen" werden
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 04 März 2021, 10:57:39
Moin zusammen,

habe heute eine nette Mail von Miele bekommen:
Dear User of the Miele 3rd Party API

To ensure the availability of our API we regularly check the log files. During the last check we noticed that your account generates an unusually high amount of token refresh requests. We kindly ask you to check the behavior of your application.
If the behavior still consists after March 17th, we're forced to invalidate the account without further notice.

Kind regards
Miele 3rd party API Team
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: timmib am 04 März 2021, 12:43:19
Ja, ich auch.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: choenig am 04 März 2021, 14:52:34
Mh, interessant.

Ich hab' sowas nicht bekommen.

Könnt ihr bitte:
* list von den devices schicken (PM oder Forum)
* verbose von allen MielAtHome-Instanzen auf 5 setzen, 'ne zeit laufen lassen und mir dann das log zukommen lassen

EDIT:
So sieht das bei mir alle 2 Minuten aus:

2021.03.04 15:13:53.639 5: KG.Keller.MieleWaschmaschine (MieleAtHome::MAH_updateValues:528) called
2021.03.04 15:13:53.639 4: KG.Keller.MieleWaschmaschine (MieleAtHome::MAH_getAccessToken:1543) found local token with remaining lifetime of 1482234.36014199 seconds
2021.03.04 15:13:53.639 4: KG.Keller.MieleWaschmaschine (MieleAtHome::MAH_getAccessToken:1543) found local token with remaining lifetime of 1482234.36005902 seconds
2021.03.04 15:13:53.640 4: KG.Keller.MieleWaschmaschine (MieleAtHome::MAH_getAccessToken:1543) found local token with remaining lifetime of 1482234.35956502 seconds
2021.03.04 15:13:53.784 5: KG.Keller.MieleWaschmaschine (MieleAtHome::MAH_onGetDeviceIdentAndStateReply:956) reply: err:, code:200, data:{[...]}


LG
Christian
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: choenig am 05 März 2021, 08:15:12
Moin,

danke euch beiden für die PMs.

Die Daten sehen leider genau aus, wie bei mir.

found local token with remaining lifetime ...

deutet darauf hin, dass er **kein** refresh macht.

Ist das ok für euch, das erstmal mit verbose 5 weiterlaufen zu lassen und mal zu beobachten, ob irgendwann mal ein MAH_doThirdpartyTokenRequest kommt? Das sollte nämlich der request sein, der den token bei Miele erneuert.

LG
Christian
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: choenig am 05 März 2021, 10:12:08
Moin,

ich habe mich gerade mal an Miele gewandt und sie haben mir gesagt, dass sie nur die absolute Anzahl an token refreshes zählen, nicht den Zeitlichen Zusammenhang.

Ich werde schauen, dass ich in den nächsten Tagen einen counter einbaue, um das nachvollziehen zu können. Ich befürchte, dass ich sonst erstmal nichts tun kann.

Oder habt' ihr einen Vorschlag?

LG
Christian
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: xerion am 05 März 2021, 10:52:05
Moin Christian,

das mit dem Counter hilft schon mal damit wir nicht jeden Tag die Logfiles sichten müssen. Hat Miele denn gesagt was toleriert wird?
Also ich versteh das so, der Token hat ein Ablaufdatum und wenn dieser vorbei ist musst dieser aktualisiert werden und wenn ich dich richtig verstanden habe, dann erkennt das MieleAtHome Modul das selber wann der abgelaufen ist und dann wird erst ein neuer generiert. Weist du wie oft der Token normalerweise erneuert werden muss?
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: det. am 05 März 2021, 11:09:22
hallo Christian,
ich hab immer mal wieder zur Unzeit, wenn der GS definitiv nicht läuft die folgenden Meldungen im LOG:
2021.03.05 05:14:44 1: PERL WARNING: Use of uninitialized value in concatenation (.) or string at ./FHEM/48_MieleAtHome.pm line 1089.
2021.03.05 05:14:44 1: PERL WARNING: Use of uninitialized value in concatenation (.) or string at ./FHEM/48_MieleAtHome.pm line 956.

Keine Ahnung, soll nicht gemeckert sein. Stört mich absolut nicht, aber vielleicht nützt es was.

Miele sollte froh sein, dass Du die Einbindung ihrer Geräte in FHEM vorangetrieben hast. Das ist der einzige Grund, bei kommenden Neuanschaffungen diese Marke zu bevorzugen.
Als kaufender Kunde möchte ich hier die Erwartung an Miele loswerden, das sie Dich optimal mit Informationen etc. unterstützen. Die Einbindung der Materialfüllstände von Salz und Klarspüler in die API steht seitens Miele auch immer noch aus.
Will damit zum Ausdruck bringen, die Miele Programmierer hätten genug andere Aufgaben, als Kunden zu verärgern und zukünftige Kunden zu vertreiben!
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: choenig am 05 März 2021, 11:39:25
@xerion

Genau so sollte es sein, wie du beschreibst.
Ich denke, dass der Token normalerweise länger als ein Monat, vielleicht sogar 3 Monate Gültigkeit hat. Weiss ich aber nicht so genau, weil ich mich länger nicht mit dem Miele-Thema beschäftigt habe :)

Es kann natürlich sein, dass da ein Bug in meinem Code ist, der dazu führt, dass er es öfter macht, als nötig. Vielleicht liegt es aber auch an eurem Setup, welches möglicherweise irgendwie speziell ist, und er es da öfter macht, als nötig.

Wie gesagt, ich werde mal einen counter in die readings einbauen, damit wir es nachvollziehen können.

@det.

Danke für die Meldungen, guck ich mir dann auch an :)

Miele hat sehr schnell und sehr freundlich geantwortet, ich denke nicht, dass sie mir/uns etwas böses wollen :)

LG
Christian
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: choenig am 05 März 2021, 14:50:34
Hi,

ich habe jetzt mal v1.0.2 hochgeladen, die enthält die readings für den token-refresh-count:


   READINGS:
     2021-03-05 14:32:56   tokenRefreshCount_withBearer 2
     2021-03-05 13:49:10   tokenRefreshCount_withRefreshToken 5


Wird ab morgen im update sein.

LG
Christian
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: timmib am 06 März 2021, 18:50:59
Hi,

laut internal dauert es noch was bis das neue Reading bei mir auftaucht:
OAUTH2_EXPIRES_AT = 2021-03-10 13:24:20

;D

Viele Grüße

Tim
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: det. am 07 März 2021, 10:01:55
Zitat von: timmib am 06 März 2021, 18:50:59
laut internal dauert es noch was bis das neue Reading bei mir auftaucht:
OAUTH2_EXPIRES_AT = 2021-03-10 13:24:20
Genauso
OAUTH2_EXPIRES_AT
2021-03-21 10:41:22
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: KOAL am 26 September 2021, 08:47:26
Hallo Leute,

ich brauche "leider" eine neue Waschmaschine, funktioniert das mit Mile noch oder ist das nicht mehr möglich?
Ich würde sehr gerne eine die mit FHEM funktioniert.

Würde diese funktionieren? "WTD 160 WCS" https://www.miele.at/e/wt1-waschtrockner-wtd-160-wcs-8-5kg-lotoswei-11568310-p
Diese hat "Miele@home"


LG, Danke
KOAL
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: choenig am 26 September 2021, 15:03:51
Hi,

die FHEM-Integration von Miele@Home funktioniert gut, hier sind die Infos zum Modul: https://forum.fhem.de/index.php/topic,112114.0.html.

Jedoch sind die Möglichkeiten, die Waschmaschine aus FHEM zu steuern eher begrenzt. Im groben geht AN, AUS, START, STOP. Für START muss sie natürlich vorbereitet werden ;-). Sehr gut funktioniert die Anzeige der Restlaufzeit in FHEM.

LG
Christian
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: KOAL am 26 September 2021, 17:21:56
Hi,

vielen Dank,
steuern muss gar nicht gehen, ich will nur wissen wie es der Maschine geht.
Bei unsere alten haben wir das mittles Strommessung gemacht, das geht gut aber man bekommt halt nur eine Info wenn die Maschine fertig ist, und nicht zb. 10 Minuten vorher.


Danke, dann besorgen wir uns so einen nun. :)
Toll das du/ihr das Modul gebaut habt.

Ich würde gerne eine "Petition" unterschrieben damit Miele auch weiß das wir zum Großteil deswegen eine so teure Maschine kaufen.


LG, und nochmal Danke
KOAL
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 28 September 2021, 06:56:01
Zitat von: KOAL am 26 September 2021, 17:21:56Ich würde gerne eine "Petition" unterschrieben damit Miele auch weiß das wir zum Großteil deswegen eine so teure Maschine kaufen.
Also ich habe mir meine Maschine sicher nicht zum Großteil deswegen gekauft, sondern weil sie gegenüber dem asiatischen Elektroschrott eine andere Qualität hat, ganz einfach etliche Jahre keine Probleme verspricht und die Wäsche schonend behandelt. Und OK, eine Anbindungsmöglichkeit an eine Hausautomatisierung gehört zu so einem Qualitätsversprechen auch mit dazu.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: rabehd am 28 September 2021, 07:40:14
Zitat von: volschin am 28 September 2021, 06:56:01
Also ich habe mir meine Maschine sicher nicht zum Großteil deswegen gekauft, sondern weil sie gegenüber dem asiatischen Elektroschrott eine andere Qualität hat, ganz einfach etliche Jahre keine Probleme verspricht und die Wäsche schonend behandelt.
Stimmt wohl auch nicht mehr so
https://www.ndr.de/fernsehen/sendungen/45_min/Reparieren-statt-Wegwerfen,sendung1187122.html (https://www.ndr.de/fernsehen/sendungen/45_min/Reparieren-statt-Wegwerfen,sendung1187122.html)
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: volschin am 28 September 2021, 12:23:08
Zitat von: rabehd am 28 September 2021, 07:40:14
Stimmt wohl auch nicht mehr so
Bin mir nicht sicher, was Du mir mit dem Link sagen möchtest. Von Miele ist da nicht die Rede. Ich habe eine 10-Jahres Garantie und wenn wirklich was streikt, dann kommt der Kundenservice zu mir nach Hause.
Titel: Antw:Miele 3rd party API in FHEM einbinden
Beitrag von: rabehd am 28 September 2021, 12:58:40
Da war mehrfach von Miele die Rede, sonst hätte ich nicht in der Mediathek gesucht.

"asiatischen Elektroschrott" und deutsche Wertarbeit sind so absolut Dinge aus vergangenen Zeiten.
Die 10 Jahre gibt es auch bei Samsung.
Aber da soll jeder seine Überzeugung pflegen.