added new plug-in solar-log

master
Boernsman 2020-06-18 15:52:03 +02:00
parent ed44b0e19c
commit 86cf4c9283
12 changed files with 396 additions and 0 deletions

15
debian/control vendored
View File

@ -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},

View File

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

View File

@ -40,6 +40,7 @@ PLUGIN_DIRS = \
philipshue \
pushbullet \
shelly \
solarlog \
systemmonitor \
remotessh \
senic \

24
solarlog/README.md Normal file
View File

@ -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

View File

@ -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 <https://www.gnu.org/licenses/>.
*
* 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}}"));
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*
* 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 <QDebug>
#include <QHostAddress>
#include <QUrlQuery>
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

View File

@ -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
}
]
}
]
}
]
}

12
solarlog/meta.json Normal file
View File

@ -0,0 +1,12 @@
{
"title": "Solar-Log",
"tagline": "Integrates Solar-Log with nymea.",
"icon": "solarlog.png",
"stability": "consumer",
"offline": true,
"technologies": [
"network"
],
"categories": [
]
}

0
solarlog/solarlog.cpp Normal file
View File

0
solarlog/solarlog.h Normal file
View File

BIN
solarlog/solarlog.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

9
solarlog/solarlog.pro Normal file
View File

@ -0,0 +1,9 @@
include(../plugins.pri)
QT += network
SOURCES += \
integrationpluginsolarlog.cpp \
HEADERS += \
integrationpluginsolarlog.h \