tasmota: Add Qt6 support
This commit is contained in:
parent
51ccbc0ca4
commit
5d06bdbac1
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -35,11 +35,12 @@
|
|||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
#include "hardwaremanager.h"
|
#include <hardwaremanager.h>
|
||||||
#include "network/networkaccessmanager.h"
|
#include <network/networkaccessmanager.h>
|
||||||
#include "network/mqtt/mqttprovider.h"
|
#include <network/mqtt/mqttprovider.h>
|
||||||
#include "network/mqtt/mqttchannel.h"
|
#include <network/mqtt/mqttchannel.h>
|
||||||
|
|
||||||
static QHash<QString, StateTypeId> sonoff_basicPowerStateTypeIds = {
|
static QHash<QString, StateTypeId> sonoff_basicPowerStateTypeIds = {
|
||||||
{"POWER", sonoff_basicPowerStateTypeId}, // On single channel devices, sometimes there's no index
|
{"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
|
//: Error setting up thing
|
||||||
return info->finish(Thing::ThingErrorInvalidParameter, QT_TR_NOOP("The given IP address is not valid."));
|
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) {
|
if (!channel) {
|
||||||
qCWarning(dcTasmota) << "Failed to create MQTT channel.";
|
qCWarning(dcTasmota) << "Failed to create MQTT channel.";
|
||||||
//: Error setting up thing
|
//: Error setting up thing
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -31,7 +31,7 @@
|
|||||||
#ifndef INTEGRATIONPLUGINTASMOTA_H
|
#ifndef INTEGRATIONPLUGINTASMOTA_H
|
||||||
#define INTEGRATIONPLUGINTASMOTA_H
|
#define INTEGRATIONPLUGINTASMOTA_H
|
||||||
|
|
||||||
#include "integrations/integrationplugin.h"
|
#include <integrations/integrationplugin.h>
|
||||||
|
|
||||||
#include "extern-plugininfo.h"
|
#include "extern-plugininfo.h"
|
||||||
|
|
||||||
@ -44,7 +44,6 @@ class IntegrationPluginTasmota: public IntegrationPlugin
|
|||||||
Q_PLUGIN_METADATA(IID "io.nymea.IntegrationPlugin" FILE "integrationplugintasmota.json")
|
Q_PLUGIN_METADATA(IID "io.nymea.IntegrationPlugin" FILE "integrationplugintasmota.json")
|
||||||
Q_INTERFACES(IntegrationPlugin)
|
Q_INTERFACES(IntegrationPlugin)
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IntegrationPluginTasmota();
|
explicit IntegrationPluginTasmota();
|
||||||
~IntegrationPluginTasmota();
|
~IntegrationPluginTasmota();
|
||||||
@ -60,7 +59,7 @@ private slots:
|
|||||||
void onPublishReceived(MqttChannel *channel, const QString &topic, const QByteArray &payload);
|
void onPublishReceived(MqttChannel *channel, const QString &topic, const QByteArray &payload);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHash<Thing*, MqttChannel*> m_mqttChannels;
|
QHash<Thing *, MqttChannel *> m_mqttChannels;
|
||||||
|
|
||||||
// Helpers for parent devices (the ones starting with sonoff)
|
// Helpers for parent devices (the ones starting with sonoff)
|
||||||
QHash<ThingClassId, ParamTypeId> m_ipAddressParamTypeMap;
|
QHash<ThingClassId, ParamTypeId> m_ipAddressParamTypeMap;
|
||||||
|
|||||||
@ -4,10 +4,8 @@ QT += network
|
|||||||
|
|
||||||
PKGCONFIG += nymea-mqtt
|
PKGCONFIG += nymea-mqtt
|
||||||
|
|
||||||
TARGET = $$qtLibraryTarget(nymea_integrationplugintasmota)
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
integrationplugintasmota.cpp \
|
integrationplugintasmota.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
integrationplugintasmota.h \
|
integrationplugintasmota.h
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user