modification du moment des notifications(heures pleines)
This commit is contained in:
+9
-6
@@ -109,7 +109,7 @@ void Pws2mqtt::init()
|
|||||||
{
|
{
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
QList<std::pair<QString, QString>> queryList = request.query().queryItems();
|
QList<std::pair<QString, QString>> queryList = request.query().queryItems();
|
||||||
|
debug(DEBUGMACRO, "Réception des données", INFO);
|
||||||
//QTextStream result(&data);
|
//QTextStream result(&data);
|
||||||
|
|
||||||
if (queryList.isEmpty())
|
if (queryList.isEmpty())
|
||||||
@@ -117,7 +117,8 @@ void Pws2mqtt::init()
|
|||||||
debug(DEBUGMACRO, "Request query is empty", WARNING);
|
debug(DEBUGMACRO, "Request query is empty", WARNING);
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
debug(DEBUGMACRO, "Request query :" + request.query().toString() , DEBUG);
|
debug(DEBUGMACRO, "Request query :" + request.query().toString() , INFO
|
||||||
|
);
|
||||||
QMetaObject::invokeMethod(this, [this, query = request.query()]() {
|
QMetaObject::invokeMethod(this, [this, query = request.query()]() {
|
||||||
this->parseData(query.queryItems());
|
this->parseData(query.queryItems());
|
||||||
}, Qt::QueuedConnection);
|
}, Qt::QueuedConnection);
|
||||||
@@ -368,7 +369,6 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
}else if (name == "baromin")
|
}else if (name == "baromin")
|
||||||
{
|
{
|
||||||
//static QDateTime timePrevision = QDateTime::currentDateTime().addSecs(-1000);
|
//static QDateTime timePrevision = QDateTime::currentDateTime().addSecs(-1000);
|
||||||
|
|
||||||
propertyValue = round(tohPa(pair.second.toFloat()) * 100) / 100;
|
propertyValue = round(tohPa(pair.second.toFloat()) * 100) / 100;
|
||||||
debug (DEBUGMACRO, "Barometre en hPa : " + QByteArray::number(propertyValue), DEBUG);
|
debug (DEBUGMACRO, "Barometre en hPa : " + QByteArray::number(propertyValue), DEBUG);
|
||||||
baro->addPressure(propertyValue);
|
baro->addPressure(propertyValue);
|
||||||
@@ -405,10 +405,12 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
propertyList[name] = formatNotifString(propertyName[name].first, "", QByteArray::number(propertyValue));
|
propertyList[name] = formatNotifString(propertyName[name].first, "", QByteArray::number(propertyValue));
|
||||||
}
|
}
|
||||||
debug (DEBUGMACRO, "priority = " + QString::number(priority[name]), DEBUG);
|
debug (DEBUGMACRO, "priority = " + QString::number(priority[name]), DEBUG);
|
||||||
|
|
||||||
}else if (name == "solarradiation")
|
}else if (name == "solarradiation")
|
||||||
{
|
{
|
||||||
|
propertyValue = pair.second.toFloat()*100/100;
|
||||||
|
propertyList[name] = formatNotifString(propertyName[name].first, "", QByteArray::number(propertyValue));
|
||||||
propertiesValue[name] = round(pair.second.toFloat()*100/100);
|
propertiesValue[name] = round(pair.second.toFloat()*100/100);
|
||||||
|
debug (DEBUGMACRO, "SolarRadiations = " + QByteArray::number(propertyValue), DEBUG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -462,7 +464,8 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
notif += propertyList[name];
|
notif += propertyList[name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (QDateTime::currentDateTime() > timer.addSecs(3600) or start == false or aPriority >= 3)
|
QTime currentTime = QTime::currentTime();
|
||||||
|
if (currentTime.minute() == 0 or start == false or aPriority >= 3)
|
||||||
{
|
{
|
||||||
timer = QDateTime::currentDateTime();
|
timer = QDateTime::currentDateTime();
|
||||||
start = true;
|
start = true;
|
||||||
@@ -471,7 +474,7 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
|
|
||||||
notif = "**Prévisions à 12/24h**\n" + propertyList["prevision"];
|
notif = "**Prévisions à 12/24h**\n" + propertyList["prevision"];
|
||||||
notify (notif, priorityList[aPriority], "", tag);
|
notify (notif, priorityList[aPriority], "", tag);
|
||||||
debug(DEBUGMACRO, "calling notify with notif = #" + notif + "#", DEBUG);
|
debug(DEBUGMACRO, "calling notify with notif = #" + notif + "#", INFO);
|
||||||
}
|
}
|
||||||
debug(DEBUGMACRO, "parseData: Returning", DEBUG);
|
debug(DEBUGMACRO, "parseData: Returning", DEBUG);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user