Add debian package of keba plugin and add translations

master
Simon Stürz 2018-03-12 18:33:42 +01:00 committed by Michael Zanetti
parent 2904f3a782
commit 42d593c06e
7 changed files with 159 additions and 13 deletions

15
debian/control vendored
View File

@ -527,6 +527,21 @@ Description: nymea.io plugin for snapd
This package will install the nymea.io plugin for snapd
Package: nymea-plugin-keba
Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
nymea-plugins-translations,
Replaces: guh-plugin-keba
Description: nymea.io plugin for keba
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 the nymea.io plugin for keba
Package: nymea-plugins-translations

1
debian/nymea-plugin-keba.install.in vendored Normal file
View File

@ -0,0 +1 @@
usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/libnymea_devicepluginkeba.so

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright (C) 2016 Simon Stuerz <simon.stuerz@guh.io> *
* Copyright (C) 2016-2018 Simon Stuerz <simon.stuerz@guh.io> *
* Copyright (C) 2016 Christian Stachowitz *
* *
* This file is part of nymea. *
@ -28,7 +28,6 @@
#include "plugininfo.h"
#include <QUdpSocket>
DevicePluginKeba::DevicePluginKeba()
{
@ -49,21 +48,22 @@ DeviceManager::DeviceSetupStatus DevicePluginKeba::setupDevice(Device *device)
{
qCDebug(dcKebaKeContact()) << "Setting up a new device:" << device->name() << device->params();
if(m_kebaDevices.isEmpty())
{
if(m_kebaDevices.isEmpty()) {
m_kebaSocket = new QUdpSocket(this);
if (!m_kebaSocket->bind(QHostAddress::AnyIPv4,7090)) {
qCWarning(dcKebaKeContact()) << "can't bind to port";
if (!m_kebaSocket->bind(QHostAddress::AnyIPv4, 7090)) {
qCWarning(dcKebaKeContact()) << "Cannot bind to port" << 7090;
delete m_kebaSocket;
return DeviceManager::DeviceSetupStatusFailure;
}
connect(m_kebaSocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()));
qCDebug(dcKebaKeContact()) << "create keba socket";
qCDebug(dcKebaKeContact()) << "Create keba socket";
}
QHostAddress address = QHostAddress(device->paramValue(wallboxIpParamTypeId).toString());
//Check if the IP is empty
if(address.isNull()){
if (address.isNull()) {
delete m_kebaSocket;
return DeviceManager::DeviceSetupStatusFailure;
}
@ -81,7 +81,7 @@ void DevicePluginKeba::postSetupDevice(Device *device)
qCDebug(dcKebaKeContact()) << "Post setup" << device->name();
QByteArray datagram;
datagram.append("report 2");
m_kebaSocket->writeDatagram(datagram.data(),datagram.size(), QHostAddress(device->paramValue(wallboxIpParamTypeId).toString()) , 7090);
m_kebaSocket->writeDatagram(datagram.data(), datagram.size(), QHostAddress(device->paramValue(wallboxIpParamTypeId).toString()), 7090);
}
void DevicePluginKeba::deviceRemoved(Device *device)
@ -120,10 +120,10 @@ DeviceManager::DeviceError DevicePluginKeba::executeAction(Device *device, const
if(action.actionTypeId() == wallboxMaxCurrentActionTypeId){
// Print information that we are executing now the update action
qCDebug(dcKebaKeContact()) << "update max current to : " << action.param(wallboxMaxCurrentStateParamTypeId).value().toString();
qCDebug(dcKebaKeContact()) << "Update max current to : " << action.param(wallboxMaxCurrentStateParamTypeId).value().toString();
QByteArray datagram;
datagram.append("curr " + QVariant(action.param(wallboxMaxCurrentStateParamTypeId).value().toInt()*1000).toString());
qCDebug(dcKebaKeContact()) << "datagram : " << datagram;
qCDebug(dcKebaKeContact()) << "Datagram : " << datagram;
m_kebaSocket->writeDatagram(datagram.data(),datagram.size(), QHostAddress(device->paramValue(wallboxIpParamTypeId).toString()) , 7090);
}
else if(action.actionTypeId() == wallboxOutEnableActionTypeId){
@ -136,7 +136,7 @@ DeviceManager::DeviceError DevicePluginKeba::executeAction(Device *device, const
else{
datagram.append("ena 0");
}
qCDebug(dcKebaKeContact()) << "datagram : " << datagram;
qCDebug(dcKebaKeContact()) << "Datagram : " << datagram;
m_kebaSocket->writeDatagram(datagram.data(),datagram.size(), QHostAddress(device->paramValue(wallboxIpParamTypeId).toString()) , 7090);
}

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright (C) 2016 Simon Stuerz <simon.stuerz@guh.io> *
* Copyright (C) 2016-2018 Simon Stuerz <simon.stuerz@guh.io> *
* Copyright (C) 2016 Christian Stachowitz *
* *
* This file is part of nymea. *

View File

@ -1,3 +1,5 @@
TRANSLATIONS += translations/9142b09f-30a9-43d0-9ede-2f8debe075ac-en_US.ts
include(../plugins.pri)
TARGET = $$qtLibraryTarget(nymea_devicepluginkeba)

View File

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>KebaKeContact</name>
<message>
<location filename="../plugininfo.h" line="51"/>
<source>KebaKeContact</source>
<extracomment>The name of the plugin KebaKeContact (9142b09f-30a9-43d0-9ede-2f8debe075ac)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="54"/>
<source>Keba</source>
<extracomment>The name of the vendor (f7cda40b-829a-4675-abaa-485697430f5f)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="57"/>
<source>Keba KeContact P30</source>
<extracomment>The name of the DeviceClass (900dacec-cae7-4a37-95ba-501846368ea2)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="60"/>
<source>IP Address</source>
<extracomment>The name of the paramType (730cd3d3-5f0e-4028-a8c2-ced7574f13f3) of wallbox</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="63"/>
<source>Activity changed</source>
<extracomment>The name of the autocreated EventType (539e5602-6dd9-465d-9705-3bb59bcf8982)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="66"/>
<source>activity</source>
<extracomment>The name of the ParamType of StateType (539e5602-6dd9-465d-9705-3bb59bcf8982) of DeviceClass wallbox</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="69"/>
<source>Plug State changed</source>
<extracomment>The name of the autocreated EventType (3b4d29f3-3101-47ad-90fd-269b6348783b)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="72"/>
<source>plugState</source>
<extracomment>The name of the ParamType of StateType (3b4d29f3-3101-47ad-90fd-269b6348783b) of DeviceClass wallbox</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="75"/>
<source>Current changed</source>
<extracomment>The name of the autocreated EventType (a29c1748-fe97-4830-a56e-e1cc4e618385)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="78"/>
<source>current</source>
<extracomment>The name of the ParamType of StateType (a29c1748-fe97-4830-a56e-e1cc4e618385) of DeviceClass wallbox</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="81"/>
<source>Maximal Current changed</source>
<extracomment>The name of the autocreated EventType (593656f0-babf-4308-8767-68f34e10fb15)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="84"/>
<source>maxCurrent</source>
<extracomment>The name of the ParamType of StateType (593656f0-babf-4308-8767-68f34e10fb15) of DeviceClass wallbox</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="87"/>
<source>Set maximal current</source>
<extracomment>The name of the autocreated ActionType (593656f0-babf-4308-8767-68f34e10fb15)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="90"/>
<source>Power changed</source>
<extracomment>The name of the autocreated EventType (e8f069ca-7fa7-4568-8d4c-165f6d048720)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="93"/>
<source>power</source>
<extracomment>The name of the ParamType of StateType (e8f069ca-7fa7-4568-8d4c-165f6d048720) of DeviceClass wallbox</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="96"/>
<source>Output Enable changed</source>
<extracomment>The name of the autocreated EventType (0cd5396a-bc41-4c8f-b037-db10991a76c7)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="99"/>
<source>outEnable</source>
<extracomment>The name of the ParamType of StateType (0cd5396a-bc41-4c8f-b037-db10991a76c7) of DeviceClass wallbox</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="102"/>
<source>Set Output</source>
<extracomment>The name of the autocreated ActionType (0cd5396a-bc41-4c8f-b037-db10991a76c7)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="105"/>
<source>Device Reachable changed</source>
<extracomment>The name of the autocreated EventType (b1a574a6-46b6-44ea-a0bb-9b4de3198967)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../plugininfo.h" line="108"/>
<source>reachable</source>
<extracomment>The name of the ParamType of StateType (b1a574a6-46b6-44ea-a0bb-9b4de3198967) of DeviceClass wallbox</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -37,6 +37,7 @@ QMAKE_EXTRA_TARGETS += lupdate
translations.path = /usr/share/nymea/translations
translations.files = $$[QT_SOURCE_TREE]/translations/*.qm
TRANSLATIONS += $$files($$[QT_SOURCE_TREE]/translations/*.ts, true)
# Install plugin
target.path = $$PLUGIN_PATH