awattar: Add Qt6 support

This commit is contained in:
Simon Stürz 2025-08-07 14:54:57 +02:00
parent 96b55b8177
commit 68d8cf1c40
3 changed files with 11 additions and 13 deletions

View File

@ -1,8 +1,6 @@
include(../plugins.pri)
QT += network
TARGET = $$qtLibraryTarget(nymea_integrationpluginawattar)
QT *= network
SOURCES += \
integrationpluginawattar.cpp

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright 2013 - 2020, nymea GmbH
* Copyright 2013 - 2025, nymea GmbH
* Contact: contact@nymea.io
*
* This file is part of nymea.
@ -29,10 +29,11 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "integrationpluginawattar.h"
#include "integrations/thing.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 <QJsonDocument>
@ -73,7 +74,6 @@ void IntegrationPluginAwattar::setupThing(ThingSetupInfo *info)
{
qCDebug(dcAwattar) << "Setup thing" << info->thing()->name() << info->thing()->params();
if (!m_pluginTimer) {
m_pluginTimer = hardwareManager()->pluginTimerManager()->registerTimer(60 * 60);
connect(m_pluginTimer, &PluginTimer::timeout, this, &IntegrationPluginAwattar::onPluginTimer);
@ -190,7 +190,7 @@ void IntegrationPluginAwattar::processPriceData(Thing *thing, const QVariantMap
minPrice = price;
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);
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);
if (rank < 0) {
rank = 100;

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright 2013 - 2020, nymea GmbH
* Copyright 2013 - 2025, nymea GmbH
* Contact: contact@nymea.io
*
* This file is part of nymea.
@ -31,8 +31,8 @@
#ifndef INTEGRATIONPLUGINAWATTAR_H
#define INTEGRATIONPLUGINAWATTAR_H
#include "integrations/integrationplugin.h"
#include "plugintimer.h"
#include <integrations/integrationplugin.h>
#include <plugintimer.h>
#include <QHash>
#include <QDebug>