fix some small bugs

This commit is contained in:
Simon Stürz 2016-01-09 17:33:13 +01:00 committed by Michael Zanetti
parent 6b39bcdaa6
commit e85e8d7773
3 changed files with 17 additions and 9 deletions

View File

@ -74,6 +74,7 @@
DevicePluginAwattar::DevicePluginAwattar() DevicePluginAwattar::DevicePluginAwattar()
{ {
} }
DeviceManager::HardwareResources DevicePluginAwattar::requiredHardware() const DeviceManager::HardwareResources DevicePluginAwattar::requiredHardware() const
@ -81,6 +82,15 @@ DeviceManager::HardwareResources DevicePluginAwattar::requiredHardware() const
return DeviceManager::HardwareResourceNetworkManager | DeviceManager::HardwareResourceTimer; return DeviceManager::HardwareResourceNetworkManager | DeviceManager::HardwareResourceTimer;
} }
QList<ParamType> DevicePluginAwattar::configurationDescription() const
{
QList<ParamType> params;
ParamType mockParam1("RPL Router address", QVariant::String, "");
params.append(mockParam1);
return params;
}
DeviceManager::DeviceSetupStatus DevicePluginAwattar::setupDevice(Device *device) DeviceManager::DeviceSetupStatus DevicePluginAwattar::setupDevice(Device *device)
{ {
QString token = device->paramValue("token").toString(); QString token = device->paramValue("token").toString();
@ -260,8 +270,7 @@ void DevicePluginAwattar::processPriceData(Device *device, const QVariantMap &da
device->setStateValue(averagePriceStateTypeId, averagePrice); device->setStateValue(averagePriceStateTypeId, averagePrice);
device->setStateValue(lowestPriceStateTypeId, minPrice); device->setStateValue(lowestPriceStateTypeId, minPrice);
device->setStateValue(highestPriceStateTypeId, maxPrice); device->setStateValue(highestPriceStateTypeId, maxPrice);
device->setStateValue(meanDeviationStateTypeId, deviation); device->setStateValue(averageDeviationStateTypeId, deviation);
if (fromSetup) if (fromSetup)
emit deviceSetupFinished(device, DeviceManager::DeviceSetupStatusSuccess); emit deviceSetupFinished(device, DeviceManager::DeviceSetupStatusSuccess);
@ -280,7 +289,6 @@ void DevicePluginAwattar::processUserData(Device *device, const QVariantMap &dat
// check if we are in the current interval // check if we are in the current interval
if (currentTime >= startTime && currentTime <= endTime) { if (currentTime >= startTime && currentTime <= endTime) {
//qCDebug(dcAwattar) << QJsonDocument::fromVariant(elementMap).toJson();
int sgMode = 0; int sgMode = 0;
if (elementMap.contains("data")) { if (elementMap.contains("data")) {
if (elementMap.value("data").toMap().contains("sg-mode")) { if (elementMap.value("data").toMap().contains("sg-mode")) {
@ -288,9 +296,6 @@ void DevicePluginAwattar::processUserData(Device *device, const QVariantMap &dat
} }
} }
//qCDebug(dcAwattar) << startTime.toString() << " -> " << endTime.toString();
//qCDebug(dcAwattar) << "sg-mode:" << sgMode;
switch (sgMode) { switch (sgMode) {
case 1: case 1:
device->setStateValue(sgModeStateTypeId, "1 - Off"); device->setStateValue(sgModeStateTypeId, "1 - Off");

View File

@ -37,6 +37,9 @@ public:
explicit DevicePluginAwattar(); explicit DevicePluginAwattar();
DeviceManager::HardwareResources requiredHardware() const override; DeviceManager::HardwareResources requiredHardware() const override;
QList<ParamType> configurationDescription() const override;
DeviceManager::DeviceSetupStatus setupDevice(Device *device) override; DeviceManager::DeviceSetupStatus setupDevice(Device *device) override;
void deviceRemoved(Device *device) override; void deviceRemoved(Device *device) override;
void networkManagerReplyReady(QNetworkReply *reply) override; void networkManagerReplyReady(QNetworkReply *reply) override;

View File

@ -47,8 +47,8 @@
}, },
{ {
"id": "38b86cee-9588-4269-a585-128907929dc2", "id": "38b86cee-9588-4269-a585-128907929dc2",
"idName": "meanDeviation", "idName": "averageDeviation",
"name": "deviation", "name": "average deviation",
"type": "double", "type": "double",
"unit": "Percentage", "unit": "Percentage",
"defaultValue": 0 "defaultValue": 0
@ -80,7 +80,7 @@
{ {
"id": "0c171c42-b070-453e-8a63-df9aebfa8533", "id": "0c171c42-b070-453e-8a63-df9aebfa8533",
"idName": "highestPrice", "idName": "highestPrice",
"name": " highest market price [± 12 h]", "name": "highest market price [± 12 h]",
"type": "double", "type": "double",
"unit": "EuroPerMegaWattHour", "unit": "EuroPerMegaWattHour",
"defaultValue": 0 "defaultValue": 0