Siemens Home Connect Hausgeräte

Begonnen von DasAndy, 19 November 2014, 14:31:46

Vorheriges Thema - Nächstes Thema

coliflower

#90
Select OAuth2.0 Scopes:

Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes. Learn how to use Home Connect API API requires the following scopes. Select which ones you want to grant to Swagger UI:

IdentifyAppliance
Grants right to identify a home appliance under /api/homeappliances
Monitor
Grants access to read resources under /api/homeappliances except images and settings
Control
Grants access to modify resources under under /api/homeappliances except images and settings
Images
Grants access to read resources under /api/homeappliances/{haid}/images
Settings
Grants access to read and modify resources under /api/homeappliances/{haid}/settings
Oven-Monitor
Grants access to read resources under /api/homeappliances except images and settings on ovens
Oven-Control
Grants access to modify resources under under /api/homeappliances except images and settings on ovens
Oven-Settings
Grants access to read and modify resources under /api/homeappliances/{haid}/settings on ovens
Oven
Grants access to read or modify all resources under /api/homeappliances on ovens
Dishwasher-Monitor
Grants access to read resources under /api/homeappliances except images and settings on dishwashers
Dishwasher-Control
Grants access to modify resources under under /api/homeappliances except images and settings on dishwashers
Dishwasher-Settings
Grants access to read and modify resources under /api/homeappliances/{haid}/settings on dishwashers
Dishwasher
Grants access to read or modify all resources under /api/homeappliances on dishwashers
Washer-Monitor
Grants access to read resources under /api/homeappliances except images and settings on washers
Washer-Control
Grants access to modify resources under under /api/homeappliances except images and settings on washers
Washer-Settings
Grants access to read and modify resources under /api/homeappliances/{haid}/settings on washers
Washer
Grants access to read or modify all resources under /api/homeappliances on washers
Dryer-Monitor
Grants access to read resources under /api/homeappliances except images and settings on dryers
Dryer-Control
Grants access to modify resources under under /api/homeappliances except images and settings on dryers
Dryer-Settings
Grants access to read and modify resources under /api/homeappliances/{haid}/settings on dryers
Dryer
Grants access to read or modify all resources under /api/homeappliances on dryers
FridgeFreezer-Monitor
Grants access to read resources under /api/homeappliances except images and settings on fridgefreezers
FridgeFreezer-Settings
Grants access to read and modify resources under /api/homeappliances/{haid}/settings on fridgefreezers
FridgeFreezer-Images
Grants access to read resources under /api/homeappliances/{haid}/images on fridgefreezers
FridgeFreezer
Grants access to read or modify all resources under /api/homeappliances on fridgefreezers
CoffeeMaker-Monitor
Grants access to read resources under /api/homeappliances except images and settings on coffee makers
CoffeeMaker-Control
Grants access to modify resources under under /api/homeappliances except images and settings on coffee makers
CoffeeMaker-Settings
Grants access to read and modify resources under /api/homeappliances/{haid}/settings on coffee makers
CoffeeMaker
Grants access to read or modify all resources under /api/homeappliances on coffeemakers

swhome

Hi, ich habe folgende Scopes ausgewählt:

    my $scope = "IdentifyAppliance%20Monitor%20Settings%20Dishwasher-Control%20Washer-Control%20Dryer-Control%20CoffeeMaker-Control";

in Zeile 123 von 48_HomeConnectConnection.pm. Das war bei mir das Maximum was geht. Ich hab schon den Plan die Scopes per Attribut konfigurierbar zu machen.

Probier doch mal nur IdentifyAppliance als einzigen Scope, das muss gehen. Ich habe diese Fehlermeldung auch schon bekommen wenn man zB Oven-Control auswählt.

Im Einsatz: FHEM auf Raspberry Pi mit 350 devices, hauptsächlich Homematic Wired und HM-Heizungsregler, dazu diverse Eigenbauten für Fussbodenheizung und LED Beleuchtung. Und jetzt mit Alexa!

Dersch

#92
wenn ich nun als RedirectUrl http://192.168.10.6:8083/fhem?cmd.Test=set%20hcconn%20auth%20IdentifyAppliance%20 verwende kommt

{
  "error": "unauthorized_client",
  "error_description": "client not authorized for server access",
  "state": "HomeConnectConnection_auth"
}

swhome

