shelly: Add Qt6 support

This commit is contained in:
Simon Stürz 2025-08-08 16:18:05 +02:00
parent 4f728d2595
commit d387be5c11
3 changed files with 2 additions and 4 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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");