Заставляем датчики теперь сохранять свои показания в структурной переменной для доступа к данным из сценариев в любое время

This commit is contained in:
2022-02-14 17:23:39 +03:00
parent fbec3827e2
commit da845b7ecb
5 changed files with 24 additions and 24 deletions

View File

@@ -24,8 +24,8 @@ class Dht1122t : public IoTItem {
}
void doByInterval() {
float value = _dht->getTemperature();
if (String(value) != "nan") regEvent(value, "Dht1122t");
value.valD = _dht->getTemperature();
if (String(value.valD) != "nan") regEvent(value.valD, "Dht1122t");
else SerialPrint("E", "Sensor DHTt", "Error");
}
@@ -43,8 +43,8 @@ class Dht1122h : public IoTItem {
}
void doByInterval() {
float value = _dht->getHumidity();
if (String(value) != "nan") regEvent(value, "Dht1122h");
value.valD = _dht->getHumidity();
if (String(value.valD) != "nan") regEvent(value.valD, "Dht1122h");
else SerialPrint("E", "Sensor DHTh", "Error");
}