Cześć
Po MQTT wysylam poniższa fraze
{"command": "udevice", "idx": 321, "nvalue": 0, "svalue": "22.77; 41.19; 1007.90", "parse": true}
Przy prubie dodania w domoticzu wirtualnego sensora Temp/Wilg/Baro parametry nie sa poprawnie wyswietlane w zakladce Temperatura. Dane w zakladce Urzadzenia pod danym idx sa aktualizowane.
Natomiast konfiguracja virtualnego sensora Temp/Wilg wyswietla w encji dane poprawnie.
Czy ktoś moze mnie naprowadzić jak poprawnie powinna wygladać fraza MQTT w przypadku konfiguracji virtualnego sensora dla 3 wartosci ?
Pozdrawiam
Znalazłem takie coś.
Temperature+Humidity+Barometer
The temperature+Humidity+Barometer sensor will show just that and an environment level and a prediction. You can send digits for the temperature but only the first is displayed (it is rounded off). The humidity only displays whole numbers (chops off any digits).
{"command":"udevice", "idx":1234, "svalue":"tm;hu;lv;ba;pr"}
where tm is the temperature, hu is the humidity and lv is the environment level, ba is the pressure and pr is the prediction.
lv can have the following values:
0, normal
1, comfortable
2, dry
3, wet
pr can have the following values:
0, no prediction
1, sunny
2, partly cloudy
3, cloudy
4, rain
5, unknown
(oddly enough 6 cloudy/rain does not work for this sensor)
@przemo w AFE Firmware wysyłamy w taki sposób
{"command":"udevice", "idx":1234, "svalue":"temperatura;wilgotoność;status_wilgotności;ciśnienie;0"}
status_wilgotności wyliczam tak
byte AFESensorsCommon::convertHumidyStatusDomoticz(float humidity) {
// https://www.airthings.com/resources/everything-you-need-to-know-about-humidity
if (humidity >= 70) {
return domoticzHumidityWet;
} else if (humidity >= 60) {
return domoticzHumidityNormal;
} else if (humidity >= 30) {
return domoticzHumidityComfortable;
} else if (humidity >= 25) {
return domoticzHumidityNormal;
} else {
return domoticzHumidityDry;
}
}
Wartości które są za domoticzHumidityWet itd @steel_rat napisał powyżej
Na końcu zero, bo z samego czujnika temp, wilgotność, ciśnienie ciężko przewidzieć czy jest pochmurno, deszczowo itd.
Pzdr.
Z Twoja pomoca udalo sie poprawnie odczytać w Domoticz wartości.
Dzieki za sugestie co do statusu wilgotności. Dlaczego w swoim zakresie wilgotności masz 2 razy uwzgledniony status Normal (zakres 25-30 i 60-70) ?
Na jednym z forum znalazlem jeszcze jak jest wyliczany ostatni argument na podstawie ciśnienia.
// Algorithm found here
// http://www.freescale.com/files/sensors/doc/app_note/AN3914.pdf
// Pressure in hPa --> forecast done by calculating kPa/h
int sample(float pressure)
{
// Calculate the average of the last n minutes.
int index = minuteCount % LAST_SAMPLES_COUNT;
lastPressureSamples[index] = pressure;
minuteCount++;
if (minuteCount > 185)
{
minuteCount = 6;
}
if (minuteCount == 5)
{
pressureAvg = getLastPressureSamplesAverage();
}
else if (minuteCount == 35)
{
float lastPressureAvg = getLastPressureSamplesAverage();
float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
if (firstRound) // first time initial 3 hour
{
dP_dt = change * 2; // note this is for t = 0.5hour
}
else
{
dP_dt = change / 1.5; // divide by 1.5 as this is the difference in time from 0 value.
}
}
else if (minuteCount == 65)
{
float lastPressureAvg = getLastPressureSamplesAverage();
float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
if (firstRound) //first time initial 3 hour
{
dP_dt = change; //note this is for t = 1 hour
}
else
{
dP_dt = change / 2; //divide by 2 as this is the difference in time from 0 value
}
}
else if (minuteCount == 95)
{
float lastPressureAvg = getLastPressureSamplesAverage();
float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
if (firstRound) // first time initial 3 hour
{
dP_dt = change / 1.5; // note this is for t = 1.5 hour
}
else
{
dP_dt = change / 2.5; // divide by 2.5 as this is the difference in time from 0 value
}
}
else if (minuteCount == 125)
{
float lastPressureAvg = getLastPressureSamplesAverage();
pressureAvg2 = lastPressureAvg; // store for later use.
float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
if (firstRound) // first time initial 3 hour
{
dP_dt = change / 2; // note this is for t = 2 hour
}
else
{
dP_dt = change / 3; // divide by 3 as this is the difference in time from 0 value
}
}
else if (minuteCount == 155)
{
float lastPressureAvg = getLastPressureSamplesAverage();
float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
if (firstRound) // first time initial 3 hour
{
dP_dt = change / 2.5; // note this is for t = 2.5 hour
}
else
{
dP_dt = change / 3.5; // divide by 3.5 as this is the difference in time from 0 value
}
}
else if (minuteCount == 185)
{
float lastPressureAvg = getLastPressureSamplesAverage();
float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
if (firstRound) // first time initial 3 hour
{
dP_dt = change / 3; // note this is for t = 3 hour
}
else
{
dP_dt = change / 4; // divide by 4 as this is the difference in time from 0 value
}
pressureAvg = pressureAvg2; // Equating the pressure at 0 to the pressure at 2 hour after 3 hours have past.
firstRound = false; // flag to let you know that this is on the past 3 hour mark. Initialized to 0 outside main loop.
}
int forecast = UNKNOWN;
if (minuteCount < 35 && firstRound) //if time is less than 35 min on the first 3 hour interval.
{
forecast = UNKNOWN;
}
else if (dP_dt < (-0.25))
{
forecast = THUNDERSTORM;
}
else if (dP_dt > 0.25)
{
forecast = UNSTABLE;
}
else if ((dP_dt > (-0.25)) && (dP_dt < (-0.05)))
{
forecast = CLOUDY;
}
else if ((dP_dt > 0.05) && (dP_dt < 0.25))
{
forecast = SUNNY;
}
else if ((dP_dt >(-0.05)) && (dP_dt < 0.05))
{
forecast = STABLE;
}
else
{
forecast = UNKNOWN;
}
// uncomment when debugging
//Serial.print(F("Forecast at minute "));
//Serial.print(minuteCount);
//Serial.print(F(" dP/dt = "));
//Serial.print(dP_dt);
//Serial.print(F("kPa/h --> "));
//Serial.println(weather[forecast]);
return forecast;
}


