prévision météo fonctionnelle
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 9.0.1, 2025-10-03T23:36:59. -->
|
<!-- Written by QtCreator 9.0.1, 2025-10-05T19:33:41. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
@@ -90,13 +90,13 @@
|
|||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 6.4.1 (qt6)</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 6.4.1 (qt6)</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 6.4.1 (qt6)</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 6.4.1 (qt6)</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{17b0ba8e-e6fe-4c71-98eb-9b4d3bcc4307}</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{17b0ba8e-e6fe-4c71-98eb-9b4d3bcc4307}</value>
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
<value type="int" key="EnableQmlDebugging">0</value>
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/daniel/develop/build-pws2mqtt-qt-Desktop-Debug</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/daniel/develop/pws2mqtt-qt/build/debug</value>
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/daniel/develop/build-pws2mqtt-qt-Desktop-Debug</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/daniel/develop/pws2mqtt-qt/build/debug</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
@@ -140,7 +140,47 @@
|
|||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/daniel/develop/pws2mqtt-qt/build/Release</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/daniel/develop/pws2mqtt-qt/build/Release</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||||
|
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||||
|
<value type="int" key="QtQuickCompiler">0</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||||
@@ -169,7 +209,7 @@
|
|||||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||||
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
|
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
|
||||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/daniel/develop/build-pws2mqtt-qt-Desktop-Debug</value>
|
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/daniel/develop/pws2mqtt-qt/build/Release</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
|
|||||||
41
pws2mqtt.cpp
41
pws2mqtt.cpp
@@ -17,13 +17,16 @@
|
|||||||
extern MqttClient *mqttClient;
|
extern MqttClient *mqttClient;
|
||||||
extern Pws2mqtt *pws2mqtt;
|
extern Pws2mqtt *pws2mqtt;
|
||||||
extern QHttpServer *httpServer;
|
extern QHttpServer *httpServer;
|
||||||
QStringList previsionList {"Temps variable (incertain).", \
|
QStringList previsionList
|
||||||
"Beau temps stable (anticyclone).", \
|
{
|
||||||
"Amélioration progressive (éclaircies).", \
|
"Temps variable (incertain).", \
|
||||||
"Risque de pluie légère ou nuages.", \
|
"Beau temps stable (anticyclone).", \
|
||||||
"Dégradation marquée (pluie/vent/orage).", \
|
"Amélioration progressive (éclaircies).", \
|
||||||
"Tempête ou dépression forte (vigilance)." \
|
"Risque de pluie légère ou nuages.", \
|
||||||
};
|
"Dégradation marquée (pluie/vent/orage).", \
|
||||||
|
"Tempête ou dépression forte (vigilance).", \
|
||||||
|
"Temps stable"
|
||||||
|
};
|
||||||
|
|
||||||
// Callback for curl library
|
// Callback for curl library
|
||||||
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
|
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
|
||||||
@@ -330,14 +333,15 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
QString ret = pressureVariation(propertyValue);
|
QString ret = pressureVariation(propertyValue);
|
||||||
if (!ret.isEmpty())
|
if (!ret.isEmpty())
|
||||||
{
|
{
|
||||||
debug (DEBUGMACRO, "baromin ret not empty : " + QByteArray::number(propertyValue), DEBUG);
|
debug (DEBUGMACRO, "baromin ret not empty : " + ret, DEBUG);
|
||||||
QStringList liste = ret.split(",");
|
QStringList liste = ret.split(",");
|
||||||
double newPrevision = liste[1].toInt();
|
double newPrevision = liste[0].toUInt();
|
||||||
|
priority = setPriority(priority, liste[1].toUInt());
|
||||||
if (prevision != newPrevision)
|
if (prevision != newPrevision)
|
||||||
{
|
{
|
||||||
prevision = newPrevision;
|
prevision = newPrevision;
|
||||||
propertyList["prevision"] = prevision;
|
propertyList["prevision"] = prevision;
|
||||||
//notif += prevision + " \n";
|
notif += previsionList[prevision] + " \n";
|
||||||
//debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
//debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@@ -441,7 +445,10 @@ quint8 previsionMeteo(double currentPressure, double variation3h)
|
|||||||
} else if (currentPressure < 990.0)
|
} else if (currentPressure < 990.0)
|
||||||
{
|
{
|
||||||
return 4;
|
return 4;
|
||||||
} else
|
} else if (variation3h == 0)
|
||||||
|
{
|
||||||
|
return 6;
|
||||||
|
}else
|
||||||
{
|
{
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
@@ -450,21 +457,19 @@ quint8 previsionMeteo(double currentPressure, double variation3h)
|
|||||||
QString pressureVariation(double currentPressure)
|
QString pressureVariation(double currentPressure)
|
||||||
{
|
{
|
||||||
const int NB_MESURES_3H = 360; // 3h × 120 mesures/heure (1 mesure toutes les 30s)
|
const int NB_MESURES_3H = 360; // 3h × 120 mesures/heure (1 mesure toutes les 30s)
|
||||||
QVector<double> historiquePressions;
|
static QVector<double> historiquePressions;
|
||||||
|
|
||||||
debug(DEBUGMACRO, "PressureVariation", DEBUG);
|
debug(DEBUGMACRO, "PressureVariation : current pressure = " + QByteArray::number(currentPressure), DEBUG);
|
||||||
|
|
||||||
historiquePressions.reserve(NB_MESURES_3H);
|
historiquePressions.append(currentPressure);
|
||||||
|
|
||||||
// Ajout de la mesure à l'historique
|
|
||||||
historiquePressions.push_back(currentPressure);
|
|
||||||
|
|
||||||
// Si on a assez de mesures pour couvrir 3h
|
// Si on a assez de mesures pour couvrir 3h
|
||||||
if (historiquePressions.size() > NB_MESURES_3H)
|
if (historiquePressions.size() > NB_MESURES_3H)
|
||||||
{
|
{
|
||||||
|
debug(DEBUGMACRO, "historiquePressions > " + QByteArray::number(NB_MESURES_3H), DEBUG);
|
||||||
historiquePressions.erase(historiquePressions.begin());
|
historiquePressions.erase(historiquePressions.begin());
|
||||||
}
|
}
|
||||||
|
debug(DEBUGMACRO, "taille de historiquePression : " + QByteArray::number(historiquePressions.size()), DEBUG);
|
||||||
// Calcul de la variation sur 3h si on a assez de mesures
|
// Calcul de la variation sur 3h si on a assez de mesures
|
||||||
if (historiquePressions.size() == NB_MESURES_3H)
|
if (historiquePressions.size() == NB_MESURES_3H)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user