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