tasmota: Add Qt6 support

This commit is contained in:
Simon Stürz 2025-08-08 16:40:54 +02:00
parent 51ccbc0ca4
commit 5d06bdbac1
3 changed files with 12 additions and 14 deletions

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright 2013 - 2020, nymea GmbH
* Copyright 2013 - 2025, nymea GmbH
* Contact: contact@nymea.io
*
* This file is part of nymea.
@ -35,11 +35,12 @@
#include <QNetworkReply>
#include <QHostAddress>
#include <QJsonDocument>
#include <QRegularExpression>
#include "hardwaremanager.h"
#include "network/networkaccessmanager.h"
#include "network/mqtt/mqttprovider.h"
#include "network/mqtt/mqttchannel.h"
#include <hardwaremanager.h>
#include <network/networkaccessmanager.h>
#include <network/mqtt/mqttprovider.h>
#include <network/mqtt/mqttchannel.h>
static QHash<QString, StateTypeId> sonoff_basicPowerStateTypeIds = {
{"POWER", sonoff_basicPowerStateTypeId}, // On single channel devices, sometimes there's no index
@ -124,7 +125,7 @@ void IntegrationPluginTasmota::setupThing(ThingSetupInfo *info)
//: Error setting up thing
return info->finish(Thing::ThingErrorInvalidParameter, QT_TR_NOOP("The given IP address is not valid."));
}
MqttChannel *channel = hardwareManager()->mqttProvider()->createChannel(thing->id().toString().remove(QRegExp("[{}-]")), deviceAddress);
MqttChannel *channel = hardwareManager()->mqttProvider()->createChannel(thing->id().toString().remove(QRegularExpression("[{}-]")), deviceAddress);
if (!channel) {
qCWarning(dcTasmota) << "Failed to create MQTT channel.";
//: Error setting up thing

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright 2013 - 2020, nymea GmbH
* Copyright 2013 - 2025, nymea GmbH
* Contact: contact@nymea.io
*
* This file is part of nymea.
@ -31,7 +31,7 @@
#ifndef INTEGRATIONPLUGINTASMOTA_H
#define INTEGRATIONPLUGINTASMOTA_H
#include "integrations/integrationplugin.h"
#include <integrations/integrationplugin.h>
#include "extern-plugininfo.h"
@ -44,7 +44,6 @@ class IntegrationPluginTasmota: public IntegrationPlugin
Q_PLUGIN_METADATA(IID "io.nymea.IntegrationPlugin" FILE "integrationplugintasmota.json")
Q_INTERFACES(IntegrationPlugin)
public:
explicit IntegrationPluginTasmota();
~IntegrationPluginTasmota();
@ -60,7 +59,7 @@ private slots:
void onPublishReceived(MqttChannel *channel, const QString &topic, const QByteArray &payload);
private:
QHash<Thing*, MqttChannel*> m_mqttChannels;
QHash<Thing *, MqttChannel *> m_mqttChannels;
// Helpers for parent devices (the ones starting with sonoff)
QHash<ThingClassId, ParamTypeId> m_ipAddressParamTypeMap;

View File

@ -4,10 +4,8 @@ QT += network
PKGCONFIG += nymea-mqtt
TARGET = $$qtLibraryTarget(nymea_integrationplugintasmota)
SOURCES += \
integrationplugintasmota.cpp \
integrationplugintasmota.cpp
HEADERS += \
integrationplugintasmota.h \
integrationplugintasmota.h