fixed rediscovery and error message translation
parent
08b5e73fc3
commit
8693c7d73f
|
|
@ -63,7 +63,7 @@ void IntegrationPluginNetatmo::confirmPairing(ThingPairingInfo *info, const QStr
|
|||
pluginStorage()->endGroup();
|
||||
info->finish(Thing::ThingErrorNoError);
|
||||
} else {
|
||||
info->finish(Thing::ThingErrorAuthenticationFailure, "Wrong username of password");
|
||||
info->finish(Thing::ThingErrorAuthenticationFailure, QT_TR_NOOP("Wrong username or password"));
|
||||
}
|
||||
});
|
||||
authentication->startAuthentication();
|
||||
|
|
@ -104,20 +104,28 @@ void IntegrationPluginNetatmo::setupThing(ThingSetupInfo *info)
|
|||
thing->setParamValue(ParamTypeId("c0d892d6-f359-4782-9d7d-8f74a3b53e3e"), "");
|
||||
}
|
||||
|
||||
OAuth2 *authentication = new OAuth2("561c015d49c75f0d1cce6e13", "GuvKkdtu7JQlPD47qTTepRR9hQ0CUPAj4Tae3Ohcq", this);
|
||||
authentication->setUrl(QUrl("https://api.netatmo.net/oauth2/token"));
|
||||
authentication->setUsername(username);
|
||||
authentication->setPassword(password);
|
||||
authentication->setScope("read_station read_thermostat write_thermostat");
|
||||
m_authentications.insert(authentication, thing);
|
||||
OAuth2 *authentication;
|
||||
if (m_authentications.values().contains(thing)) {
|
||||
qCDebug(dcNetatmo()) << "Re-Discovery, not creating a new authentication";
|
||||
authentication = m_authentications.key(thing);
|
||||
authentication->setUsername(username);
|
||||
authentication->setPassword(password);
|
||||
} else {
|
||||
authentication = new OAuth2("561c015d49c75f0d1cce6e13", "GuvKkdtu7JQlPD47qTTepRR9hQ0CUPAj4Tae3Ohcq", this);
|
||||
authentication->setUrl(QUrl("https://api.netatmo.net/oauth2/token"));
|
||||
authentication->setUsername(username);
|
||||
authentication->setPassword(password);
|
||||
authentication->setScope("read_station read_thermostat write_thermostat");
|
||||
m_authentications.insert(authentication, thing);
|
||||
|
||||
// Update thing connected state based on OAuth connected state
|
||||
connect(authentication, &OAuth2::authenticationChanged, thing, [this, thing, authentication](){
|
||||
thing->setStateValue(netatmoConnectionConnectedStateTypeId, authentication->authenticated());
|
||||
if (authentication->authenticated()) {
|
||||
refreshData(thing, authentication->token());
|
||||
}
|
||||
});
|
||||
// Update thing connected state based on OAuth connected state
|
||||
connect(authentication, &OAuth2::authenticationChanged, thing, [this, thing, authentication](){
|
||||
thing->setStateValue(netatmoConnectionConnectedStateTypeId, authentication->authenticated());
|
||||
if (authentication->authenticated()) {
|
||||
refreshData(thing, authentication->token());
|
||||
}
|
||||
});
|
||||
}
|
||||
authentication->startAuthentication();
|
||||
|
||||
// Report thing setup finished when authentication reports success
|
||||
|
|
@ -127,7 +135,6 @@ void IntegrationPluginNetatmo::setupThing(ThingSetupInfo *info)
|
|||
info->finish(Thing::ThingErrorAuthenticationFailure, QT_TR_NOOP("Error logging in to Netatmo server."));
|
||||
return;
|
||||
}
|
||||
|
||||
info->finish(Thing::ThingErrorNoError);
|
||||
});
|
||||
|
||||
|
|
@ -394,5 +401,3 @@ void IntegrationPluginNetatmo::onOutdoorStatesChanged()
|
|||
thing->setStateValue(outdoorBatteryLevelStateTypeId, outdoor->battery());
|
||||
thing->setStateValue(outdoorBatteryCriticalStateTypeId, outdoor->battery() < 10);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,17 @@
|
|||
<context>
|
||||
<name>IntegrationPluginNetatmo</name>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="57"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="47"/>
|
||||
<source>Please enter the login credentials for your Netatmo account.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="128"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="66"/>
|
||||
<source>Wrong username or password</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="135"/>
|
||||
<source>Error logging in to Netatmo server.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
|||
|
|
@ -4,12 +4,17 @@
|
|||
<context>
|
||||
<name>IntegrationPluginNetatmo</name>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="57"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="47"/>
|
||||
<source>Please enter the login credentials for your Netatmo account.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="128"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="66"/>
|
||||
<source>Wrong username or password</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="135"/>
|
||||
<source>Error logging in to Netatmo server.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
|||
|
|
@ -4,12 +4,17 @@
|
|||
<context>
|
||||
<name>IntegrationPluginNetatmo</name>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="57"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="47"/>
|
||||
<source>Please enter the login credentials for your Netatmo account.</source>
|
||||
<translation>Bitte geben Sie die Anmeldeinformationen für Ihr Netatmo-Konto ein.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="128"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="66"/>
|
||||
<source>Wrong username or password</source>
|
||||
<translation>Benutzername oder Passwort falsch</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="135"/>
|
||||
<source>Error logging in to Netatmo server.</source>
|
||||
<translation>Fehler beim Anmelden am Netatmo-Server.</translation>
|
||||
</message>
|
||||
|
|
|
|||
|
|
@ -4,12 +4,17 @@
|
|||
<context>
|
||||
<name>IntegrationPluginNetatmo</name>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="57"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="47"/>
|
||||
<source>Please enter the login credentials for your Netatmo account.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="128"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="66"/>
|
||||
<source>Wrong username or password</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="135"/>
|
||||
<source>Error logging in to Netatmo server.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
|||
|
|
@ -4,12 +4,17 @@
|
|||
<context>
|
||||
<name>IntegrationPluginNetatmo</name>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="57"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="47"/>
|
||||
<source>Please enter the login credentials for your Netatmo account.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="128"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="66"/>
|
||||
<source>Wrong username or password</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="135"/>
|
||||
<source>Error logging in to Netatmo server.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
|||
|
|
@ -4,12 +4,17 @@
|
|||
<context>
|
||||
<name>IntegrationPluginNetatmo</name>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="57"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="47"/>
|
||||
<source>Please enter the login credentials for your Netatmo account.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="128"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="66"/>
|
||||
<source>Wrong username or password</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="135"/>
|
||||
<source>Error logging in to Netatmo server.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
|||
|
|
@ -4,12 +4,17 @@
|
|||
<context>
|
||||
<name>IntegrationPluginNetatmo</name>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="57"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="47"/>
|
||||
<source>Please enter the login credentials for your Netatmo account.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="128"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="66"/>
|
||||
<source>Wrong username or password</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="135"/>
|
||||
<source>Error logging in to Netatmo server.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
|||
|
|
@ -4,12 +4,17 @@
|
|||
<context>
|
||||
<name>IntegrationPluginNetatmo</name>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="57"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="47"/>
|
||||
<source>Please enter the login credentials for your Netatmo account.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="128"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="66"/>
|
||||
<source>Wrong username or password</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="135"/>
|
||||
<source>Error logging in to Netatmo server.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
|||
|
|
@ -4,12 +4,17 @@
|
|||
<context>
|
||||
<name>IntegrationPluginNetatmo</name>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="57"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="47"/>
|
||||
<source>Please enter the login credentials for your Netatmo account.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="128"/>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="66"/>
|
||||
<source>Wrong username or password</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../integrationpluginnetatmo.cpp" line="135"/>
|
||||
<source>Error logging in to Netatmo server.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
|||
Loading…
Reference in New Issue