minor corrections
This commit is contained in:
1 parent
2d3ab95e83
commit
2ff8eb3ee7
1 file changed
+15
-15
+15
-15
@@ -231,15 +231,14 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
QString attachment = "";
|
QString attachment = "";
|
||||||
QString tag = "";
|
QString tag = "";
|
||||||
double propertyValue = 0;
|
double propertyValue = 0;
|
||||||
bool propertyFlag = false;
|
|
||||||
bool deviceFlag = false;
|
|
||||||
static QDateTime timer = QDateTime::currentDateTime().addSecs(-2000);
|
static QDateTime timer = QDateTime::currentDateTime().addSecs(-2000);
|
||||||
static QHash <QByteArray, quint8> priority = {};
|
static QHash <QByteArray, quint8> priority = {};
|
||||||
static bool start = false;
|
static bool start = false;
|
||||||
|
|
||||||
debug(DEBUGMACRO, "looping list of query", DEBUG);
|
debug(DEBUGMACRO, "looping list of query", DEBUG);
|
||||||
|
|
||||||
for (QPair<QString, QString> pair : queryList)
|
for (const QPair<QString, QString> &pair : queryList)
|
||||||
{
|
{
|
||||||
debug(DEBUGMACRO, pair.first + " = " + pair.second, DEBUG);
|
debug(DEBUGMACRO, pair.first + " = " + pair.second, DEBUG);
|
||||||
QByteArray name = pair.first.toLatin1();
|
QByteArray name = pair.first.toLatin1();
|
||||||
@@ -248,25 +247,26 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
|
|
||||||
if (this->deviceProperties.contains(name))
|
if (this->deviceProperties.contains(name))
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_MQTT
|
||||||
|
bool propertyFlag = false;
|
||||||
|
bool deviceFlag = false;
|
||||||
|
|
||||||
if(deviceFlag == false)
|
if(deviceFlag == false)
|
||||||
{
|
{
|
||||||
deviceFlag = true;
|
deviceFlag = true;
|
||||||
}
|
}
|
||||||
#ifdef WITH_MQTT
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
deviceString.append(", ");
|
deviceString.append(", ");
|
||||||
}
|
}
|
||||||
deviceString += "\"" + name + "\": ";
|
deviceString += "\"" + name + "\": ";
|
||||||
deviceString += pair.second;
|
deviceString += pair.second;
|
||||||
#endif
|
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
if(propertyFlag == false)
|
if(propertyFlag == false)
|
||||||
{
|
{
|
||||||
propertyFlag = true;
|
propertyFlag = true;
|
||||||
}
|
}
|
||||||
#ifdef WITH_MQTT
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
jsonString.append(", ");
|
jsonString.append(", ");
|
||||||
@@ -322,7 +322,7 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
|
|
||||||
propertiesValue[name] = round(mphTokmh(value.toFloat()));
|
propertiesValue[name] = round(mphTokmh(value.toFloat()));
|
||||||
|
|
||||||
debug (DEBUGMACRO, name + " : " + QByteArray::number(propertiesValue[name]), DEBUG);
|
debug (DEBUGMACRO, name + " : " + QByteArray::number(propertiesValue[name]) + " km/h", DEBUG);
|
||||||
|
|
||||||
for (i=0; i<forceVent.size();i++)
|
for (i=0; i<forceVent.size();i++)
|
||||||
{
|
{
|
||||||
@@ -334,7 +334,7 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
propertyList[name] = "- Vent - " + msg + " : " + QByteArray::number(propertiesValue[name]) + "Km/h" + "\n";
|
propertyList[name] = "- Vent - " + msg + " : " + QByteArray::number(propertiesValue[name]) + " Km/h\n";
|
||||||
propertiesValue["forcevent"] = i;
|
propertiesValue["forcevent"] = i;
|
||||||
if (i >= 5)
|
if (i >= 5)
|
||||||
{
|
{
|
||||||
@@ -353,7 +353,7 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
|
|
||||||
propertiesValue[name] = round(mphTokmh(value.toFloat()) );
|
propertiesValue[name] = round(mphTokmh(value.toFloat()) );
|
||||||
|
|
||||||
debug (DEBUGMACRO, name + " : " + QByteArray::number(propertiesValue[name]), DEBUG);
|
debug (DEBUGMACRO, name + " : " + QByteArray::number(propertiesValue[name]) + " km/h", DEBUG);
|
||||||
|
|
||||||
propertyList[name] = formatNotifString (propertyName[name], QByteArray::number(propertiesValue[name]));
|
propertyList[name] = formatNotifString (propertyName[name], QByteArray::number(propertiesValue[name]));
|
||||||
|
|
||||||
@@ -366,8 +366,8 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
{
|
{
|
||||||
static double ecart;
|
static double ecart;
|
||||||
quint8 raininPriority = 1;
|
quint8 raininPriority = 1;
|
||||||
propertyValue = round(pair.second.toFloat()*100)/100;
|
propertyValue = round(pair.second.toFloat()*100)/100.0;
|
||||||
if (propertyValue == 0)
|
if (propertyValue <= 0.01)
|
||||||
{
|
{
|
||||||
ecart = 0.0001;
|
ecart = 0.0001;
|
||||||
}else
|
}else
|
||||||
@@ -387,8 +387,8 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
}else if (name == "dailyrainin")
|
}else if (name == "dailyrainin")
|
||||||
{
|
{
|
||||||
static double ecart;
|
static double ecart;
|
||||||
propertyValue = round(pair.second.toFloat()*100)/100;
|
propertyValue = round(pair.second.toFloat()*100)/100.0;
|
||||||
if (propertyValue == 0)
|
if (propertyValue <= 0.01)
|
||||||
{
|
{
|
||||||
ecart = 0.0001;
|
ecart = 0.0001;
|
||||||
}else
|
}else
|
||||||
@@ -449,7 +449,7 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
propertyValue = pair.second.toFloat()*100/100;
|
propertyValue = pair.second.toFloat()*100/100;
|
||||||
propertyList[name] = formatNotifString(propertyName[name], QByteArray::number(propertyValue));
|
propertyList[name] = formatNotifString(propertyName[name], 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);
|
debug (DEBUGMACRO, "solarradiations : " + QByteArray::number(propertyValue), DEBUG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -612,7 +612,7 @@ double mphTokmh (double value)
|
|||||||
bool compare (double value, double currentValue, double ecart)
|
bool compare (double value, double currentValue, double ecart)
|
||||||
{
|
{
|
||||||
|
|
||||||
debug(DEBUGMACRO, "value: " + QByteArray::number(value) + "testValue: " + QByteArray::number(currentValue), DEBUG);
|
debug(DEBUGMACRO, "Old value: " + QByteArray::number(value) + " ==> Current value: " + QByteArray::number(currentValue), DEBUG);
|
||||||
|
|
||||||
if (currentValue <= (value - ecart) or currentValue >= (value + ecart))
|
if (currentValue <= (value - ecart) or currentValue >= (value + ecart))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user