shelly: Add Qt6 support
This commit is contained in:
parent
4f728d2595
commit
d387be5c11
@ -2127,8 +2127,7 @@ bool IntegrationPluginShelly::isGen2Plus(const QString &shellyId) const
|
|||||||
return shellyId.contains("Plus", Qt::CaseInsensitive)
|
return shellyId.contains("Plus", Qt::CaseInsensitive)
|
||||||
|| shellyId.contains("Pro", Qt::CaseInsensitive)
|
|| shellyId.contains("Pro", Qt::CaseInsensitive)
|
||||||
|| shellyId.contains("G3", Qt::CaseInsensitive) // Gen3 devices have API 2
|
|| shellyId.contains("G3", Qt::CaseInsensitive) // Gen3 devices have API 2
|
||||||
|| QRegExp("^(ShellyPlusPlugS|ShellyPlug(US|IT|UK))-[0-9A-Z]+$", Qt::CaseInsensitive).exactMatch(shellyId) // Plus plug variants need to be matched quite precisely to not also match the v1 Plug
|
|| QRegularExpression("^(ShellyPlusPlugS|ShellyPlug(US|IT|UK))-[0-9A-Z]+$", QRegularExpression::CaseInsensitiveOption).match(shellyId).hasMatch(); // Plus plug variants need to be matched quite precisely to not also match the v1 Plug
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntegrationPluginShelly::handleInputEvent(Thing *thing, const QString &buttonName, const QString &inputEventString, int inputEventCount)
|
void IntegrationPluginShelly::handleInputEvent(Thing *thing, const QString &buttonName, const QString &inputEventString, int inputEventCount)
|
||||||
|
|||||||
@ -52,7 +52,6 @@ class IntegrationPluginShelly: public IntegrationPlugin
|
|||||||
Q_PLUGIN_METADATA(IID "io.nymea.IntegrationPlugin" FILE "integrationpluginshelly.json")
|
Q_PLUGIN_METADATA(IID "io.nymea.IntegrationPlugin" FILE "integrationpluginshelly.json")
|
||||||
Q_INTERFACES(IntegrationPlugin)
|
Q_INTERFACES(IntegrationPlugin)
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IntegrationPluginShelly();
|
explicit IntegrationPluginShelly();
|
||||||
~IntegrationPluginShelly() override;
|
~IntegrationPluginShelly() override;
|
||||||
|
|||||||
@ -132,7 +132,7 @@ void ShellyJsonRpcClient::onTextMessageReceived(const QString &message)
|
|||||||
|
|
||||||
QVariantMap ShellyJsonRpcClient::createAuthMap() const
|
QVariantMap ShellyJsonRpcClient::createAuthMap() const
|
||||||
{
|
{
|
||||||
int cnonce = qrand();
|
int cnonce = std::rand();
|
||||||
QByteArray ha1 = QString("%1:%2:%3").arg(m_user).arg(m_shellyId.toLower()).arg(m_password).toUtf8();
|
QByteArray ha1 = QString("%1:%2:%3").arg(m_user).arg(m_shellyId.toLower()).arg(m_password).toUtf8();
|
||||||
ha1 = QCryptographicHash::hash(ha1, QCryptographicHash::Sha256).toHex();
|
ha1 = QCryptographicHash::hash(ha1, QCryptographicHash::Sha256).toHex();
|
||||||
QByteArray ha2 = QByteArrayLiteral("dummy_method:dummy_uri");
|
QByteArray ha2 = QByteArrayLiteral("dummy_method:dummy_uri");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user