#93
Ne so klappts nicht, du musst die Scopes in der pm Datei ändern und FHEM neu starten. Die Redirect URL muss so bleiben wie beschrieben

P.s. Sorry bin grad am kochen kann kein Update machen  ;D
Im Einsatz: FHEM auf Raspberry Pi mit 350 devices, hauptsächlich Homematic Wired und HM-Heizungsregler, dazu diverse Eigenbauten für Fussbodenheizung und LED Beleuchtung. Und jetzt mit Alexa!

Dersch

Ahhhh ok diese Info hilft mir weiter :D

Dersch

Leider auch mit dem Ändern der PM Dateil kein Erfolg.

{
  "error": "unauthorized_client",
  "error_description": "client not authorized for server access",
  "state": "HomeConnectConnection_auth"
}

BTW: du sagst immmer FHEM neustarten. Ein "reload 48_HomeConnectConnection.pm" unter FHEM sollte doch reichen? Ich habe jedenfalls beides probiert.

swhome

Hi ja Neustart brauchst Du nur nach dem ersten Hinzufügen des neuen Moduls, danach genügt ein reload.

Warum immer noch nicht geht ist mir recht rätselhaft. Du bist sicher dass die Redirect URL in fhem und in Home Connect Developer identisch konfiguriert ist?

Kannst Du alternativ mal probieren, den API Client https://apiclient.home-connect.com/ zum Laufen zu bringen? Dazu musst du wie auf der API-Client-Seite beschrieben eine zweite Application erstellen und den Key dann oben rechts eintragen. Danach die Methode get /homeappliances auswählen und mit dem kleinen "Schalter" freischalten. Die Funktion ausführen mit try it out Button.
Wenn das auch nicht klappt, hat Home Connect immer noch Probleme mit den API Keys...

Im Einsatz: FHEM auf Raspberry Pi mit 350 devices, hauptsächlich Homematic Wired und HM-Heizungsregler, dazu diverse Eigenbauten für Fussbodenheizung und LED Beleuchtung. Und jetzt mit Alexa!

Dersch

Ja die URL ist korrekt auf beiden Seiten.

Die Methode über https://apiclient.home-connect.com/ geht auch nicht:

{"error":"unauthorized_client","error_description":"request rejected by client authorization authority (developer portal)"}

BOFH

#98
Also vorweg , schöne Arbeit

Ich hab deine beiden Module installiert.
Es fehlte mir libswitch-perl , via apt installiert - alles gut.

danach die definitionen probiert und erhielt ein ERROR im fhem, im log das:

