diff --git a/debian/control b/debian/control index c88e8e0c..83d56289 100644 --- a/debian/control +++ b/debian/control @@ -591,6 +591,21 @@ Description: nymea.io plugin for Pushbullet This package will install the nymea.io plugin for sending messages via Pushbullet. +Package: nymea-plugin-solarlog +Architecture: any +Depends: ${shlibs:Depends}, + ${misc:Depends}, + nymea-plugins-translations, +Description: nymea.io plugin for Solar-Log + 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 Solar-Log. + + Package: nymea-plugin-tasmota Architecture: any Depends: ${shlibs:Depends}, diff --git a/debian/nymea-plugin-solarlog.install.in b/debian/nymea-plugin-solarlog.install.in new file mode 100644 index 00000000..fec3ab6b --- /dev/null +++ b/debian/nymea-plugin-solarlog.install.in @@ -0,0 +1 @@ +usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/libnymea_integrationpluginsolarlog.so diff --git a/nymea-plugins.pro b/nymea-plugins.pro index e5605321..c734ab56 100644 --- a/nymea-plugins.pro +++ b/nymea-plugins.pro @@ -40,6 +40,7 @@ PLUGIN_DIRS = \ philipshue \ pushbullet \ shelly \ + solarlog \ systemmonitor \ remotessh \ senic \ diff --git a/solarlog/README.md b/solarlog/README.md new file mode 100644 index 00000000..092be2aa --- /dev/null +++ b/solarlog/README.md @@ -0,0 +1,24 @@ +# Solar-Log + +This plug-in integrates Solar-Log devices into nymea. + +## Supported Things + +* Solar-Log 200 +* Solar-Log 250 +* Solar-Log 300 +* Solar-Log 500 +* Solar-Log 1000 +* Solar-Log 1200 +* Solar-Log 1900 +* Solar-Log 2000 + +## Requirements + +* The package 'nymea-plugin-solarlog' must be installed. +* The device and nymea must be in the same network. +* Device to be updated to the Solar-Log Firmware Version 3.6.0. + +## More +https://www.solar-log.com/en + diff --git a/solarlog/integrationpluginsolarlog.cpp b/solarlog/integrationpluginsolarlog.cpp new file mode 100644 index 00000000..5d4ad8b7 --- /dev/null +++ b/solarlog/integrationpluginsolarlog.cpp @@ -0,0 +1,77 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU Lesser General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; version 3. This project is distributed in the hope that +* it will be useful, but WITHOUT ANY WARRANTY; without even the implied +* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "integrationpluginsolarlog.h".h" +#include "plugininfo.h" +#include "network/networkaccessmanager.h" + + +IntegrationPluginSolarLog::IntegrationPluginSolarLog() +{ + +} + +void IntegrationPluginSolarLog::setupThing(ThingSetupInfo *info) +{ + if (!m_refreshTimer) { + m_refreshTimer = hardwareManager()->pluginTimerManager()->registerTimer(2); + connect(m_refreshTimer, &PluginTimer::timeout, this, &IntegrationPluginSolarLog::onRefreshTimer); + } + info->finish(Thing::ThingErrorNoError); +} + +void IntegrationPluginSolarLog::thingRemoved(Thing *thing) +{ + Q_UNUSED(thing) + + if (myThings().isEmpty()) { + hardwareManager()->pluginTimerManager()->unregisterTimer(m_refreshTimer); + m_refreshTimer = nullptr; + } +} + +void IntegrationPluginSolarLog::onRefreshTimer() +{ + foreach (Thing *, myThings().filterByThingClassId()) { + + } +} + +QUuid IntegrationPluginSolarLog::getData(const QHostAddress &address) +{ + QUrl url; + url.setHost(address); + url.setPath("/getjp"); + url.setScheme("http"); + + hardwareManager()->networkManager()->post(QNetworkRequest(url), QByteArray("{\"801\":{\"170\":null}}")); +} + + diff --git a/solarlog/integrationpluginsolarlog.h b/solarlog/integrationpluginsolarlog.h new file mode 100644 index 00000000..4ccdcbd3 --- /dev/null +++ b/solarlog/integrationpluginsolarlog.h @@ -0,0 +1,63 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU Lesser General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; version 3. This project is distributed in the hope that +* it will be useful, but WITHOUT ANY WARRANTY; without even the implied +* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef INTEGRATIONPLUGINSOLARLOG_H +#define INTEGRATIONPLUGINSOLARLOG_H + +#include "integrations/integrationplugin.h" +#include "plugintimer.h" + +#include +#include +#include + + +class IntegrationPluginSolarLog: public IntegrationPlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "io.nymea.IntegrationPlugin" FILE "integrationpluginsolarlog.json") + Q_INTERFACES(IntegrationPlugin) + +public: + explicit IntegrationPluginSolarLog(); + ~IntegrationPluginSolarLog() override; + + void setupThing(ThingSetupInfo *info) override; + void thingRemoved(Thing *thing) override; + +private slots: + void onRefreshTimer(); + +private: + PluginTimer *m_refreshTimer = nullptr; + + QUuid getData(const QHostAddress &address); +}; + +#endif // INTEGRATIONPLUGINSOLARLOG_H diff --git a/solarlog/integrationpluginsolarlog.json b/solarlog/integrationpluginsolarlog.json new file mode 100644 index 00000000..cea1a6b4 --- /dev/null +++ b/solarlog/integrationpluginsolarlog.json @@ -0,0 +1,194 @@ +{ + "id": "606adc5a-c9a5-45fa-9652-ea385dcb0b81", + "name": "solarlog", + "displayName": "Solar-Log", + "vendors": [ + { + "id": "0cf5f437-abf0-4396-92d4-be94d616c667", + "name": "Solarlog", + "displayName": "Solar-Log", + "thingClasses": [ + { + "id": "1374b47e-5555-4ec1-b2cd-6474048dd30c", + "name": "Solarlog", + "displayName": "Solar-Log", + "createMethods": [ "user", "discovery" ], + "interfaces": [ "batterylevel", "connectable" ], + "paramTypes": [ + { + "id": "84bd8a41-2411-4bb0-87a9-ab7e01044b10", + "name": "host", + "displayName": "Address", + "type": "QString", + "inputType": "TextLine", + "defaultValue": "http://solar-log" + } + ], + "stateTypes": [ + { + "id": "eb9f8575-71e3-42a9-aa4d-ffea9586cc4f", + "name": "connected", + "displayName": "Connected", + "displayNameEvent": "Connected changed", + "type": "bool", + "defaultValue": false, + "cached": false + }, + { + "id": "b944c513-a7f0-4bc1-941e-aae9849557fe", + "name": "lastupdate", + "displayName": "Last update", + "displayNameEvent": "Last update changed", + "type": "QString", + "defaultValue": "" + }, + { + "id": "0bf515d8-0f48-4eba-9255-f774d68c80fe", + "name": "pac", + "displayName": "PAC", + "displayNameEvent": "PAC changed", + "type": "int", + "unit": "Watt", + "defaultValue": 0 + }, + { + "id": "e4183a70-c848-447a-962a-f19dc5974140", + "name": "pdc", + "displayName": "PDC", + "displayNameEvent": "PDC changed", + "type": "int", + "unit": "Watt", + "defaultValue": 0 + }, + { + "id": "7dc46b2e-5fba-4cc6-a159-09472cdfac62", + "name": "uac", + "displayName": "UAC", + "displayNameEvent": "UAC changed", + "type": "int", + "unit": "Voltage", + "defaultValue": 0 + }, + { + "id": "bb891a05-59d8-4a3b-a0ea-b63af58558f7", + "name": "dcVoltage", + "displayName": "DC Voltage", + "displayNameEvent": "DC Voltage changed", + "type": "int", + "unit": "Voltage", + "defaultValue": 0 + }, + { + "id": "53ed041a-e3c3-4ae5-9a79-1cd7ad82e9a8", + "name": "yieldDay", + "displayName": "Yield day", + "displayNameEvent": "Yield day changed", + "type": "int", + "unit": "WattHour", + "defaultValue": 0 + }, + { + "id": "bd96d0b3-e921-49eb-8b34-0b3be5bb27fa", + "name": "yieldYesterday", + "displayName": "Yield yesterday", + "displayNameEvent": "Yield yesterday changed", + "type": "int", + "unit": "WattHour", + "defaultValue": 0 + }, + { + "id": "9a77662a-2034-4031-8e7a-1e6347089d97", + "name": "yieldMonth", + "displayName": "Yield month", + "displayNameEvent": "Yield month changed", + "type": "int", + "unit": "WattHour", + "defaultValue": 0 + }, + { + "id": "d18169ce-deeb-4f7b-b737-818a91760041", + "name": "yieldYear", + "displayName": "Yield year", + "displayNameEvent": "Yield year changed", + "type": "int", + "unit": "WattHour", + "defaultValue": 0 + }, + { + "id": "3afb6ea1-fef8-4c17-8307-c7547a7a6f3c", + "name": "yieldTotal", + "displayName": "Yield total", + "displayNameEvent": "Yield total changed", + "type": "int", + "unit": "WattHour", + "defaultValue": 0 + }, + { + "id": "5b665247-278a-4b59-9046-add40763e937", + "name": "currentTotalConsumption", + "displayName": "Current total consumption", + "displayNameEvent": "Current total consumption changed", + "type": "int", + "unit": "Watt", + "defaultValue": 0 + }, + { + "id": "40ff1d14-a5d2-4fdb-919c-58dfbcdca123", + "name": "consYieldDay", + "displayName": "consYieldDay", + "displayNameEvent": "consYieldDay changed", + "type": "int", + "unit": "WattHour", + "defaultValue": 0 + }, + { + "id": "5d6d5ba5-ebc3-42ce-9d08-802da694b4da", + "name": "consYieldYesterday", + "displayName": "consYieldYesterday", + "displayNameEvent": "consYieldYesterday changed", + "type": "int", + "unit": "WattHour", + "defaultValue": 0 + }, + { + "id": "a45a557a-a937-4382-8ef5-76f1ff5940e4", + "name": "consYieldMonth", + "displayName": "consYieldMonth", + "displayNameEvent": "consYieldMonth changed", + "type": "int", + "unit": "WattHour", + "defaultValue": 0 + }, + { + "id": "1d42619b-3a50-4bde-b325-67a8014332ef", + "name": "consYieldYear", + "displayName": "consYieldYear", + "displayNameEvent": "consYieldYear changed", + "type": "int", + "unit": "WattHour", + "defaultValue": 0 + }, + { + "id": "34f60062-5dec-45ed-9a27-4fbc083cb36e", + "name": "consYieldTotal", + "displayName": "consYieldTotal", + "displayNameEvent": "consYieldTotal changed", + "type": "int", + "unit": "WattHour", + "defaultValue": 0 + }, + { + "id": "0aa21401-2a3d-4149-803b-f0ba8c66b2f7", + "name": "totalPower", + "displayName": "Installed generator power", + "displayNameEvent": "Installed generator power changed", + "type": "int", + "unit": "Watt", + "defaultValue": 0 + } + ] + } + ] + } + ] +} diff --git a/solarlog/meta.json b/solarlog/meta.json new file mode 100644 index 00000000..4646a411 --- /dev/null +++ b/solarlog/meta.json @@ -0,0 +1,12 @@ +{ + "title": "Solar-Log", + "tagline": "Integrates Solar-Log with nymea.", + "icon": "solarlog.png", + "stability": "consumer", + "offline": true, + "technologies": [ + "network" + ], + "categories": [ + ] +} diff --git a/solarlog/solarlog.cpp b/solarlog/solarlog.cpp new file mode 100644 index 00000000..e69de29b diff --git a/solarlog/solarlog.h b/solarlog/solarlog.h new file mode 100644 index 00000000..e69de29b diff --git a/solarlog/solarlog.png b/solarlog/solarlog.png new file mode 100644 index 00000000..e26006be Binary files /dev/null and b/solarlog/solarlog.png differ diff --git a/solarlog/solarlog.pro b/solarlog/solarlog.pro new file mode 100644 index 00000000..06846de6 --- /dev/null +++ b/solarlog/solarlog.pro @@ -0,0 +1,9 @@ +include(../plugins.pri) + +QT += network + +SOURCES += \ + integrationpluginsolarlog.cpp \ + +HEADERS += \ + integrationpluginsolarlog.h \