add mqtt client plugin to debian files and rename it
parent
933cd77d6d
commit
0363694c2c
|
|
@ -285,6 +285,22 @@ Description: nymea.io plugin for mailnotification
|
|||
This package will install the nymea.io plugin for mailnotification
|
||||
|
||||
|
||||
Package: nymea-plugin-mqttclient
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
nymea-plugins-translations,
|
||||
Replaces: guh-plugin-mqtt
|
||||
Description: nymea.io plugin for a generic MQTT client
|
||||
The nymea daemon is a plugin based IoT (Internet of Things) server. The
|
||||
server works like a translator for devices, things and services and
|
||||
allows them to interact.
|
||||
With the powerful rule engine you are able to connect any device available
|
||||
in the system and create individual scenes and behaviors for your environment.
|
||||
.
|
||||
This package will install a generic MQTT client plugin for nymea.io
|
||||
|
||||
|
||||
Package: nymea-plugin-netatmo
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends},
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/libnymea_devicepluginmqttclient.so
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
include(../plugins.pri)
|
||||
|
||||
QT += network
|
||||
|
||||
TARGET = $$qtLibraryTarget(nymea_devicepluginmqtt)
|
||||
|
||||
SOURCES += \
|
||||
devicepluginmqtt.cpp
|
||||
|
||||
HEADERS += \
|
||||
devicepluginmqtt.h
|
||||
|
||||
|
||||
|
|
@ -48,22 +48,22 @@
|
|||
|
||||
For more details how to read this JSON file please check out the documentation for \l{The plugin JSON File}.
|
||||
|
||||
\quotefile plugins/deviceplugins/mqtt/devicepluginmqtt.json
|
||||
\quotefile plugins/deviceplugins/mqtt/devicepluginmqttclient.json
|
||||
*/
|
||||
|
||||
#include "devicepluginmqtt.h"
|
||||
#include "devicepluginmqttclient.h"
|
||||
#include "plugin/device.h"
|
||||
#include "plugininfo.h"
|
||||
#include "network/mqtt/mqttprovider.h"
|
||||
|
||||
#include "nymea-mqtt/mqttclient.h"
|
||||
|
||||
DevicePluginMqtt::DevicePluginMqtt()
|
||||
DevicePluginMqttClient::DevicePluginMqttClient()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
DeviceManager::DeviceSetupStatus DevicePluginMqtt::setupDevice(Device *device)
|
||||
DeviceManager::DeviceSetupStatus DevicePluginMqttClient::setupDevice(Device *device)
|
||||
{
|
||||
MqttClient *client = nullptr;
|
||||
if (device->deviceClassId() == internalMqttClientDeviceClassId) {
|
||||
|
|
@ -83,8 +83,8 @@ DeviceManager::DeviceSetupStatus DevicePluginMqtt::setupDevice(Device *device)
|
|||
Q_UNUSED(packetId)
|
||||
emit deviceSetupFinished(device, returnCodes.first() == Mqtt::SubscribeReturnCodeFailure ? DeviceManager::DeviceSetupStatusFailure : DeviceManager::DeviceSetupStatusSuccess);
|
||||
});
|
||||
connect(client, &MqttClient::publishReceived, this, &DevicePluginMqtt::publishReceived);
|
||||
connect(client, &MqttClient::published, this, &DevicePluginMqtt::published);
|
||||
connect(client, &MqttClient::publishReceived, this, &DevicePluginMqttClient::publishReceived);
|
||||
connect(client, &MqttClient::published, this, &DevicePluginMqttClient::published);
|
||||
// In case we're already connected, manually call subscribe now
|
||||
if (client->isConnected()) {
|
||||
subscribe(device);
|
||||
|
|
@ -94,7 +94,7 @@ DeviceManager::DeviceSetupStatus DevicePluginMqtt::setupDevice(Device *device)
|
|||
}
|
||||
|
||||
|
||||
DeviceManager::DeviceError DevicePluginMqtt::executeAction(Device *device, const Action &action)
|
||||
DeviceManager::DeviceError DevicePluginMqttClient::executeAction(Device *device, const Action &action)
|
||||
{
|
||||
ParamTypeId topicParamTypeId = internalMqttClientTriggerActionTopicParamTypeId;
|
||||
ParamTypeId payloadParamTypeId = internalMqttClientTriggerActionDataParamTypeId;
|
||||
|
|
@ -134,7 +134,7 @@ DeviceManager::DeviceError DevicePluginMqtt::executeAction(Device *device, const
|
|||
return DeviceManager::DeviceErrorAsync;
|
||||
}
|
||||
|
||||
void DevicePluginMqtt::subscribe(Device *device)
|
||||
void DevicePluginMqttClient::subscribe(Device *device)
|
||||
{
|
||||
MqttClient *client = m_clients.value(device);
|
||||
if (!client) {
|
||||
|
|
@ -148,7 +148,7 @@ void DevicePluginMqtt::subscribe(Device *device)
|
|||
}
|
||||
}
|
||||
|
||||
void DevicePluginMqtt::publishReceived(const QString &topic, const QByteArray &payload, bool retained)
|
||||
void DevicePluginMqttClient::publishReceived(const QString &topic, const QByteArray &payload, bool retained)
|
||||
{
|
||||
qCDebug(dcMqttclient()) << "Publish received" << topic << payload << retained;
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ void DevicePluginMqtt::publishReceived(const QString &topic, const QByteArray &p
|
|||
emitEvent(Event(eventTypeId, device->id(), ParamList() << Param(topicParamTypeId, topic) << Param(payloadParamTypeId, payload)));
|
||||
}
|
||||
|
||||
void DevicePluginMqtt::published(quint16 packetId)
|
||||
void DevicePluginMqttClient::published(quint16 packetId)
|
||||
{
|
||||
if (!m_pendingPublishes.contains(packetId)) {
|
||||
return;
|
||||
|
|
@ -180,7 +180,7 @@ void DevicePluginMqtt::published(quint16 packetId)
|
|||
emit actionExecutionFinished(m_pendingPublishes.take(packetId).id(), DeviceManager::DeviceErrorNoError);
|
||||
}
|
||||
|
||||
void DevicePluginMqtt::deviceRemoved(Device *device)
|
||||
void DevicePluginMqttClient::deviceRemoved(Device *device)
|
||||
{
|
||||
qCDebug(dcMqttclient) << device;
|
||||
m_clients.take(device)->deleteLater();
|
||||
|
|
@ -20,8 +20,8 @@
|
|||
* *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef DEVICEPLUGINMQTT_H
|
||||
#define DEVICEPLUGINMQTT_H
|
||||
#ifndef DEVICEPLUGINMQTTCLIENT_H
|
||||
#define DEVICEPLUGINMQTTCLIENT_H
|
||||
|
||||
#include "plugin/deviceplugin.h"
|
||||
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
|
||||
class MqttClient;
|
||||
|
||||
class DevicePluginMqtt: public DevicePlugin
|
||||
class DevicePluginMqttClient: public DevicePlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "io.nymea.DevicePlugin" FILE "devicepluginmqtt.json")
|
||||
Q_PLUGIN_METADATA(IID "io.nymea.DevicePlugin" FILE "devicepluginmqttclient.json")
|
||||
Q_INTERFACES(DevicePlugin)
|
||||
|
||||
public:
|
||||
explicit DevicePluginMqtt();
|
||||
explicit DevicePluginMqttClient();
|
||||
|
||||
DeviceManager::DeviceSetupStatus setupDevice(Device *device) override;
|
||||
void deviceRemoved(Device *device) override;
|
||||
|
|
@ -58,4 +58,4 @@ private:
|
|||
QHash<quint16, Action> m_pendingPublishes;
|
||||
};
|
||||
|
||||
#endif // DEVICEPLUGINMQTT_H
|
||||
#endif // DEVICEPLUGINMQTTCLIENT_H
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
include(../plugins.pri)
|
||||
|
||||
QT += network
|
||||
|
||||
TARGET = $$qtLibraryTarget(nymea_devicepluginmqttclient)
|
||||
|
||||
SOURCES += \
|
||||
devicepluginmqttclient.cpp
|
||||
|
||||
HEADERS += \
|
||||
devicepluginmqttclient.h
|
||||
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ PLUGIN_DIRS = \
|
|||
leynew \
|
||||
lgsmarttv \
|
||||
mailnotification \
|
||||
mqtt \
|
||||
mqttclient \
|
||||
netatmo \
|
||||
networkdetector \
|
||||
openweathermap \
|
||||
|
|
|
|||
Loading…
Reference in New Issue