2016.11.02 19:19:18 1: PERL WARNING: Use of uninitialized value $tokens in concatenation (.) or string at ./FHEM/48_HomeConnectConnection.pm line 146.
2016.11.02 19:19:18 3: Searching auth tokens in:
2016.11.02 19:19:18 1: PERL WARNING: Use of uninitialized value $tokens in pattern match (m//) at ./FHEM/48_HomeConnectConnection.pm line 147.
2016.11.02 19:19:18 1: PERL WARNING: Use of uninitialized value $code in concatenation (.) or string at ./FHEM/48_HomeConnectConnection.pm line 151.
2016.11.02 19:19:18 3: Got oauth code:
2016.11.02 19:19:18 1: PERL WARNING: Use of uninitialized value $_ in substitution (s///) at FHEM/HttpUtils.pm line 49.
2016.11.02 19:19:18 1: PERL WARNING: Use of uninitialized value in concatenation (.) or string at FHEM/HttpUtils.pm line 362.
2016.11.02 19:19:18 2: hcconn: AuthTokenResponse {"error":"invalid_request","error_description":"missing or invalid request parameters"}


Die zeile 123 für den scope auf lediglich IdentifyAppliance%20Settings geändert um vorweg schon mit den rudimentären zu arbeiten.
und TADA - Logged in

ein  "scan" brachte mir dann  6 Geräte, die des Simulators .



[edit]
Sobald ich mein Scope erweitere
z.B.
IdentifyAppliance%20Settings%20Monitor%20Oven-Monitor%20Oven-Control%20Oven-Settings

Erhalte ich aus dem Loginversuch : http://..../cmd.Test=set%20hcconn%20auth%20&error=invalid_scope&error_description=given+scope+doesn%27t+match+requested+scope

Log

2016.11.02 20:02:16 3: Searching auth tokens in:
2016.11.02 20:02:16 3: Got oauth code:
2016.11.02 20:02:17 2: hcconn: AuthTokenResponse {"error":"invalid_request","error_description":"missing or invalid request parameters"}

[/edit]
RasPi 4
ZWave.me ZME_UZB (Fibaro Auge Gen.2)/ HM-USB2 (Thermostat | Hutschienen Relais | 1-/2fach Schalter) / Enigma2 / PhilipsTV / Philips HUE (GO|Bulb|Stripe (plus)) / Somfy IO Rollos / BOSCH HSG636XS6 / SONOS (P1, P3, P5 2.Gen, SUB, Bar)

swhome

Ja, Oven-Control geht nicht mehr, das hatten mir die Leute von Home Connect schon angekündigt. Dishwasher-Control zB funktioniert aber bei mir.

Bleibt die Frage warum es bei Dersch nicht klappt. Die Fehlermeldung "rejected by client authorization" hab ich auch schon öfters gesehen, Ursachen waren entweder dass die Redirect URL nicht übereinstimmt oder dass die Option simulator in der Definition fehlt. Vielleicht vertippt oder Groß geschrieben? Ich fürchte es könnte case sensitive sein.
Im Einsatz: FHEM auf Raspberry Pi mit 350 devices, hauptsächlich Homematic Wired und HM-Heizungsregler, dazu diverse Eigenbauten für Fussbodenheizung und LED Beleuchtung. Und jetzt mit Alexa!

swhome

Es gibt eine neue Version im GIT mit den Verbesserungen:

  • Added new attribute accessScope to setup access rights

  • Display error messages after logon

Damit wird das Ändern der Zeile 123 überflüssig und man sieht die Fehlermeldungen wenn es Probleme mit dem HC Login gibt.
Im Einsatz: FHEM auf Raspberry Pi mit 350 devices, hauptsächlich Homematic Wired und HM-Heizungsregler, dazu diverse Eigenbauten für Fussbodenheizung und LED Beleuchtung. Und jetzt mit Alexa!

Dersch

#101
Ich weiß nicht mehr was ich falsch mache.

Mit dem neuem Modul bleibt alles beim alten

Der LogIN gibt nur das zurück

{
  "error": "unauthorized_client",
  "error_description": "client not authorized for server access",
  "state": "HomeConnectConnection_auth"
}



Das LOG sagt das

2016.11.03 10:37:00 1: PERL WARNING: Subroutine HomeConnectConnection_Set redefined at ./FHEM/48_HomeConnectConnection.pm line 45.
2016.11.03 10:37:00 1: PERL WARNING: Subroutine HomeConnectConnection_Define redefined at ./FHEM/48_HomeConnectConnection.pm line 75.
2016.11.03 10:37:00 1: PERL WARNING: Subroutine HomeConnectConnection_FwFn redefined at ./FHEM/48_HomeConnectConnection.pm line 110.
2016.11.03 10:37:00 1: PERL WARNING: Subroutine HomeConnectConnection_GetAuthToken redefined at ./FHEM/48_HomeConnectConnection.pm line 142.
2016.11.03 10:37:00 1: PERL WARNING: Subroutine HomeConnectConnection_RefreshToken redefined at ./FHEM/48_HomeConnectConnection.pm line 223.
2016.11.03 10:37:00 1: PERL WARNING: Subroutine HomeConnectConnection_AutocreateDevices redefined at ./FHEM/48_HomeConnectConnection.pm line 322.
2016.11.03 10:37:00 1: PERL WARNING: Subroutine HomeConnectConnection_Undef redefined at ./FHEM/48_HomeConnectConnection.pm line 348.
2016.11.03 10:37:00 1: PERL WARNING: Subroutine HomeConnectConnection_Get redefined at ./FHEM/48_HomeConnectConnection.pm line 358.
2016.11.03 10:37:00 1: PERL WARNING: Subroutine HomeConnectConnection_RefreshTokenTimer redefined at ./FHEM/48_HomeConnectConnection.pm line 372.
2016.11.03 10:37:00 1: PERL WARNING: Subroutine HomeConnectConnection_request redefined at ./FHEM/48_HomeConnectConnection.pm line 384.
2016.11.03 10:37:00 1: PERL WARNING: Subroutine HomeConnectConnection_putrequest redefined at ./FHEM/48_HomeConnectConnection.pm line 426.
2016.11.03 10:37:00 1: PERL WARNING: Subroutine HomeConnectConnection_delrequest redefined at ./FHEM/48_HomeConnectConnection.pm line 473.



Danach habe ich FHEM einfach nochmal neugestartet und das hconn device gelöscht sowie neu erstellt.

Dann kommt das

Login to Home Connect failed with error invalid_scope: given scope doesn't match requested scope

danach das attr accessScope auf IdentifyAppliance%20Settings geändert und nochmal probiert.

Bleibt aber gleich mit Login to Home Connect failed with error invalid_scope: given scope doesn't match requested scope

Hier ein List

Internals:
   CFGFN
   DEF        ID http://192.168.10.6:8083/fhem?cmd.Test=set%20hcconn%20auth%20 simulator
   NAME       hcconn
   NR         288
   STATE      Login necessary
   TYPE       HomeConnectConnection
   api_uri    https://developer.home-connect.com
   client_id  299BCB1A2DA6EB5736B7F218D8DDD021CC6070B5CFDD348C40E63001405A7BB2
   expires_at
   redirect_uri http://192.168.10.6:8083/fhem?cmd.Test=set%20hcconn%20auth%20
   simulator  1
Attributes:
   accessScope IdentifyAppliance%20Settings
   room       Test


Auch das Erstellen einer neuen Application mit neuer ID bringt nichts.

Dersch

#102
OK ich hab's!!!

Mit dem Scope nur auf IdentifyAppliance klappt der login! Und ich kann einen scan machen!!!

Internals:
   CFGFN
   DEF        ID http://192.168.10.6:8083/fhem?cmd.Test=set%20hcconn%20auth%20 simulator
   NAME       hcconn
   NR         288
   STATE      Logged in
   TYPE       HomeConnectConnection
   api_uri    https://developer.home-connect.com
   client_id  D94DFCD975CBE479AA77DD0E00419379E33CBC4F6DE621488F70D18B9E8127FA
   expires_at 1478253159
   redirect_uri http://192.168.10.6:8083/fhem?cmd.Test=set%20hcconn%20auth%20
   simulator  1
   Readings:
     2016-11-03 10:52:39   tokenExpiry     Fri Nov  4 10:52:39 2016
Attributes:
   accessScope IdentifyAppliance
   room       Test


Allerdings wird das Log zugemüllt

016.11.03 11:29:36 2: Nothing to read, channel closed
2016.11.03 11:29:36 2: Nothing to read, channel closed
2016.11.03 11:29:36 2: Nothing to read, channel closed
2016.11.03 11:29:36 2: Nothing to read, channel closed
2016.11.03 11:29:56 2: Nothing to read, channel closed
2016.11.03 11:29:56 2: Nothing to read, channel closed
2016.11.03 11:29:56 2: Nothing to read, channel closed
2016.11.03 11:29:56 2: Nothing to read, channel closed
2016.11.03 11:29:56 2: Nothing to read, channel closed
2016.11.03 11:29:56 2: Nothing to read, channel closed
2016.11.03 11:30:19 2: Nothing to read, channel closed
2016.11.03 11:30:19 2: Nothing to read, channel closed
2016.11.03 11:30:19 2: Nothing to read, channel closed
2016.11.03 11:30:19 2: Nothing to read, channel closed
2016.11.03 11:30:19 2: Nothing to read, channel closed
2016.11.03 11:30:19 2: Nothing to read, channel closed
2016.11.03 11:30:39 2: Nothing to read, channel closed
2016.11.03 11:30:39 2: Nothing to read, channel closed
2016.11.03 11:30:39 2: Nothing to read, channel closed
2016.11.03 11:30:39 2: Nothing to read, channel closed
2016.11.03 11:30:39 2: Nothing to read, channel closed
2016.11.03 11:30:39 2: Nothing to read, channel closed
2016.11.03 11:30:59 2: Nothing to read, channel closed
2016.11.03 11:31:00 2: Nothing to read, channel closed
2016.11.03 11:31:00 2: Nothing to read, channel closed
2016.11.03 11:31:00 2: Nothing to read, channel closed
2016.11.03 11:31:00 2: Nothing to read, channel closed
2016.11.03 11:31:00 2: Nothing to read, channel closed
2016.11.03 11:31:22 2: Nothing to read, channel closed
2016.11.03 11:31:22 2: Nothing to read, channel closed
2016.11.03 11:31:22 2: Nothing to read, channel closed
2016.11.03 11:31:22 2: Nothing to read, channel closed
2016.11.03 11:31:22 2: Nothing to read, channel closed
2016.11.03 11:31:22 2: Nothing to read, channel closed
2016.11.03 11:31:43 2: Nothing to read, channel closed
2016.11.03 11:31:43 2: Nothing to read, channel closed
2016.11.03 11:31:43 2: Nothing to read, channel closed
2016.11.03 11:31:43 2: Nothing to read, channel closed
2016.11.03 11:31:43 2: Nothing to read, channel closed
2016.11.03 11:31:43 2: Nothing to read, channel closed
2016.11.03 11:32:03 2: Nothing to read, channel closed
2016.11.03 11:32:03 2: Nothing to read, channel closed
2016.11.03 11:32:03 2: Nothing to read, channel closed
2016.11.03 11:32:03 2: Nothing to read, channel closed
2016.11.03 11:32:03 2: Nothing to read, channel closed
2016.11.03 11:32:03 2: Nothing to read, channel closed
2016.11.03 11:32:25 2: Nothing to read, channel closed
2016.11.03 11:32:25 2: Nothing to read, channel closed
2016.11.03 11:32:25 2: Nothing to read, channel closed
2016.11.03 11:32:26 2: Nothing to read, channel closed
2016.11.03 11:32:26 2: Nothing to read, channel closed
2016.11.03 11:32:26 2: Nothing to read, channel closed
2016.11.03 11:32:45 2: Nothing to read, channel closed
2016.11.03 11:32:46 2: Nothing to read, channel closed
2016.11.03 11:32:46 2: Nothing to read, channel closed
2016.11.03 11:32:46 2: Nothing to read, channel closed
2016.11.03 11:32:46 2: Nothing to read, channel closed
2016.11.03 11:32:46 2: Nothing to read, channel closed
2016.11.03 11:33:05 2: Nothing to read, channel closed
2016.11.03 11:33:06 2: Nothing to read, channel closed
2016.11.03 11:33:06 2: Nothing to read, channel closed
2016.11.03 11:33:06 2: Nothing to read, channel closed
2016.11.03 11:33:06 2: Nothing to read, channel closed
2016.11.03 11:33:06 2: Nothing to read, channel closed


Ich habe dann die Devices wieder gelöscht und einen Logout gemacht damit das Log nicht im Sekundentakt zugespammt wird.

Nur wie geht es weiter? Nur IdentifyAppliance bringt ja nicht viel.

swhome

#103
Ja, der scope "Monitor" muss mindestens dazu sonst bringts echt nix.

Aber immerhin schon mal ein erfolgreicher Login! Ich würde sagen wir sind auf dem richtigen Weg  ;)

Du könntest mal mal probieren ob Du Monitor für einzelne Gerätetypen anmelden kannst, z.B. Dishwasher-Monitor. Ich hab ein wenig das Gefühl dass Dein Home-Connect Account irgendwie verhunzt worden ist. Leider sind aber die Herrschaften bei HC diese Woche im Urlaub....

P.S: Die Scopes im Attribut accessScope bitte einfach mit Leerzeichen trennen, nicht mit %20. Diese Ersetzung passiert intern. Also bitte mal einfach mit IdentifyAppliance Monitor testen.
Im Einsatz: FHEM auf Raspberry Pi mit 350 devices, hauptsächlich Homematic Wired und HM-Heizungsregler, dazu diverse Eigenbauten für Fussbodenheizung und LED Beleuchtung. Und jetzt mit Alexa!

BOFH

Einzelne Geräte Monitore geht . Check

Sobald ich aber ein xxx-Control , xxxx-Settings im scope einfüge, bekomm ich ein ERROR
2016.11.03 18:30:02 3: Searching auth tokens in:
2016.11.03 18:30:02 3: Got oauth code:
2016.11.03 18:30:02 2: hcconn: AuthTokenResponse {"error":"invalid_request","error_description":"missing or invalid request parameters"}
RasPi 4
ZWave.me ZME_UZB (Fibaro Auge Gen.2)/ HM-USB2 (Thermostat | Hutschienen Relais | 1-/2fach Schalter) / Enigma2 / PhilipsTV / Philips HUE (GO|Bulb|Stripe (plus)) / Somfy IO Rollos / BOSCH HSG636XS6 / SONOS (P1, P3, P5 2.Gen, SUB, Bar)