fixed nanoleaf pairing and thing setup
This commit is contained in:
parent
83becea2e8
commit
2efa44de64
@ -91,8 +91,14 @@ void IntegrationPluginNanoleaf::confirmPairing(ThingPairingInfo *info, const QSt
|
|||||||
{
|
{
|
||||||
Q_UNUSED(username)
|
Q_UNUSED(username)
|
||||||
Q_UNUSED(secret)
|
Q_UNUSED(secret)
|
||||||
QHostAddress address = getHostAddress(info->params().paramValue(lightPanelsThingSerialNoParamTypeId).toString());
|
QString serialNumber = info->params().paramValue(lightPanelsThingSerialNoParamTypeId).toString();
|
||||||
uint port = getPort(info->params().paramValue(lightPanelsThingSerialNoParamTypeId).toString());
|
QHostAddress address = getHostAddress(serialNumber);
|
||||||
|
if (address.isNull()) {
|
||||||
|
qCWarning(dcNanoleaf()) << "Could not find any device with serial number" << serialNumber;
|
||||||
|
return info->finish(Thing::ThingErrorHardwareNotAvailable, QT_TR_NOOP("Cloud not find device."));
|
||||||
|
}
|
||||||
|
uint port = getPort(serialNumber);
|
||||||
|
qCDebug(dcNanoleaf()) << "ConfirmPairing: Creating Nanoleaf connection with address" << address << "and port" << port;
|
||||||
Nanoleaf *nanoleaf = createNanoleafConnection(address, port);
|
Nanoleaf *nanoleaf = createNanoleafConnection(address, port);
|
||||||
nanoleaf->addUser(); //push button pairing
|
nanoleaf->addUser(); //push button pairing
|
||||||
m_unfinishedNanoleafConnections.insert(info->thingId(), nanoleaf);
|
m_unfinishedNanoleafConnections.insert(info->thingId(), nanoleaf);
|
||||||
@ -124,8 +130,14 @@ void IntegrationPluginNanoleaf::setupThing(ThingSetupInfo *info)
|
|||||||
return info->finish(Thing::ThingErrorNoError);
|
return info->finish(Thing::ThingErrorNoError);
|
||||||
} else {
|
} else {
|
||||||
// This setupDevice is called after a (re)start, with an already added thing
|
// This setupDevice is called after a (re)start, with an already added thing
|
||||||
QHostAddress address = getHostAddress(thing->paramValue(lightPanelsThingSerialNoParamTypeId).toString());
|
QString serialNumber = thing->paramValue(lightPanelsThingSerialNoParamTypeId).toString();
|
||||||
int port = getPort(thing->paramValue(lightPanelsThingSerialNoParamTypeId).toString());
|
QHostAddress address = getHostAddress(serialNumber);
|
||||||
|
if (address.isNull()) {
|
||||||
|
qCWarning(dcNanoleaf()) << "Could not find any device with serial number" << serialNumber;
|
||||||
|
return info->finish(Thing::ThingErrorHardwareNotAvailable, QT_TR_NOOP("Cloud not find device."));
|
||||||
|
}
|
||||||
|
int port = getPort(serialNumber);
|
||||||
|
qCDebug(dcNanoleaf()) << "SetupThing: Creating Nanoleaf connection with address" << address << "and port" << port;
|
||||||
nanoleaf = createNanoleafConnection(address, port);
|
nanoleaf = createNanoleafConnection(address, port);
|
||||||
nanoleaf->setAuthToken(token);
|
nanoleaf->setAuthToken(token);
|
||||||
nanoleaf->getControllerInfo(); //This is just to check if the thing is available
|
nanoleaf->getControllerInfo(); //This is just to check if the thing is available
|
||||||
@ -263,13 +275,8 @@ QHostAddress IntegrationPluginNanoleaf::getHostAddress(const QString &serialNumb
|
|||||||
{
|
{
|
||||||
ZeroConfServiceEntry entry;
|
ZeroConfServiceEntry entry;
|
||||||
foreach (const ZeroConfServiceEntry &e, m_zeroconfBrowser->serviceEntries()) {
|
foreach (const ZeroConfServiceEntry &e, m_zeroconfBrowser->serviceEntries()) {
|
||||||
QString entrySerialNo;
|
QString entrySerialNo = e.txt("id");
|
||||||
foreach (QString value, entry.txt()) {
|
|
||||||
if (value.contains("id=")) {
|
|
||||||
entrySerialNo = value.split("=").last();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (serialNumber == entrySerialNo) {
|
if (serialNumber == entrySerialNo) {
|
||||||
entry = e;
|
entry = e;
|
||||||
break;
|
break;
|
||||||
@ -282,13 +289,7 @@ uint IntegrationPluginNanoleaf::getPort(const QString &serialNumber)
|
|||||||
{
|
{
|
||||||
ZeroConfServiceEntry entry;
|
ZeroConfServiceEntry entry;
|
||||||
foreach (const ZeroConfServiceEntry &e, m_zeroconfBrowser->serviceEntries()) {
|
foreach (const ZeroConfServiceEntry &e, m_zeroconfBrowser->serviceEntries()) {
|
||||||
QString entrySerialNo;
|
QString entrySerialNo = e.txt("id");
|
||||||
foreach (QString value, entry.txt()) {
|
|
||||||
if (value.contains("id=")) {
|
|
||||||
entrySerialNo = value.split("=").last();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (serialNumber == entrySerialNo) {
|
if (serialNumber == entrySerialNo) {
|
||||||
entry = e;
|
entry = e;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -4,22 +4,28 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>IntegrationPluginNanoleaf</name>
|
<name>IntegrationPluginNanoleaf</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../integrationpluginnanoleaf.cpp" line="96"/>
|
<location filename="../integrationpluginnanoleaf.cpp" line="87"/>
|
||||||
<source>On the Nanoleaf controller, hold the on-off button for 5-7 seconds until the LED starts flashing.</source>
|
<source>On the Nanoleaf controller, hold the on-off button for 5-7 seconds until the LED starts flashing.</source>
|
||||||
<translation>Halten Sie auf dem Nanoleaf-Controller die Ein- / Aus-Taste 5-7 Sekunden lang gedrückt, bis die LED zu blinken beginnt.</translation>
|
<translation>Halten Sie auf dem Nanoleaf-Controller die Ein- / Aus-Taste 5-7 Sekunden lang gedrückt, bis die LED zu blinken beginnt.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../integrationpluginnanoleaf.cpp" line="421"/>
|
<location filename="../integrationpluginnanoleaf.cpp" line="98"/>
|
||||||
|
<location filename="../integrationpluginnanoleaf.cpp" line="137"/>
|
||||||
|
<source>Cloud not find device.</source>
|
||||||
|
<translation>Das Gerät konnte nicht gefunden werden.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../integrationpluginnanoleaf.cpp" line="413"/>
|
||||||
<source>Color temperature</source>
|
<source>Color temperature</source>
|
||||||
<translation>Farbtemperatur</translation>
|
<translation>Farbtemperatur</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../integrationpluginnanoleaf.cpp" line="424"/>
|
<location filename="../integrationpluginnanoleaf.cpp" line="416"/>
|
||||||
<source>Hue/Saturation</source>
|
<source>Hue/Saturation</source>
|
||||||
<translation>Farbton / Sättigung</translation>
|
<translation>Farbton / Sättigung</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../integrationpluginnanoleaf.cpp" line="427"/>
|
<location filename="../integrationpluginnanoleaf.cpp" line="419"/>
|
||||||
<source>Effect</source>
|
<source>Effect</source>
|
||||||
<translation>Effekt</translation>
|
<translation>Effekt</translation>
|
||||||
</message>
|
</message>
|
||||||
|
|||||||
@ -4,22 +4,28 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>IntegrationPluginNanoleaf</name>
|
<name>IntegrationPluginNanoleaf</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../integrationpluginnanoleaf.cpp" line="96"/>
|
<location filename="../integrationpluginnanoleaf.cpp" line="87"/>
|
||||||
<source>On the Nanoleaf controller, hold the on-off button for 5-7 seconds until the LED starts flashing.</source>
|
<source>On the Nanoleaf controller, hold the on-off button for 5-7 seconds until the LED starts flashing.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../integrationpluginnanoleaf.cpp" line="421"/>
|
<location filename="../integrationpluginnanoleaf.cpp" line="98"/>
|
||||||
|
<location filename="../integrationpluginnanoleaf.cpp" line="137"/>
|
||||||
|
<source>Cloud not find device.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../integrationpluginnanoleaf.cpp" line="413"/>
|
||||||
<source>Color temperature</source>
|
<source>Color temperature</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../integrationpluginnanoleaf.cpp" line="424"/>
|
<location filename="../integrationpluginnanoleaf.cpp" line="416"/>
|
||||||
<source>Hue/Saturation</source>
|
<source>Hue/Saturation</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../integrationpluginnanoleaf.cpp" line="427"/>
|
<location filename="../integrationpluginnanoleaf.cpp" line="419"/>
|
||||||
<source>Effect</source>
|
<source>Effect</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user