awattar: Add Qt6 support
This commit is contained in:
parent
96b55b8177
commit
68d8cf1c40
@ -1,8 +1,6 @@
|
|||||||
include(../plugins.pri)
|
include(../plugins.pri)
|
||||||
|
|
||||||
QT += network
|
QT *= network
|
||||||
|
|
||||||
TARGET = $$qtLibraryTarget(nymea_integrationpluginawattar)
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
integrationpluginawattar.cpp
|
integrationpluginawattar.cpp
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -29,10 +29,11 @@
|
|||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#include "integrationpluginawattar.h"
|
#include "integrationpluginawattar.h"
|
||||||
#include "integrations/thing.h"
|
|
||||||
#include "plugininfo.h"
|
#include "plugininfo.h"
|
||||||
#include "hardwaremanager.h"
|
|
||||||
#include "network/networkaccessmanager.h"
|
#include <integrations/thing.h>
|
||||||
|
#include <hardwaremanager.h>
|
||||||
|
#include <network/networkaccessmanager.h>
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
@ -73,7 +74,6 @@ void IntegrationPluginAwattar::setupThing(ThingSetupInfo *info)
|
|||||||
{
|
{
|
||||||
qCDebug(dcAwattar) << "Setup thing" << info->thing()->name() << info->thing()->params();
|
qCDebug(dcAwattar) << "Setup thing" << info->thing()->name() << info->thing()->params();
|
||||||
|
|
||||||
|
|
||||||
if (!m_pluginTimer) {
|
if (!m_pluginTimer) {
|
||||||
m_pluginTimer = hardwareManager()->pluginTimerManager()->registerTimer(60 * 60);
|
m_pluginTimer = hardwareManager()->pluginTimerManager()->registerTimer(60 * 60);
|
||||||
connect(m_pluginTimer, &PluginTimer::timeout, this, &IntegrationPluginAwattar::onPluginTimer);
|
connect(m_pluginTimer, &PluginTimer::timeout, this, &IntegrationPluginAwattar::onPluginTimer);
|
||||||
@ -190,7 +190,7 @@ void IntegrationPluginAwattar::processPriceData(Thing *thing, const QVariantMap
|
|||||||
minPrice = price;
|
minPrice = price;
|
||||||
|
|
||||||
thing->setStateValue(m_currentMarketPriceStateTypeIds.value(thing->thingClassId()), currentPrice / 10.0);
|
thing->setStateValue(m_currentMarketPriceStateTypeIds.value(thing->thingClassId()), currentPrice / 10.0);
|
||||||
thing->setStateValue(m_validUntilStateTypeIds.value(thing->thingClassId()), endTime.toLocalTime().toTime_t());
|
thing->setStateValue(m_validUntilStateTypeIds.value(thing->thingClassId()), endTime.toLocalTime().toSecsSinceEpoch());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ void IntegrationPluginAwattar::processPriceData(Thing *thing, const QVariantMap
|
|||||||
thing->setStateValue(m_averageDeviationStateTypeIds.value(thing->thingClassId()), deviation);
|
thing->setStateValue(m_averageDeviationStateTypeIds.value(thing->thingClassId()), deviation);
|
||||||
|
|
||||||
qCDebug(dcAwattar()) << "AVG:" << averagePrice << "Min:" << minPrice << "Max:" << maxPrice << "Curr:" << currentPrice;
|
qCDebug(dcAwattar()) << "AVG:" << averagePrice << "Min:" << minPrice << "Max:" << maxPrice << "Curr:" << currentPrice;
|
||||||
qSort(prices.begin(), prices.end());
|
std::sort(prices.begin(), prices.end());
|
||||||
int rank = prices.indexOf(currentPrice);
|
int rank = prices.indexOf(currentPrice);
|
||||||
if (rank < 0) {
|
if (rank < 0) {
|
||||||
rank = 100;
|
rank = 100;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -31,8 +31,8 @@
|
|||||||
#ifndef INTEGRATIONPLUGINAWATTAR_H
|
#ifndef INTEGRATIONPLUGINAWATTAR_H
|
||||||
#define INTEGRATIONPLUGINAWATTAR_H
|
#define INTEGRATIONPLUGINAWATTAR_H
|
||||||
|
|
||||||
#include "integrations/integrationplugin.h"
|
#include <integrations/integrationplugin.h>
|
||||||
#include "plugintimer.h"
|
#include <plugintimer.h>
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user