fix some small bugs

pull/135/head
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()
{
}
DeviceManager::HardwareResources DevicePluginAwattar::requiredHardware() const
@ -81,6 +82,15 @@ DeviceManager::HardwareResources DevicePluginAwattar::requiredHardware() const
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)
{
QString token = device->paramValue("token").toString();
@ -260,8 +270,7 @@ void DevicePluginAwattar::processPriceData(Device *device, const QVariantMap &da
device->setStateValue(averagePriceStateTypeId, averagePrice);
device->setStateValue(lowestPriceStateTypeId, minPrice);
device->setStateValue(highestPriceStateTypeId, maxPrice);
device->setStateValue(meanDeviationStateTypeId, deviation);
device->setStateValue(averageDeviationStateTypeId, deviation);
if (fromSetup)
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
if (currentTime >= startTime && currentTime <= endTime) {
//qCDebug(dcAwattar) << QJsonDocument::fromVariant(elementMap).toJson();
int sgMode = 0;
if (elementMap.contains("data")) {
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) {
case 1:
device->setStateValue(sgModeStateTypeId, "1 - Off");

View File

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

View File

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