$value) { $Erg[$key] = $value; } //print_r($responseData); return $Erg; } //Abfrage Kilometerstand function GetCockpitData(){ $ObjektInfo = IPS_GetObject(IPS_GetParent($_IPS[\'SELF\'])); $ObjectID = $ObjektInfo[\'ObjectID\']; $TokenID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_TokenID", $ObjectID)); $AccountID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_AccountID", $ObjectID)); $KameronID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_KAMEREON_API", $ObjectID)); $VinID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_VIN", $ObjectID)); $CountryID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_COUNTRY", $ObjectID)); $postData = array( \'apikey: \'.$KameronID, \'x-gigya-id_token: \'.$TokenID ); $ch = curl_init(\'https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/\'.$AccountID.\'/kamereon/kca/car-adapter/v1/cars/\'.$VinID.\'/cockpit?country=\'.$CountryID); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER, $postData); $response = curl_exec($ch); if ($response === FALSE) die(curl_error($ch)); $responseData = json_decode($response, TRUE); $Erg = $responseData[\'data\'][\'attributes\'][\'totalMileage\']; return $Erg; } // hole Positionsdaten function GetPosition(){ $ObjektInfo = IPS_GetObject(IPS_GetParent($_IPS[\'SELF\'])); $ObjectID = $ObjektInfo[\'ObjectID\']; $TokenID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_TokenID", $ObjectID)); $AccountID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_AccountID", $ObjectID)); $KameronID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_KAMEREON_API", $ObjectID)); $VinID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_VIN", $ObjectID)); $CountryID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_COUNTRY", $ObjectID)); $postData = array( \'apikey: \'.$KameronID, \'x-gigya-id_token: \'.$TokenID ); $ch = curl_init(\'https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/\'.$AccountID.\'/kamereon/kca/car-adapter/v1/cars/\'.$VinID.\'/location?country=\'.$CountryID); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER, $postData); $response = curl_exec($ch); if ($response === FALSE) die(curl_error($ch)); $responseData = json_decode($response, TRUE); $Erg["gpsLatitude"]=$responseData[\'data\'][\'attributes\'][\'gpsLatitude\']; $Erg["gpsLongitude"]=$responseData[\'data\'][\'attributes\'][\'gpsLongitude\']; $Erg["gpsUpdate"]=$responseData[\'data\'][\'attributes\'][\'lastUpdateTime\']; return $Erg; } function SetPositionMaps(){ $ObjektInfo = IPS_GetObject(IPS_GetParent($_IPS[\'SELF\'])); $ObjectID = $ObjektInfo[\'ObjectID\']; $GoogleApi = IPS_GetObjectIDByIdent($ObjectID."_GOOGLE_API", $ObjectID); if (GetValue($GoogleApi)){ $GoogleApi = GetValue(IPS_GetObjectIDByIdent($ObjectID."_GOOGLE_API", $ObjectID)); $Lat = IPS_GetObjectIDByIdent($ObjectID."_gpsLatitude", $ObjectID); $Lon = IPS_GetObjectIDByIdent($ObjectID."_gpsLongitude", $ObjectID); $HTMLMap = IPS_GetObjectIDByIdent($ObjectID."_HTML_MAP", $ObjectID); // tausche float komma gegen punkt $Lat=str_replace(",", ".", (Getvalue($Lat))); $Lon=str_replace(",", ".", (Getvalue($Lon))); $StringHtml = \' \'; SetValueString($HTMLMap,$StringHtml); }else{ echo "GoogleApi Key fehlt"; } } function climateStart($Action = "start"){ $ObjektInfo = IPS_GetObject(IPS_GetParent($_IPS[\'SELF\'])); $ObjectID = $ObjektInfo[\'ObjectID\']; $TokenID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_TokenID", $ObjectID)); $AccountID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_AccountID", $ObjectID)); $KameronID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_KAMEREON_API", $ObjectID)); $VinID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_VIN", $ObjectID)); $CountryID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_COUNTRY", $ObjectID)); $postData = array( \'Content-type: application/vnd.api+json\', \'apikey: \'.$KameronID, \'x-gigya-id_token: \'.$TokenID ); $jsonData = \'{"data":{"type":"HvacStart","attributes":{"action":"\'.$Action.\'","targetTemperature":"21"}}}\'; $ch = curl_init(\'https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/\'.$AccountID.\'/kamereon/kca/car-adapter/v1/cars/\'.$VinID.\'/actions/hvac-start?country=\'.$CountryID); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER, $postData); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); $response = curl_exec($ch); if ($response === FALSE) die(curl_error($ch)); //echo $response; } function ChargingStart($Action = "start"){ $ObjektInfo = IPS_GetObject(IPS_GetParent($_IPS[\'SELF\'])); $ObjectID = $ObjektInfo[\'ObjectID\']; $TokenID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_TokenID", $ObjectID)); $AccountID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_AccountID", $ObjectID)); $KameronID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_KAMEREON_API", $ObjectID)); $VinID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_VIN", $ObjectID)); $CountryID = GetValue(IPS_GetObjectIDByIdent($ObjectID."_COUNTRY", $ObjectID)); $postData = array( \'Content-type: application/vnd.api+json\', \'apikey: \'.$KameronID, \'x-gigya-id_token: \'.$TokenID ); $jsonData = \'{"data":{"type":"ChargingStart","attributes":{"action":"\'.$Action.\'"}}}\'; $ch = curl_init(\'https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/\'.$AccountID.\'/kamereon/kca/car-adapter/v1/cars/\'.$VinID.\'/actions/charging-start?country=\'.$CountryID); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER, $postData); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); $response = curl_exec($ch); if ($response === FALSE) die(curl_error($ch)); } if ($_IPS[\'SENDER\'] == \'RunScript\') { $Funktion = $_IPS[\'Funktion\']; switch ($Funktion){ case \'StartClimate\': climateStart(); break; case \'StopClimate\': climateStart("stop"); break; case \'StartCharge\': ChargingStart(); break; case \'StopCharge\': ChargingStart("stop"); break; case \'Test\': echo "Dies ist ein Test!"; IPS_LogMessage($_IPS[\'SELF\'], "Dies ist ein Test!"); break; } } '; $SetGetTokenScriptfile = ' $gigya_api, \'loginId\' => $username, \'password\' => $password, \'include\' => \'data\', \'sessionExpiration\' => 86700 ); $ch = curl_init(\'https://accounts.eu1.gigya.com/accounts.login\'); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); $response = curl_exec($ch); if ($response === FALSE) die(curl_error($ch)); $responseData = json_decode($response, TRUE); $PersonId = $responseData[\'data\'][\'personId\']; //print_r($responseData); SetValueString($PersonID_Var,$PersonId); $oauth_token = $responseData[\'sessionInfo\'][\'cookieValue\']; $postData = array( \'login_token\' => $oauth_token, \'ApiKey\' => $gigya_api, \'fields\' => \'data.personId,data.gigyaDataCenter\', \'expiration\' => 86400 ); $ch = curl_init(\'https://accounts.eu1.gigya.com/accounts.getJWT\'); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); $response = curl_exec($ch); if ($response === FALSE) die(curl_error($ch)); $responseData = json_decode($response, TRUE); $TokenID = $responseData[\'id_token\']; SetValueString($TokenID_Var,$TokenID); '; $SetGetDataScript = '= $MaxChargingLevel) ){ //echo "Auto Voll, Ladung stoppen" ; IPS_RunScriptEx(IPS_GetObjectIDByIdent($ObjectID."_Funktionen",$ObjectID), array ("Funktion" => "StopCharge")); } SetValue($_IPS[\'VARIABLE\'], $_IPS[\'VALUE\']); '; $SetClimateScript = ' "StopClimate")); } break; Case 1 || true: // Bool (1) if (!GetValue($_IPS[\'VARIABLE\']) === $_IPS[\'VALUE\'] ){ IPS_RunScriptEx(IPS_GetObjectIDByIdent($ObjectID."_Funktionen",$ObjectID), array ("Funktion" => "StartClimate")); } break; } SetValue($_IPS[\'VARIABLE\'], $_IPS[\'VALUE\']); '; if ($_IPS['SENDER'] == "Execute") { // erstelle Scriptdatei zur Tokenaktualisierung if (! @IPS_GetObjectIDByIdent($ObjectID."_GetToken",$ObjectID)) { echo "erstelle Scriptdatei zur Tokenaktualisierung\n"; $GetTokenID = IPS_CreateScript(0); IPS_SetParent($GetTokenID, $ObjectID); IPS_SetName($GetTokenID, "GetToken"); IPS_SetIdent($GetTokenID, $ObjectID."_GetToken"); IPS_SetScriptContent($GetTokenID, $SetGetTokenScriptfile); $events = IPS_CreateEvent(1); IPS_SetParent($events, IPS_GetObjectIDByIdent($ObjectID."_GetToken", $ObjectID)); IPS_SetEventCyclicTimeFrom($events, 0, 0, 0); IPS_SetEventActive($events, true); } if (! @IPS_GetObjectIDByIdent($ObjectID."_Funktionen",$ObjectID)) { echo "erstelle Funktionsdatei zur Tokenaktualisierung\n"; $GetFunktionID = IPS_CreateScript(0); IPS_SetParent($GetFunktionID, $ObjectID); IPS_SetName($GetFunktionID, "Funktionen"); IPS_SetIdent($GetFunktionID, $ObjectID."_Funktionen"); IPS_SetScriptContent($GetFunktionID, $SetFunctionScriptfile); } if (! @IPS_GetObjectIDByIdent($ObjectID."_Funktionen",$ObjectID)) { echo "erstelle Funktionsdatei zur Tokenaktualisierung\n"; $GetFunktionID = IPS_CreateScript(0); IPS_SetParent($GetFunktionID, $ObjectID); IPS_SetName($GetFunktionID, "Funktionen"); IPS_SetIdent($GetFunktionID, $ObjectID."_Funktionen"); IPS_SetScriptContent($GetFunktionID, $SetFunctionScriptfile); } if (! @IPS_GetObjectIDByIdent($ObjectID."_GetDataScript",$ObjectID)) { echo "erstelle Scriptdatei zur Datenaktualisierung\n"; $GetDataID = IPS_CreateScript(0); IPS_SetParent($GetDataID, $ObjectID); IPS_SetName($GetDataID, "GetDataScript"); IPS_SetIdent($GetDataID, $ObjectID."_GetDataScript"); IPS_SetScriptContent($GetDataID, $SetGetDataScript); $events = IPS_CreateEvent(1); IPS_SetParent($events, IPS_GetObjectIDByIdent($ObjectID."_GetDataScript", $ObjectID)); IPS_SetEventCyclic($events, 0, 0, 0, 0, 2, 5); IPS_SetEventActive($events, true); } // erstelle Variable für Lademenge, mit Profil und Script if (! @IPS_VariableProfileExists("_ZOE_ChargingValue")) { echo "erstelle Profil für Lademenge\n"; IPS_CreateVariableProfile("_ZOE_ChargingValue", 1); IPS_SetVariableProfileAssociation("_ZOE_ChargingValue", 60, "60%", "", 0xFFFFFF); IPS_SetVariableProfileAssociation("_ZOE_ChargingValue", 70, "70%", "", 0xFFFFFF); IPS_SetVariableProfileAssociation("_ZOE_ChargingValue", 80, "80%", "", 0xFFFFFF); IPS_SetVariableProfileAssociation("_ZOE_ChargingValue", 90, "90%", "", 0xFFFFFF); IPS_SetVariableProfileAssociation("_ZOE_ChargingValue", 100, "100%", "", 0xFFFFFF); IPS_SetVariableProfileValues("_ZOE_ChargingValue", 60, 100, 10); } if (! @IPS_GetObjectIDByIdent($ObjectID."_ChargingVar",$ObjectID)) { echo "erstelle Variable für Lademenge\n"; $VARCHARGSCRIPT = IPS_CreateVariable(1); IPS_SetParent($VARCHARGSCRIPT, $ObjectID); IPS_SetName($VARCHARGSCRIPT, "max. Lademenge"); IPS_SetIdent($VARCHARGSCRIPT, $ObjectID."_ChargingVar"); IPS_SetVariableCustomProfile($VARCHARGSCRIPT, "_ZOE_ChargingValue"); } if (! @IPS_GetObjectIDByIdent($ObjectID."_batteryLevel",$ObjectID)) { echo "erstelle Variable für Battery Level \n"; $VARBATLVL = IPS_CreateVariable(1); IPS_SetParent($VARBATLVL, $ObjectID); IPS_SetName($VARBATLVL, "Battery Level"); IPS_SetIdent($VARBATLVL, $ObjectID."_batteryLevel"); IPS_SetVariableCustomProfile($VARBATLVL, "~Battery.100"); } if (! @IPS_GetObjectIDByIdent($ObjectID."_ChargingCheckscript",$ObjectID)) echo "erstelle Script und Event für Lademenge\n"; $CreateScriptCharge = IPS_CreateScript(0); IPS_SetName($CreateScriptCharge, "Script"); IPS_SetIdent($CreateScriptCharge, $ObjectID."_ChargingCheckscript"); IPS_SetScriptContent($CreateScriptCharge, $SetChargingScript); IPS_SetParent($CreateScriptCharge, $VARCHARGSCRIPT); $events_BattSoc = IPS_CreateEvent(0); IPS_SetParent($events_BattSoc, $CreateScriptCharge); IPS_SetEventTrigger($events_BattSoc, 1, $VARBATLVL); IPS_SetEventActive($events_BattSoc, true); IPS_SetVariableCustomAction($VARCHARGSCRIPT, $CreateScriptCharge); IPS_SetHidden($CreateScriptCharge, true); } if (! @IPS_GetObjectIDByIdent($ObjectID."_ClimateVarBool",$ObjectID)) { echo "erstelle Variable für Vorklimatisierung \n"; $VARClimateBool = IPS_CreateVariable(0); IPS_SetParent($VARClimateBool, $ObjectID); IPS_SetName($VARClimateBool, "Vorklimatisierung"); IPS_SetIdent($VARClimateBool, $ObjectID."_ClimateVarBool"); IPS_SetVariableCustomProfile($VARClimateBool, "~Switch"); } if (! @IPS_GetObjectIDByIdent($ObjectID."_ClimateScript",$ObjectID)) { echo "erstelle Script zur Vorklimatisierung\n"; $GetClimaScript = IPS_CreateScript(0); IPS_SetParent($GetClimaScript, $VARClimateBool); IPS_SetName($GetClimaScript, "Script"); IPS_SetIdent($GetClimaScript, $ObjectID."_ClimateScript"); IPS_SetScriptContent($GetClimaScript, $SetClimateScript); IPS_SetVariableCustomAction($VARClimateBool, $GetClimaScript); IPS_SetHidden($GetClimaScript, true); } // Token if (! @IPS_GetObjectIDByIdent($ObjectID."_TokenID",$ObjectID)) { echo "erstelle Variable für Token\n"; $VARIP = IPS_CreateVariable(3); IPS_SetParent($VARIP, $ObjectID); IPS_SetName($VARIP, "Token ID"); IPS_SetIdent($VARIP, $ObjectID."_TokenID"); } //Personid if (! @IPS_GetObjectIDByIdent($ObjectID."_PersonID",$ObjectID)) { echo "erstelle Variable für PersonID\n"; $VARIP = IPS_CreateVariable(3); IPS_SetParent($VARIP, $ObjectID); IPS_SetName($VARIP, "Person ID"); IPS_SetIdent($VARIP, $ObjectID."_PersonID"); } //VIN if (! @IPS_GetObjectIDByIdent($ObjectID."_VIN",$ObjectID)) { echo "erstelle Variable mit der VIN\n"; $VARVIN = IPS_CreateVariable(3); IPS_SetParent($VARVIN, $ObjectID); IPS_SetName($VARVIN, "VIN"); IPS_SetIdent($VARVIN, $ObjectID."_VIN"); SetValue($VARVIN,$vin); } if (! @IPS_GetObjectIDByIdent($ObjectID."_COUNTRY",$ObjectID)) { echo "erstelle Variable für das Land\n"; $VARCNT = IPS_CreateVariable(3); IPS_SetParent($VARCNT, $ObjectID); IPS_SetName($VARCNT, "Country"); IPS_SetIdent($VARCNT, $ObjectID."_COUNTRY"); SetValue($VARCNT,$country); } if (! @IPS_GetObjectIDByIdent($ObjectID."_KAMEREON_API",$ObjectID)) { echo "erstelle Variable für das Land\n"; $VARKID = IPS_CreateVariable(3); IPS_SetParent($VARKID, $ObjectID); IPS_SetName($VARKID, "Kamereon API ID"); IPS_SetIdent($VARKID, $ObjectID."_KAMEREON_API"); SetValue($VARKID,$kamereon_api); } //AccountID if (! @IPS_GetObjectIDByIdent($ObjectID."_AccountID",$ObjectID)) { echo "erstelle Variable für die Account ID\n"; $VARAID = IPS_CreateVariable(3); IPS_SetParent($VARAID, $ObjectID); IPS_SetName($VARAID, "Account ID"); IPS_SetIdent($VARAID, $ObjectID."_AccountID"); } if (! @IPS_GetObjectIDByIdent($ObjectID."_GOOGLE_API",$ObjectID)) { echo "erstelle Variable für die GOOGLE API \n"; $VARGAPI = IPS_CreateVariable(3); IPS_SetParent($VARGAPI, $ObjectID); IPS_SetName($VARGAPI, "Google API "); IPS_SetIdent($VARGAPI, $ObjectID."_GOOGLE_API"); } if (! @IPS_GetObjectIDByIdent($ObjectID."_batteryAutonomy",$ObjectID)) { echo "erstelle Variable für Battery Autonomy \n"; $VARBATLVL = IPS_CreateVariable(1); IPS_SetParent($VARBATLVL, $ObjectID); IPS_SetName($VARBATLVL, "Battery Autonomy"); IPS_SetIdent($VARBATLVL, $ObjectID."_batteryAutonomy"); } if (! @IPS_GetObjectIDByIdent($ObjectID."_batteryAvailableEnergy",$ObjectID)) { echo "erstelle Variable für Battery Available Energy \n"; $VARBATAE = IPS_CreateVariable(1); IPS_SetParent($VARBATAE, $ObjectID); IPS_SetName($VARBATAE, "Battery Available Energy"); IPS_SetIdent($VARBATAE, $ObjectID."_batteryAvailableEnergy"); } if (! @IPS_GetObjectIDByIdent($ObjectID."_TotalMileage",$ObjectID)) { echo "erstelle Variable für KM Stand \n"; $VARKM = IPS_CreateVariable(1); IPS_SetParent($VARKM, $ObjectID); IPS_SetName($VARKM, "gesamt KM-Stand"); IPS_SetIdent($VARKM, $ObjectID."_TotalMileage"); } if (! @IPS_GetObjectIDByIdent($ObjectID."_timestampbat",$ObjectID)) { echo "erstelle Variable für timestamp \n"; $VARBATTIME = IPS_CreateVariable(1); IPS_SetParent($VARBATTIME, $ObjectID); IPS_SetName($VARBATTIME, "letzte Aktualisierung Batt"); IPS_SetIdent($VARBATTIME, $ObjectID."_timestampbat"); IPS_SetVariableCustomProfile($VARBATTIME, "~UnixTimestamp"); } if (! @IPS_GetObjectIDByIdent($ObjectID."_plugStatus",$ObjectID)) { echo "erstelle Variable für Plug Status \n"; $VARPS = IPS_CreateVariable(0); IPS_SetParent($VARPS, $ObjectID); IPS_SetName($VARPS, "Plug Status"); IPS_SetIdent($VARPS, $ObjectID."_plugStatus"); } if (! @IPS_GetObjectIDByIdent($ObjectID."_chargingStatus",$ObjectID)) { echo "erstelle Variable für Charging Status \n"; $VARCS = IPS_CreateVariable(0); IPS_SetParent($VARCS, $ObjectID); IPS_SetName($VARCS, "Charging Status"); IPS_SetIdent($VARCS, $ObjectID."_chargingStatus"); } if (! @IPS_GetObjectIDByIdent($ObjectID."_timestampmap",$ObjectID)) { echo "erstelle Variable für timestamp \n"; $VARMAPTIME = IPS_CreateVariable(1); IPS_SetParent($VARMAPTIME, $ObjectID); IPS_SetName($VARMAPTIME, "letzte Aktualisierung Standort"); IPS_SetIdent($VARMAPTIME, $ObjectID."_timestampmap"); IPS_SetVariableCustomProfile($VARMAPTIME, "~UnixTimestamp"); } if (! @IPS_GetObjectIDByIdent($ObjectID."_gpsLatitude",$ObjectID)) { echo "erstelle Variable für GPS Latitude \n"; $VARGPSLAT = IPS_CreateVariable(2); IPS_SetParent($VARGPSLAT, $ObjectID); IPS_SetName($VARGPSLAT, "GPS Latitude"); IPS_SetIdent($VARGPSLAT, $ObjectID."_gpsLatitude"); } if (! @IPS_GetObjectIDByIdent($ObjectID."_gpsLongitude",$ObjectID)) { echo "erstelle Variable für GPS Longitude \n"; $VARGPSLON = IPS_CreateVariable(2); IPS_SetParent($VARGPSLON, $ObjectID); IPS_SetName($VARGPSLON, "GPS Longitude"); IPS_SetIdent($VARGPSLON, $ObjectID."_gpsLongitude"); } if (! @IPS_GetObjectIDByIdent($ObjectID."_HTML_MAP",$ObjectID)) { echo "erstelle Variable für GPS Longitude \n"; $VARPOS = IPS_CreateVariable(3); IPS_SetParent($VARPOS, $ObjectID); IPS_SetName($VARPOS, "Standort Map"); IPS_SetIdent($VARPOS, $ObjectID."_HTML_MAP"); $MAPVAR = IPS_GetObjectIDByIdent($ObjectID."_HTML_MAP", $ObjectID); IPS_SetVariableCustomProfile($MAPVAR, "~HTMLBox"); } function GetAccountID($kamereon_api,$country){ $ObjektInfo = IPS_GetObject(IPS_GetParent($_IPS['SELF'])); $ObjectID=$ObjektInfo['ObjectID']; $TokenID_Var = GetValue(IPS_GetObjectIDByIdent($ObjectID."_TokenID", $ObjectID)); $PersonID_Var = GetValue(IPS_GetObjectIDByIdent($ObjectID."_PersonID", $ObjectID)); //Abfrage Kamereon Account ID $postData = array( 'apikey: '.$kamereon_api, 'x-gigya-id_token: '.$TokenID_Var, ); $ch = curl_init('https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/persons/'.$PersonID_Var.'?country='.$country); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER, $postData); $response = curl_exec($ch); if ($response === FALSE) die(curl_error($ch)); $responseData = json_decode($response, TRUE); //print_r($responseData); $Account = $responseData['accounts'][0]['accountId']; SetValue((IPS_GetObjectIDByIdent($ObjectID."_AccountID", $ObjectID)), $Account); } echo "Starte Script um Accountdaten einzuholen"; IPS_RunScriptWait(IPS_GetObjectIDByIdent($ObjectID."_GetToken", $ObjectID)); GetAccountID($kamereon_api,$country); echo "Starte Script um Fahrzeugdaten einzuholen"; IPS_RunScriptWait(IPS_GetObjectIDByIdent($ObjectID."_GetDataScript", $ObjectID));