From 00c60450c6de05e4ac646f551f9043b5c009227e Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 22 Mar 2023 13:25:55 +0100 Subject: [PATCH] Consolidate messages - Consolidate messages - Fix sen5x --- tasmota/include/i18n.h | 5 +- tasmota/language/af_AF.h | 4 + tasmota/language/bg_BG.h | 4 + tasmota/language/ca_AD.h | 4 + tasmota/language/cs_CZ.h | 4 + tasmota/language/de_DE.h | 4 + tasmota/language/el_GR.h | 4 + tasmota/language/en_GB.h | 4 + tasmota/language/es_ES.h | 4 + tasmota/language/fr_FR.h | 4 + tasmota/language/fy_NL.h | 4 + tasmota/language/he_HE.h | 4 + tasmota/language/hu_HU.h | 4 + tasmota/language/it_IT.h | 4 + tasmota/language/ko_KO.h | 4 + tasmota/language/nl_NL.h | 4 + tasmota/language/pl_PL.h | 4 + tasmota/language/pt_BR.h | 4 + tasmota/language/pt_PT.h | 4 + tasmota/language/ro_RO.h | 4 + tasmota/language/ru_RU.h | 4 + tasmota/language/sk_SK.h | 4 + tasmota/language/sv_SE.h | 4 + tasmota/language/tr_TR.h | 4 + tasmota/language/uk_UA.h | 4 + tasmota/language/vi_VN.h | 4 + tasmota/language/zh_CN.h | 4 + tasmota/language/zh_TW.h | 4 + tasmota/tasmota_support/support.ino | 53 ++-- .../tasmota_xsns_sensor/xsns_103_sen5x.ino | 252 +++++++----------- tasmota/tasmota_xsns_sensor/xsns_21_sgp30.ino | 2 - tasmota/tasmota_xsns_sensor/xsns_98_sgp40.ino | 2 - 32 files changed, 239 insertions(+), 183 deletions(-) diff --git a/tasmota/include/i18n.h b/tasmota/include/i18n.h index b867b3eca..e7fd64bef 100644 --- a/tasmota/include/i18n.h +++ b/tasmota/include/i18n.h @@ -895,6 +895,10 @@ const char HTTP_SNS_F_TEMP[] PROGMEM = "{s}%s " D_TEMPERATURE "{ const char HTTP_SNS_F_VOLTAGE[] PROGMEM = "{s}%s " D_VOLTAGE "{m}%*_f " D_UNIT_VOLT "{e}"; const char HTTP_SNS_F_CURRENT_MA[] PROGMEM = "{s}%s " D_CURRENT "{m}%*_f " D_UNIT_MILLIAMPERE "{e}"; const char HTTP_SNS_F_DISTANCE_CM[] PROGMEM = "{s}%s " D_DISTANCE "{m}%1_f " D_UNIT_CENTIMETER "{e}"; +const char HTTP_SNS_F_NOX[] PROGMEM = "{s}%s " D_NOX "{m}%*_f " "{e}"; +const char HTTP_SNS_F_VOC[] PROGMEM = "{s}%s " D_VOC "{m}%*_f " "{e}"; +const char HTTP_SNS_F_ABS_HUM[] PROGMEM = "{s}%s " D_ABSOLUTE_HUMIDITY "{m}%*_f " D_UNIT_GRAM_PER_CUBIC_METER "{e}"; + const char HTTP_SNS_HUM[] PROGMEM = "{s}%s " D_HUMIDITY "{m}%s " D_UNIT_PERCENT "{e}"; const char HTTP_SNS_DEW[] PROGMEM = "{s}%s " D_DEWPOINT "{m}%s " D_UNIT_DEGREE "%c{e}"; const char HTTP_SNS_PRESSURE[] PROGMEM = "{s}%s " D_PRESSURE "{m}%s " "%s{e}"; @@ -925,7 +929,6 @@ const char HTTP_SNS_GAS[] PROGMEM = "{s}%s " D_GAS "{ const char HTTP_SNS_SOC[] PROGMEM = "{s}%s " D_SOC "{m}%d " D_UNIT_PERCENT "{e}"; const char HTTP_SNS_SOH[] PROGMEM = "{s}%s " D_SOH "{m}%d " D_UNIT_PERCENT "{e}"; - const char HTTP_SNS_STANDARD_CONCENTRATION[] PROGMEM = "{s}%s " D_STANDARD_CONCENTRATION " %s " D_UNIT_MICROMETER "{m}%d " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}"; const char HTTP_SNS_ENVIRONMENTAL_CONCENTRATION[] PROGMEM = "{s}%s " D_ENVIRONMENTAL_CONCENTRATION " %s " D_UNIT_MICROMETER "{m}%d " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}"; const char HTTP_SNS_F_ENVIRONMENTAL_CONCENTRATION[] PROGMEM = "{s}%s " D_ENVIRONMENTAL_CONCENTRATION " %s " D_UNIT_MICROMETER "{m}%1_f " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}"; diff --git a/tasmota/language/af_AF.h b/tasmota/language/af_AF.h index 07875dc6b..d43a80bf6 100644 --- a/tasmota/language/af_AF.h +++ b/tasmota/language/af_AF.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "." // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Luggehalte" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "multi-press" #define D_NOISE "Geraas" #define D_NONE "Geen" +#define D_NOX "NOx" #define D_O2 "Suurstof" #define D_OFF "Uit" #define D_OFFLINE "Vanlyn" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "UV Level" #define D_UV_POWER "UV krag" #define D_VERSION "Weergawe" +#define D_VOC "VOC" #define D_VOLTAGE "Spanning" #define D_VOLUME "Volume" #define D_WEIGHT "Gewig" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/bg_BG.h b/tasmota/language/bg_BG.h index cf62b369c..97b7542a1 100644 --- a/tasmota/language/bg_BG.h +++ b/tasmota/language/bg_BG.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "," // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Качество на въздуха" #define D_AP "Точка за достъп" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "неколкократно натискане" #define D_NOISE "Шум" #define D_NONE "Няма" +#define D_NOX "NOx" #define D_O2 "Кислород" #define D_OFF "Изкл." #define D_OFFLINE "Извън мрежа" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "Ниво на UV" #define D_UV_POWER "Сила на UV" #define D_VERSION "Издание" +#define D_VOC "VOC" #define D_VOLTAGE "Напрежение" #define D_VOLUME "Обем" #define D_WEIGHT "Тегло" @@ -938,6 +941,7 @@ #define D_UNIT_GALLONS "гал" #define D_UNIT_GALLONS_PER_MIN "гал/мин" #define D_UNIT_KILOGRAM "кг" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "инч" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/ca_AD.h b/tasmota/language/ca_AD.h index 5b6d91022..5191a364b 100644 --- a/tasmota/language/ca_AD.h +++ b/tasmota/language/ca_AD.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "," // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Qualitat Aire" #define D_AP "PA" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "multi-pressió" #define D_NOISE "Soroll" #define D_NONE "Cap" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "Apagat" #define D_OFFLINE "Desconnectat" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "Nivell UV" #define D_UV_POWER "Potència UV" #define D_VERSION "Versió" +#define D_VOC "VOC" #define D_VOLTAGE "Tensió" #define D_VOLUME "Volum" #define D_WEIGHT "Pes" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/cs_CZ.h b/tasmota/language/cs_CZ.h index e94b5d5f3..a5ac51a55 100644 --- a/tasmota/language/cs_CZ.h +++ b/tasmota/language/cs_CZ.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "," // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Kvalita vzduchu" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "několikeré-stisknutí" #define D_NOISE "Hluk" #define D_NONE "Žádný" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "Vyp." #define D_OFFLINE "Offline" // Don't translate, LWT message! Nepředkládat, LWT zpráva! @@ -201,6 +203,7 @@ #define D_UV_LEVEL "úroveň UV" #define D_UV_POWER "UV Power" #define D_VERSION "Verze" +#define D_VOC "VOC" #define D_VOLTAGE "Napětí" #define D_VOLUME "Volume" #define D_WEIGHT "Hmotnost" @@ -938,6 +941,7 @@ #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_KILOGRAM "kg" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/de_DE.h b/tasmota/language/de_DE.h index 38d5581c8..6b635d872 100644 --- a/tasmota/language/de_DE.h +++ b/tasmota/language/de_DE.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "." // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Luftqualität" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "Mehrfachdruck" #define D_NOISE "Lautstärke" #define D_NONE "keine" +#define D_NOX "NOx" #define D_O2 "Sauerstoff" #define D_OFF "aus" #define D_OFFLINE "Offline" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "UV-Level" #define D_UV_POWER "UV Intensität" #define D_VERSION "Version" +#define D_VOC "VOC" #define D_VOLTAGE "Spannung" #define D_VOLUME "Volume" #define D_WEIGHT "Gewicht" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/el_GR.h b/tasmota/language/el_GR.h index 0cd51bb00..1b3cfc492 100644 --- a/tasmota/language/el_GR.h +++ b/tasmota/language/el_GR.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "," // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Διαχειριστής" #define D_AIR_QUALITY "Ποιότητα αέρα" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "ανίχνευση για πολλαπλά πατήματα" #define D_NOISE "Θόρυβος" #define D_NONE "Κανένα" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "Off" #define D_OFFLINE "Offline" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "Επίπεδο UV" #define D_UV_POWER "Ένταση UV" #define D_VERSION "Έκδοση" +#define D_VOC "VOC" #define D_VOLTAGE "Τάση" #define D_VOLUME "Volume" #define D_WEIGHT "Βάρος" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/en_GB.h b/tasmota/language/en_GB.h index 04c9b5bef..8c54a340f 100644 --- a/tasmota/language/en_GB.h +++ b/tasmota/language/en_GB.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "." // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Air quality" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "multi-press" #define D_NOISE "Noise" #define D_NONE "None" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "Off" #define D_OFFLINE "Offline" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "UV Level" #define D_UV_POWER "UV Power" #define D_VERSION "Version" +#define D_VOC "VOC" #define D_VOLTAGE "Voltage" #define D_VOLUME "Volume" #define D_WEIGHT "Weight" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/es_ES.h b/tasmota/language/es_ES.h index dd18ce59d..2948c9f05 100644 --- a/tasmota/language/es_ES.h +++ b/tasmota/language/es_ES.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "," // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Calidad del Aire" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "multi-press" #define D_NOISE "Ruido" #define D_NONE "Ninguno" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "Apagado" #define D_OFFLINE "Offline" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "Nivel UV" #define D_UV_POWER "UV Power" #define D_VERSION "Versión" +#define D_VOC "VOC" #define D_VOLTAGE "Tensión" #define D_VOLUME "Volumen" #define D_WEIGHT "Peso" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/fr_FR.h b/tasmota/language/fr_FR.h index 0805fca30..7e1363747 100644 --- a/tasmota/language/fr_FR.h +++ b/tasmota/language/fr_FR.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "," // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Qualité de l'Air" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "multi-pression" #define D_NOISE "Bruit" #define D_NONE "Aucun" +#define D_NOX "NOx" #define D_O2 "Oxygène" #define D_OFF "Arrêt" #define D_OFFLINE "Déconnecté" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "Niveau UV" #define D_UV_POWER "Puissance UV" #define D_VERSION "Version" +#define D_VOC "VOC" #define D_VOLTAGE "Tension" #define D_VOLUME "Volume" #define D_WEIGHT "Poids" @@ -938,6 +941,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "gal/min" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/fy_NL.h b/tasmota/language/fy_NL.h index f8169a531..6eb6e6c24 100644 --- a/tasmota/language/fy_NL.h +++ b/tasmota/language/fy_NL.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "," // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Luchtkwaliteit" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "meardere" #define D_NOISE "Lûd" #define D_NONE "Gjin" +#define D_NOX "NOx" #define D_O2 "Soerstof" #define D_OFF "Ut" #define D_OFFLINE "Offline" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "UV peil" #define D_UV_POWER "UV yntinsiteit" #define D_VERSION "Ferzje" +#define D_VOC "VOC" #define D_VOLTAGE "Foltaazje" #define D_VOLUME "Folume" #define D_WEIGHT "Gewicht" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/he_HE.h b/tasmota/language/he_HE.h index e22418ce8..edf429bf6 100644 --- a/tasmota/language/he_HE.h +++ b/tasmota/language/he_HE.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "." // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "מנהל" #define D_AIR_QUALITY "איכות אוויר" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "לחיצה מרובה" #define D_NOISE "רעש" #define D_NONE "כלום" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "כבוי" #define D_OFFLINE "מנותק" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "UV רמת" #define D_UV_POWER "UV Power" #define D_VERSION "גרסה" +#define D_VOC "VOC" #define D_VOLTAGE "מתח" #define D_VOLUME "Volume" #define D_WEIGHT "משקל" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/hu_HU.h b/tasmota/language/hu_HU.h index 2683f7d0c..80a9041ec 100644 --- a/tasmota/language/hu_HU.h +++ b/tasmota/language/hu_HU.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "." // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Levegőminőség" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "többes lenyomás" #define D_NOISE "Zaj" #define D_NONE "nincs" +#define D_NOX "NOx" #define D_O2 "Oxygén" #define D_OFF "Ki" #define D_OFFLINE "Offline" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "UV szint" #define D_UV_POWER "UV teljesítmény" #define D_VERSION "Verzió" +#define D_VOC "VOC" #define D_VOLTAGE "Feszültség" #define D_VOLUME "Volume" #define D_WEIGHT "Tömeg" @@ -940,6 +943,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "növ." #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/it_IT.h b/tasmota/language/it_IT.h index 66d3154cd..0cf14a3b1 100644 --- a/tasmota/language/it_IT.h +++ b/tasmota/language/it_IT.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "." // Common +#define D_ABSOLUTE_HUMIDITY "Abs Umidità" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Qualità dell'aria" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "multi-pressione" #define D_NOISE "Rumore" #define D_NONE "Nessuno" +#define D_NOX "NOx" #define D_O2 "Ossigeno" #define D_OFF "OFF" #define D_OFFLINE "Offline" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "Livello UV" #define D_UV_POWER "Intensità UV" #define D_VERSION "Versione" +#define D_VOC "VOC" #define D_VOLTAGE "Tensione" #define D_VOLUME "Volume" #define D_WEIGHT "Peso" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "o" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/ko_KO.h b/tasmota/language/ko_KO.h index 11a775dc7..9e06ed6a5 100644 --- a/tasmota/language/ko_KO.h +++ b/tasmota/language/ko_KO.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "." // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "공기질" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "multi-press" #define D_NOISE "소음" #define D_NONE "없음" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "꺼짐" #define D_OFFLINE "오프라인" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "UV 레벨" #define D_UV_POWER "UV 파워" #define D_VERSION "버전" +#define D_VOC "VOC" #define D_VOLTAGE "전압" #define D_VOLUME "Volume" #define D_WEIGHT "무게" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "시" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/nl_NL.h b/tasmota/language/nl_NL.h index 3ede2ee6f..542f3f04a 100644 --- a/tasmota/language/nl_NL.h +++ b/tasmota/language/nl_NL.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "," // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Lucht kwaliteit" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "meervoudig" #define D_NOISE "Lawaai" #define D_NONE "Geen" +#define D_NOX "NOx" #define D_O2 "Zuurstof" #define D_OFF "Uit" #define D_OFFLINE "Offline" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "UV niveau" #define D_UV_POWER "UV intensiteit" #define D_VERSION "Versie" +#define D_VOC "VOC" #define D_VOLTAGE "Spanning" #define D_VOLUME "Volume" #define D_WEIGHT "Gewicht" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/pl_PL.h b/tasmota/language/pl_PL.h index 214628a97..61621be08 100644 --- a/tasmota/language/pl_PL.h +++ b/tasmota/language/pl_PL.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "," // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Jakość powietrza" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "Wielokrotne naciśnięcie" #define D_NOISE "Szum" #define D_NONE "Brak" +#define D_NOX "NOx" #define D_O2 "Tlen" #define D_OFF "Wyłączony" #define D_OFFLINE "Nieaktywny" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "Poziom UV" #define D_UV_POWER "Moc UV" #define D_VERSION "Wersja" +#define D_VOC "VOC" #define D_VOLTAGE "Napięcie" #define D_VOLUME "Pojemność" #define D_WEIGHT "Waga" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "Godz" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/pt_BR.h b/tasmota/language/pt_BR.h index 5e4259319..453527b5e 100644 --- a/tasmota/language/pt_BR.h +++ b/tasmota/language/pt_BR.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "," // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Qualidade do ar" #define D_AP "Ponto de acesso" // Ponto de Acesso @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "multi-pressão" #define D_NOISE "Ruído" #define D_NONE "Nenhum" +#define D_NOX "NOx" #define D_O2 "Oxigênio" #define D_OFF "Desligado" #define D_OFFLINE "Desconectado" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "Nível UV" #define D_UV_POWER "Potência UV" #define D_VERSION "Versão" +#define D_VOC "VOC" #define D_VOLTAGE "Voltagem" #define D_VOLUME "Volume" #define D_WEIGHT "Peso" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "H" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/pt_PT.h b/tasmota/language/pt_PT.h index f04c5992e..732d3ef13 100644 --- a/tasmota/language/pt_PT.h +++ b/tasmota/language/pt_PT.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "." // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Qualidade do Ar" #define D_AP "AP" // Ponto de Acesso @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "multi-pressão" #define D_NOISE "Ruído" #define D_NONE "Nenhum" +#define D_NOX "NOx" #define D_O2 "Oxigénio" #define D_OFF "Off" #define D_OFFLINE "Desconetado" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "Nível UV" #define D_UV_POWER "Poder UV" #define D_VERSION "Versão" +#define D_VOC "VOC" #define D_VOLTAGE "Voltagem" #define D_VOLUME "Volume" #define D_WEIGHT "Peso" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/ro_RO.h b/tasmota/language/ro_RO.h index 51c55c0b1..e9611361a 100644 --- a/tasmota/language/ro_RO.h +++ b/tasmota/language/ro_RO.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "." // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Calitatea aerului" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "selectare multiplă" #define D_NOISE "Zgomot" #define D_NONE "Lipsă" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "Închis" #define D_OFFLINE "Offline" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "Nivel UV" #define D_UV_POWER "Putere UV" #define D_VERSION "Versiune" +#define D_VOC "VOC" #define D_VOLTAGE "Voltaj" #define D_VOLUME "Volume" #define D_WEIGHT "Greutate" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/ru_RU.h b/tasmota/language/ru_RU.h index 672df0a48..29d8591b0 100644 --- a/tasmota/language/ru_RU.h +++ b/tasmota/language/ru_RU.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "," // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Качество воздуха" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "многократное нажатие" #define D_NOISE "Шум" #define D_NONE "Нет" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "Выкл" #define D_OFFLINE "Офф-лайн" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "УФ уровень" #define D_UV_POWER "UV Power" #define D_VERSION "Версия" +#define D_VOC "VOC" #define D_VOLTAGE "Напряжение" #define D_VOLUME "Volume" #define D_WEIGHT "Weight" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "Ч" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/sk_SK.h b/tasmota/language/sk_SK.h index 1d8818f9c..f89cfd90d 100644 --- a/tasmota/language/sk_SK.h +++ b/tasmota/language/sk_SK.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "," // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Kvalita vzduchu" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "multi-stlačenie" #define D_NOISE "Hluk" #define D_NONE "Žiadny" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "Vyp." #define D_OFFLINE "Neaktívny" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "úroveň UV" #define D_UV_POWER "UV Power" #define D_VERSION "Verzia" +#define D_VOC "VOC" #define D_VOLTAGE "Napätie" #define D_VOLUME "Volume" #define D_WEIGHT "Hmotnosť" @@ -938,6 +941,7 @@ #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_KILOGRAM "kg" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/sv_SE.h b/tasmota/language/sv_SE.h index 2b6161647..556335dcd 100644 --- a/tasmota/language/sv_SE.h +++ b/tasmota/language/sv_SE.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "," // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Luftkvalitet" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "fler tryck" #define D_NOISE "Oväsen" #define D_NONE "Ingen" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "Av" #define D_OFFLINE "Off-line" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "UV nivå" #define D_UV_POWER "UV kraft" #define D_VERSION "Version" +#define D_VOC "VOC" #define D_VOLTAGE "Volttal" #define D_VOLUME "Volume" #define D_WEIGHT "Vikt" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "Tim" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "ink" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/tr_TR.h b/tasmota/language/tr_TR.h index bb985fe59..e58e22682 100644 --- a/tasmota/language/tr_TR.h +++ b/tasmota/language/tr_TR.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "." // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Hava Kalitesi" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "multi-press" #define D_NOISE "Noise" #define D_NONE "None" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "Off" #define D_OFFLINE "Çevirimdışı" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "UV Seviyesi" #define D_UV_POWER "UV Power" #define D_VERSION "Versiyon" +#define D_VOC "VOC" #define D_VOLTAGE "Voltaj" #define D_VOLUME "Volume" #define D_WEIGHT "Weight" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/uk_UA.h b/tasmota/language/uk_UA.h index e19dd746b..6b5a3215f 100644 --- a/tasmota/language/uk_UA.h +++ b/tasmota/language/uk_UA.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "," // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Адміністратор" #define D_AIR_QUALITY "Якість повітря" #define D_AP "Точка доступу" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "Багаторазове натискання" #define D_NOISE "Шум" #define D_NONE "Нічого" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "Вимкнено" #define D_OFFLINE "Неактивний" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "Рівень УФ" #define D_UV_POWER "Потужність УФ" #define D_VERSION "Версія" +#define D_VOC "VOC" #define D_VOLTAGE "Напруга" #define D_VOLUME "Volume" #define D_WEIGHT "Вага" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "г" #define D_UNIT_GALLONS "гал" #define D_UNIT_GALLONS_PER_MIN "гал/хв" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "інк" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/vi_VN.h b/tasmota/language/vi_VN.h index 1306a01fb..06094ac7d 100644 --- a/tasmota/language/vi_VN.h +++ b/tasmota/language/vi_VN.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "." // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Quản trị" #define D_AIR_QUALITY "Chất lượng không khí" #define D_AP "Mạng wifi" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "bấm nhiều lần" #define D_NOISE "Nhiễu" #define D_NONE "Không" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "Tắt" #define D_OFFLINE "Ngoại tuyến" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "Mức độ UV" #define D_UV_POWER "Công suất UV" #define D_VERSION "Phiên bản" +#define D_VOC "VOC" #define D_VOLTAGE "Điện áp" #define D_VOLUME "Volume" #define D_WEIGHT "Cân nặng" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "h" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/zh_CN.h b/tasmota/language/zh_CN.h index 2ef25fde3..36c35734c 100644 --- a/tasmota/language/zh_CN.h +++ b/tasmota/language/zh_CN.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "." // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "空气质量" #define D_AP "AP" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "多次按键" #define D_NOISE "嘈杂" #define D_NONE "无" +#define D_NOX "NOx" #define D_O2 "氧" #define D_OFF "关" #define D_OFFLINE "离线" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "紫外线水平" #define D_UV_POWER "紫外线功率 " #define D_VERSION "版本" +#define D_VOC "VOC" #define D_VOLTAGE "电压" #define D_VOLUME "Volume" #define D_WEIGHT "重量" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "小时" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/language/zh_TW.h b/tasmota/language/zh_TW.h index 247ad088d..764eff731 100644 --- a/tasmota/language/zh_TW.h +++ b/tasmota/language/zh_TW.h @@ -51,6 +51,7 @@ #define D_DECIMAL_SEPARATOR "." // Common +#define D_ABSOLUTE_HUMIDITY "Abs Humidity" #define D_ADMIN "Admin" #define D_AIR_QUALITY "空氣品質" #define D_AP "存取點" // Access Point @@ -133,6 +134,7 @@ #define D_MULTI_PRESS "多重點擊" #define D_NOISE "雜訊" #define D_NONE "無" +#define D_NOX "NOx" #define D_O2 "Oxygen" #define D_OFF "關閉" #define D_OFFLINE "離線" @@ -201,6 +203,7 @@ #define D_UV_LEVEL "紫外線等級" #define D_UV_POWER "紫外線能量" #define D_VERSION "版本" +#define D_VOC "VOC" #define D_VOLTAGE "電壓" #define D_VOLUME "Volume" #define D_WEIGHT "重量" @@ -937,6 +940,7 @@ #define D_UNIT_HOUR "時" #define D_UNIT_GALLONS "gal" #define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_GRAM_PER_CUBIC_METER "g/m³" #define D_UNIT_INCH_MERCURY "inHg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KELVIN "K" diff --git a/tasmota/tasmota_support/support.ino b/tasmota/tasmota_support/support.ino index d39d2b8bb..1452a7fab 100755 --- a/tasmota/tasmota_support/support.ino +++ b/tasmota/tasmota_support/support.ino @@ -789,35 +789,38 @@ char* GetPowerDevice(char* dest, uint32_t idx, size_t size) return GetPowerDevice(dest, idx, size, 0); } -float ConvertTempToFahrenheit(float c) { - float result = c; +float ConvertTempToFahrenheit(float tc) { + if (isnan(tc)) { return NAN; } - if (!isnan(c) && Settings->flag.temperature_conversion) { // SetOption8 - Switch between Celsius or Fahrenheit - result = c * 1.8f + 32; // Fahrenheit + float result = tc; + if (Settings->flag.temperature_conversion) { // SetOption8 - Switch between Celsius or Fahrenheit + result = tc * 1.8f + 32; // Fahrenheit } result = result + (0.1f * Settings->temp_comp); return result; } -float ConvertTempToCelsius(float c) { - float result = c; - if (!isnan(c) && Settings->flag.temperature_conversion) { // SetOption8 - Switch between Celsius or Fahrenheit - result = (c - 32) / 1.8f; // Celsius +float ConvertTempToCelsius(float tf) { + if (isnan(tf)) { return NAN; } + + float result = tf; + if (Settings->flag.temperature_conversion) { // SetOption8 - Switch between Celsius or Fahrenheit + result = (tf - 32) / 1.8f; // Celsius } return result; } -void UpdateGlobalTemperature(float c) { +void UpdateGlobalTemperature(float t) { if (!Settings->global_sensor_index[0] && !TasmotaGlobal.user_globals[0]) { TasmotaGlobal.global_update = TasmotaGlobal.uptime; - TasmotaGlobal.temperature_celsius = c; + TasmotaGlobal.temperature_celsius = t; } } -float ConvertTemp(float c) { - UpdateGlobalTemperature(c); +float ConvertTemp(float t) { + UpdateGlobalTemperature(t); - return ConvertTempToFahrenheit(c); + return ConvertTempToFahrenheit(t); } char TempUnit(void) { @@ -842,18 +845,38 @@ float CalcTempHumToDew(float t, float h) { if (isnan(h) || isnan(t)) { return NAN; } if (Settings->flag.temperature_conversion) { // SetOption8 - Switch between Celsius or Fahrenheit - t = (t - 32) / 1.8f; // Celsius + t = (t - 32) / 1.8f; // Celsius } float gamma = TaylorLog(h / 100) + 17.62f * t / (243.5f + t); float result = (243.5f * gamma / (17.62f - gamma)); if (Settings->flag.temperature_conversion) { // SetOption8 - Switch between Celsius or Fahrenheit - result = result * 1.8f + 32; // Fahrenheit + result = result * 1.8f + 32; // Fahrenheit } return result; } +float CalcTempHumToAbsHum(float t, float h) { + if (isnan(t) || isnan(h)) { return NAN; } + // taken from https://carnotcycle.wordpress.com/2012/08/04/how-to-convert-relative-humidity-to-absolute-humidity/ + // precision is about 0.1°C in range -30 to 35°C + // August-Roche-Magnus 6.1094 exp(17.625 x T)/(T + 243.04) + // Buck (1981) 6.1121 exp(17.502 x T)/(T + 240.97) + // reference https://www.eas.ualberta.ca/jdwilson/EAS372_13/Vomel_CIRES_satvpformulae.html + + if (Settings->flag.temperature_conversion) { // SetOption8 - Switch between Celsius or Fahrenheit + t = (t - 32) / 1.8f; // Celsius + } + + float temp = FastPrecisePow(2.718281828f, (17.67f * t) / (t + 243.5f)); + + const float mw = 18.01534f; // Molar mass of water g/mol + const float r = 8.31447215f; // Universal gas constant J/mol/K +// return (6.112 * temp * h * 2.1674) / (273.15 + t); // Simplified version + return (6.112f * temp * h * mw) / ((273.15f + t) * r); // Long version +} + float ConvertHgToHpa(float p) { // Convert mmHg (or inHg) to hPa float result = p; diff --git a/tasmota/tasmota_xsns_sensor/xsns_103_sen5x.ino b/tasmota/tasmota_xsns_sensor/xsns_103_sen5x.ino index 1f4aa2659..25cb07d37 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_103_sen5x.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_103_sen5x.ino @@ -38,7 +38,6 @@ SensirionI2CSen5x *sen5x = nullptr; struct SEN5XDATA_s { - bool sen5x_ready; float massConcentrationPm1p0; float massConcentrationPm2p5; float massConcentrationPm4p0; @@ -48,100 +47,62 @@ struct SEN5XDATA_s { float vocIndex; float noxIndex; } *SEN5XDATA = nullptr; + /********************************************************************************************/ -void sen5x_Init(void) -{ - if(!TasmotaGlobal.i2c_enabled){ - DEBUG_SENSOR_LOG(PSTR("I2C Not enabled, so not loading SEN5X driver.")); - return; - } +void sen5x_Init(void) { int usingI2cBus = 0; #ifdef ESP32 - if (!I2cSetDevice(SEN5X_ADDRESS, 0)) - { + if (!I2cSetDevice(SEN5X_ADDRESS, 0)) { DEBUG_SENSOR_LOG(PSTR("Sensirion SEN5X not found, i2c bus 0")); - if (TasmotaGlobal.i2c_enabled_2 ){ - - if(!I2cSetDevice(SEN5X_ADDRESS, 1)){ + if (TasmotaGlobal.i2c_enabled_2 ) { + if(!I2cSetDevice(SEN5X_ADDRESS, 1)) { DEBUG_SENSOR_LOG(PSTR("Sensirion SEN5X not found, i2c bus 1")); return; } usingI2cBus = 1; - } - else { + } else { return; } } #else - if (!I2cSetDevice(SEN5X_ADDRESS)) - { + if (!I2cSetDevice(SEN5X_ADDRESS)) { DEBUG_SENSOR_LOG(PSTR("Sensirion SEN5X not found, i2c bus 0")); return; } #endif - if (SEN5XDATA == nullptr) - SEN5XDATA = (SEN5XDATA_s *)calloc(1, sizeof(struct SEN5XDATA_s)); - SEN5XDATA->sen5x_ready = false; - if(sen5x == nullptr) sen5x = new SensirionI2CSen5x(); - if(usingI2cBus==1){ + + sen5x = new SensirionI2CSen5x(); + if (1 == usingI2cBus) { #ifdef ESP32 sen5x->begin(Wire1); #else sen5x->begin(Wire); #endif - } + } else { sen5x->begin(Wire); - } + } int error_stop = sen5x->deviceReset(); - if (error_stop != 0) - { + if (error_stop != 0) { DEBUG_SENSOR_LOG(PSTR("Sensirion SEN5X failed to reset device (I2C Bus %d)"), usingI2cBus); return; } // Wait 1 second for sensors to start recording + 100ms for reset command delay(1100); int error_start = sen5x->startMeasurement(); - if (error_start != 0) - { + if (error_start != 0) { DEBUG_SENSOR_LOG(PSTR("Sensirion SEN5X failed to start measurement (I2C Bus %d)"), usingI2cBus); return; } - SEN5XDATA->sen5x_ready = true; + + SEN5XDATA = (SEN5XDATA_s *)calloc(1, sizeof(struct SEN5XDATA_s)); I2cSetActiveFound(SEN5X_ADDRESS, "SEN5X", usingI2cBus); - DEBUG_SENSOR_LOG(PSTR("Sensirion SEN5X found, i2c bus %d"), usingI2cBus); -} - -// #define POW_FUNC pow -#define POW_FUNC FastPrecisePow - -float sen5x_AbsoluteHumidity(float temperature, float humidity) -{ - // taken from https://carnotcycle.wordpress.com/2012/08/04/how-to-convert-relative-humidity-to-absolute-humidity/ - // precision is about 0.1°C in range -30 to 35°C - // August-Roche-Magnus 6.1094 exp(17.625 x T)/(T + 243.04) - // Buck (1981) 6.1121 exp(17.502 x T)/(T + 240.97) - // reference https://www.eas.ualberta.ca/jdwilson/EAS372_13/Vomel_CIRES_satvpformulae.html - float temp = NAN; - const float mw = 18.01534f; // molar mass of water g/mol - const float r = 8.31447215f; // Universal gas constant J/mol/K - - if (isnan(temperature) || isnan(humidity)) - { - return NAN; - } - - temp = POW_FUNC(2.718281828f, (17.67f * temperature) / (temperature + 243.5f)); - - // return (6.112 * temp * humidity * 2.1674) / (273.15 + temperature); //simplified version - return (6.112f * temp * humidity * mw) / ((273.15f + temperature) * r); // long version } #define SAVE_PERIOD 30 -void SEN5XUpdate(void) // Perform every second to ensure proper operation of the baseline compensation algorithm -{ +void SEN5XUpdate(void) { // Perform every second to ensure proper operation of the baseline compensation algorithm uint16_t error; char errorMessage[256]; DEBUG_SENSOR_LOG(PSTR("Running readMeasuredValues for SEN5X...")); @@ -151,118 +112,90 @@ void SEN5XUpdate(void) // Perform every second to ensure proper operation of the SEN5XDATA->massConcentrationPm10p0, SEN5XDATA->ambientHumidity, SEN5XDATA->ambientTemperature, SEN5XDATA->vocIndex, SEN5XDATA->noxIndex); - if (error) - { - AddLog(LOG_LEVEL_DEBUG, PSTR("Failed to retrieve SEN5X readings.")); - #ifdef DEBUG_TASMOTA_SENSOR - DEBUG_SENSOR_LOG(PSTR("Error trying to execute readMeasuredValues(): \n")); + if (error) { + AddLog(LOG_LEVEL_DEBUG, PSTR("S5X: Failed to retrieve readings")); +#ifdef DEBUG_TASMOTA_SENSOR + DEBUG_SENSOR_LOG(PSTR("Error trying to execute readMeasuredValues():")); errorToString(error, errorMessage, 256); DEBUG_SENSOR_LOG(errorMessage); - #endif - } - else - { -#ifdef DEBUG_TASMOTA_SENSOR + } else { DEBUG_SENSOR_LOG(PSTR("SEN5x readings:-")); - DEBUG_SENSOR_LOG(PSTR("MassConcentrationPm1p0: %1_f\n"), &SEN5XDATA->massConcentrationPm1p0); - DEBUG_SENSOR_LOG(PSTR("MassConcentrationPm2p5: %1_f\n"), &SEN5XDATA->massConcentrationPm2p5); - DEBUG_SENSOR_LOG(PSTR("MassConcentrationPm4p0: %1_f\n"), &SEN5XDATA->massConcentrationPm4p0); - DEBUG_SENSOR_LOG(PSTR("MassConcentrationPm10p0: %1_f\n"), &SEN5XDATA->massConcentrationPm10p0); - if (isnan(SEN5XDATA->ambientHumidity)) - { - DEBUG_SENSOR_LOG(PSTR("AmbientHumidity: n/a\n")); - } - else - { - DEBUG_SENSOR_LOG(PSTR("AmbientHumidity: %*_f\n"), 2, &SEN5XDATA->ambientHumidity); + DEBUG_SENSOR_LOG(PSTR("MassConcentrationPm1p0: %1_f"), &SEN5XDATA->massConcentrationPm1p0); + DEBUG_SENSOR_LOG(PSTR("MassConcentrationPm2p5: %1_f"), &SEN5XDATA->massConcentrationPm2p5); + DEBUG_SENSOR_LOG(PSTR("MassConcentrationPm4p0: %1_f"), &SEN5XDATA->massConcentrationPm4p0); + DEBUG_SENSOR_LOG(PSTR("MassConcentrationPm10p0: %1_f"), &SEN5XDATA->massConcentrationPm10p0); + if (isnan(SEN5XDATA->ambientHumidity)) { + DEBUG_SENSOR_LOG(PSTR("AmbientHumidity: n/a")); + } else { + DEBUG_SENSOR_LOG(PSTR("AmbientHumidity: %*_f"), 2, &SEN5XDATA->ambientHumidity); } - if (isnan(SEN5XDATA->ambientTemperature)) - { - DEBUG_SENSOR_LOG(PSTR("AmbientTemperature: n/a\n")); + if (isnan(SEN5XDATA->ambientTemperature)) { + DEBUG_SENSOR_LOG(PSTR("AmbientTemperature: n/a")); + } else { + DEBUG_SENSOR_LOG(PSTR("AmbientTemperature: %*_f"), 2, &SEN5XDATA->ambientTemperature); } - else - { - DEBUG_SENSOR_LOG(PSTR("AmbientTemperature: %*_f\n"), 2, &SEN5XDATA->ambientTemperature); + + if (isnan(SEN5XDATA->vocIndex)) { + DEBUG_SENSOR_LOG(PSTR("VocIndex: n/a")); + } else { + DEBUG_SENSOR_LOG(PSTR("VocIndex: %*_f"), 0, &SEN5XDATA->vocIndex); } - - if (isnan(SEN5XDATA->vocIndex)) - { - DEBUG_SENSOR_LOG(PSTR("VocIndex: n/a\n")); - } - else - { - DEBUG_SENSOR_LOG(PSTR("VocIndex: %*_f\n"), 0, &SEN5XDATA->vocIndex); - } - - if (isnan(SEN5XDATA->noxIndex)) - { - DEBUG_SENSOR_LOG(PSTR("NoxIndex: n/a\n")); - } - else - { - DEBUG_SENSOR_LOG(PSTR("NoxIndex: %*_f\n"), 0, &SEN5XDATA->noxIndex); + + if (isnan(SEN5XDATA->noxIndex)) { + DEBUG_SENSOR_LOG(PSTR("NoxIndex: n/a")); + } else { + DEBUG_SENSOR_LOG(PSTR("NoxIndex: %*_f"), 0, &SEN5XDATA->noxIndex); } #endif } } -#ifdef USE_WEBSERVER -const char HTTP_SNS_SEN5X_UNITS[] PROGMEM = "{s}SEN5X %s{m}%*_f %s{e}"; -const char HTTP_SNS_SEN5X_UNITLESS[] PROGMEM = "{s}SEN5X %s{m}%*_f{e}"; -// {s} =