This commit is contained in:
2026-05-13 22:39:01 +02:00
parent 2f7f72d9b4
commit 6cdae78c2a
2 changed files with 11 additions and 2 deletions
+10 -1
View File
@@ -454,6 +454,7 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
debug (DEBUGMACRO, "solarradiations : " + QByteArray::number(propertyValue), DEBUG);
}
}
debug(DEBUGMACRO, "propertyList[name] = " + propertyList[name]);
}
propertiesValue["windchill"] = calc.computeUTCI(propertiesValue["tempf"], propertiesValue["vent"], propertiesValue["solarradiation"], propertiesValue["humidity"]);
propertyList["windchill"] = formatNotifString(propertyName["windchill"], QByteArray::number(propertiesValue["windchill"]));
@@ -478,6 +479,11 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
//bool changed = false;
quint8 aPriority= 0;
debug(DEBUGMACRO, "looping for propertyList", DEBUG);
for (auto [name,value]: propertyList.asKeyValueRange())
{
debug(DEBUGMACRO, "name = " + name + " => value = " + value);
}
debug(DEBUGMACRO, "looping to fill notif", DEBUG);
QTime currentTime = QTime::currentTime();
@@ -503,12 +509,13 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
debug(DEBUGMACRO, "parseData: Returning", DEBUG);
}
QString listProperties2notify (QMap <QByteArray, QString> propertyList, QHash <QByteArray, quint8> priority, quint8 minAlert)
QString listProperties2notify (const QMap <QByteArray, QString> &propertyList, QHash <QByteArray, quint8> priority, quint8 minAlert)
{
static QHash <QByteArray, quint8> announced = {};
QString notif = "";
for (auto [name, value]: propertyList.asKeyValueRange())
{
debug(DEBUGMACRO, "property : " + name + " value : " + value, DEBUG);
if (name != "prevision")
{
//if (precPropertyList.contains(name))
@@ -518,6 +525,7 @@ QString listProperties2notify (QMap <QByteArray, QString> propertyList, QHash <
if (minAlert == 0)
{
notif += propertyList[name];
debug(DEBUGMACRO, "notif : " + notif, DEBUG);
}else if (priority[name] >= minAlert)
{
if (announced.contains(name) and priority.contains(name))
@@ -526,6 +534,7 @@ QString listProperties2notify (QMap <QByteArray, QString> propertyList, QHash <
{
notif += propertyList[name];
announced[name] = priority[name];
debug(DEBUGMACRO, "notif : " + notif, DEBUG);
}else
{
debug (DEBUGMACRO, name + " : déjà annoncé = " + announced[name] + " nouvelle valeur = " + priority[name], INFO);
+1 -1
View File
@@ -68,5 +68,5 @@ void rotateAndSaveImage(const QString &inputPath, const QString &outputPath, qre
double windChill(double airT, double vent);
double calculerHumidex(double temperature, double humiditeRelative);
void notify (QString notif, QString priority = "low", QString inputPath = "", QString tag = "");
QString listProperties2notify (QMap <QByteArray, QString> propertyList, QHash <QByteArray, quint8> priority, quint8 minAlert = 0);
QString listProperties2notify (const QMap<QByteArray, QString> &propertyList, QHash <QByteArray, quint8> priority, quint8 minAlert = 0);