diff --git a/debian/control b/debian/control index a9c3eca0..0e89335b 100644 --- a/debian/control +++ b/debian/control @@ -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 diff --git a/debian/nymea-plugin-keba.install.in b/debian/nymea-plugin-keba.install.in new file mode 100644 index 00000000..050c7a82 --- /dev/null +++ b/debian/nymea-plugin-keba.install.in @@ -0,0 +1 @@ +usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/libnymea_devicepluginkeba.so diff --git a/keba/devicepluginkeba.cpp b/keba/devicepluginkeba.cpp index 6cf2824e..30f54ba8 100644 --- a/keba/devicepluginkeba.cpp +++ b/keba/devicepluginkeba.cpp @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright (C) 2016 Simon Stuerz * + * Copyright (C) 2016-2018 Simon Stuerz * * Copyright (C) 2016 Christian Stachowitz * * * * This file is part of nymea. * @@ -28,7 +28,6 @@ #include "plugininfo.h" #include - 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); } diff --git a/keba/devicepluginkeba.h b/keba/devicepluginkeba.h index d58442a6..d95076b8 100644 --- a/keba/devicepluginkeba.h +++ b/keba/devicepluginkeba.h @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright (C) 2016 Simon Stuerz * + * Copyright (C) 2016-2018 Simon Stuerz * * Copyright (C) 2016 Christian Stachowitz * * * * This file is part of nymea. * diff --git a/keba/keba.pro b/keba/keba.pro index edac80c1..31f1c777 100644 --- a/keba/keba.pro +++ b/keba/keba.pro @@ -1,3 +1,5 @@ +TRANSLATIONS += translations/9142b09f-30a9-43d0-9ede-2f8debe075ac-en_US.ts + include(../plugins.pri) TARGET = $$qtLibraryTarget(nymea_devicepluginkeba) diff --git a/keba/translations/9142b09f-30a9-43d0-9ede-2f8debe075ac-en_US.ts b/keba/translations/9142b09f-30a9-43d0-9ede-2f8debe075ac-en_US.ts new file mode 100644 index 00000000..5907f0d5 --- /dev/null +++ b/keba/translations/9142b09f-30a9-43d0-9ede-2f8debe075ac-en_US.ts @@ -0,0 +1,127 @@ + + + + + KebaKeContact + + + KebaKeContact + The name of the plugin KebaKeContact (9142b09f-30a9-43d0-9ede-2f8debe075ac) + + + + + Keba + The name of the vendor (f7cda40b-829a-4675-abaa-485697430f5f) + + + + + Keba KeContact P30 + The name of the DeviceClass (900dacec-cae7-4a37-95ba-501846368ea2) + + + + + IP Address + The name of the paramType (730cd3d3-5f0e-4028-a8c2-ced7574f13f3) of wallbox + + + + + Activity changed + The name of the autocreated EventType (539e5602-6dd9-465d-9705-3bb59bcf8982) + + + + + activity + The name of the ParamType of StateType (539e5602-6dd9-465d-9705-3bb59bcf8982) of DeviceClass wallbox + + + + + Plug State changed + The name of the autocreated EventType (3b4d29f3-3101-47ad-90fd-269b6348783b) + + + + + plugState + The name of the ParamType of StateType (3b4d29f3-3101-47ad-90fd-269b6348783b) of DeviceClass wallbox + + + + + Current changed + The name of the autocreated EventType (a29c1748-fe97-4830-a56e-e1cc4e618385) + + + + + current + The name of the ParamType of StateType (a29c1748-fe97-4830-a56e-e1cc4e618385) of DeviceClass wallbox + + + + + Maximal Current changed + The name of the autocreated EventType (593656f0-babf-4308-8767-68f34e10fb15) + + + + + maxCurrent + The name of the ParamType of StateType (593656f0-babf-4308-8767-68f34e10fb15) of DeviceClass wallbox + + + + + Set maximal current + The name of the autocreated ActionType (593656f0-babf-4308-8767-68f34e10fb15) + + + + + Power changed + The name of the autocreated EventType (e8f069ca-7fa7-4568-8d4c-165f6d048720) + + + + + power + The name of the ParamType of StateType (e8f069ca-7fa7-4568-8d4c-165f6d048720) of DeviceClass wallbox + + + + + Output Enable changed + The name of the autocreated EventType (0cd5396a-bc41-4c8f-b037-db10991a76c7) + + + + + outEnable + The name of the ParamType of StateType (0cd5396a-bc41-4c8f-b037-db10991a76c7) of DeviceClass wallbox + + + + + Set Output + The name of the autocreated ActionType (0cd5396a-bc41-4c8f-b037-db10991a76c7) + + + + + Device Reachable changed + The name of the autocreated EventType (b1a574a6-46b6-44ea-a0bb-9b4de3198967) + + + + + reachable + The name of the ParamType of StateType (b1a574a6-46b6-44ea-a0bb-9b4de3198967) of DeviceClass wallbox + + + + diff --git a/plugins.pri b/plugins.pri index 2b778831..fb3c1ced 100644 --- a/plugins.pri +++ b/plugins.pri @@ -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