added apiKey storage

master
Boernsman 2020-10-19 19:05:47 +02:00
parent 566770890f
commit 5be1f64faf
4 changed files with 7 additions and 7 deletions

View File

@ -121,7 +121,6 @@ public:
// DEFAULT
void getHomeAppliances(); // Get all home appliances which are paired with the logged-in user account.
void getHomeAppliance(const QString &haid); //Get a specfic home appliances which are paired with the logged-in user account.
// PROGRAMS
void getPrograms(const QString &haId); //Get all programs of a given home appliance

View File

@ -144,8 +144,9 @@ void IntegrationPluginHomeConnect::startPairing(ThingPairingInfo *info)
bool simulationMode = configValue(homeConnectPluginSimulationModeParamTypeId).toBool();
bool controlEnabled = configValue(homeConnectPluginControlEnabledParamTypeId).toBool();
HomeConnect *homeConnect = new HomeConnect(hardwareManager()->networkManager(), "423713AB3EDA5B44BCE6E7B3546C43DADCB27A156C681E30455250637B2213DB", "AE182EA9F1CB99416DFD62CE61BF6DCDB3BB7D4697B58D4499D3792EC9F7412D", simulationMode, this);
QByteArray clientKey = apiKeyStorage()->requestKey("homeconnect").data("clientKey");
QByteArray clientSecret = apiKeyStorage()->requestKey("homeconnect").data("clientSecret");
HomeConnect *homeConnect = new HomeConnect(hardwareManager()->networkManager(), clientKey, clientSecret, simulationMode, this);
QString scope = "IdentifyAppliance Monitor Settings Dishwasher Washer Dryer WasherDryer Refrigerator Freezer WineCooler CoffeeMaker Hood CookProcessor";
if (controlEnabled)
scope.append(" Control");
@ -224,7 +225,9 @@ void IntegrationPluginHomeConnect::setupThing(ThingSetupInfo *info)
pluginStorage()->beginGroup(thing->id().toString());
QByteArray refreshToken = pluginStorage()->value("refresh_token").toByteArray();
pluginStorage()->endGroup();
homeConnect = new HomeConnect(hardwareManager()->networkManager(), "423713AB3EDA5B44BCE6E7B3546C43DADCB27A156C681E30455250637B2213DB", "AE182EA9F1CB99416DFD62CE61BF6DCDB3BB7D4697B58D4499D3792EC9F7412D", simulationMode, this);
QByteArray clientKey = apiKeyStorage()->requestKey("homeconnect").data("clientKey");
QByteArray clientSecret = apiKeyStorage()->requestKey("homeconnect").data("clientSecret");
homeConnect = new HomeConnect(hardwareManager()->networkManager(), clientKey, clientSecret, simulationMode, this);
homeConnect->getAccessTokenFromRefreshToken(refreshToken);
m_asyncSetup.insert(homeConnect, info);
}

View File

@ -91,8 +91,6 @@ private:
QHash<QString, QString> m_coffeeStrengthTypes;
HomeConnect *createHomeConnection();
void parseKey(Thing *thing, const QString &key, const QVariant &value);
void parseSettingKey(Thing *thing, const QString &key, const QVariant &value);
@ -103,7 +101,6 @@ private slots:
void onReceivedHomeAppliances(const QList<HomeConnect::HomeAppliance> &appliances);
void onReceivedStatusList(const QString &haId, const QHash<QString, QVariant> &statusList);
void onReceivedEvents(HomeConnect::EventType eventType, const QString &haId, const QList<HomeConnect::Event> &events);
void onReceivedActiveProgram(const QString &haId, const QString &key, const QHash<QString, QVariant> &options);
void onReceivedSelectedProgram(const QString &haId, const QString &key, const QHash<QString, QVariant> &options);
void onReceivedSettings(const QString &haId, const QHash<QString, QVariant> &settings);
};

View File

@ -18,6 +18,7 @@
"type": "bool"
}
],
"apiKeys": ["homeconnect"],
"vendors": [
{
"id": "43cfb7a4-402f-4315-86b5-ce095697fd13",