From 0bba4dc7d695aef8fb24ccd73f2759c29abfeab9 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 20 Feb 2021 17:26:09 +0100 Subject: [PATCH 1/2] Fix compile error --- tasmota/xsns_37_rfsensor.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/xsns_37_rfsensor.ino b/tasmota/xsns_37_rfsensor.ino index 424928a4a..3b469b2b5 100644 --- a/tasmota/xsns_37_rfsensor.ino +++ b/tasmota/xsns_37_rfsensor.ino @@ -272,7 +272,7 @@ void RfSnsTheoV2Show(bool json) sensor, GetDT(rfsns_theo_v2_t1[i].time).c_str(), voltage); } } else { - float temp = ConvertTemp((float)rfsns_theo_v2_t1[i].temp / 100) + float temp = ConvertTemp((float)rfsns_theo_v2_t1[i].temp / 100); if (json) { ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_TEMPERATURE "\":%*_f,\"" D_JSON_ILLUMINANCE "\":%d,\"" D_JSON_VOLTAGE "\":%s}"), From ca5ab2d09449a1c4797bd6e2f8ef5875d5888750 Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Sat, 20 Feb 2021 17:32:01 +0100 Subject: [PATCH 2/2] send mqtt only on valid data --- tasmota/xsns_53_sml.ino | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tasmota/xsns_53_sml.ino b/tasmota/xsns_53_sml.ino index 878001ed4..e7d291a98 100755 --- a/tasmota/xsns_53_sml.ino +++ b/tasmota/xsns_53_sml.ino @@ -465,6 +465,7 @@ double meter_vars[SML_MAX_VARS]; double dvalues[MAX_DVARS]; uint32_t dtimes[MAX_DVARS]; uint8_t meters_used; +uint8_t dvalid[SML_MAX_VARS]; struct METER_DESC const *meter_desc_p; const uint8_t *meter_p; @@ -494,6 +495,7 @@ char meter_id[MAX_METERS][METER_ID_SIZE]; uint8_t sml_send_blocks; uint8_t sml_100ms_cnt; uint8_t sml_desc_cnt; +uint8_t sml_json_enable = 1; #ifdef USE_SML_MEDIAN_FILTER // median filter, should be odd size @@ -1621,6 +1623,7 @@ void SML_Decode(uint8_t index) { #else meter_vars[vindex]=dval; #endif + dvalid[vindex] = 1; //AddLog_P(LOG_LEVEL_INFO, PSTR(">> %s"),mp); // get scaling factor double fac=CharToDouble((char*)mp); @@ -1779,6 +1782,8 @@ void SML_Show(boolean json) { dtostrfd(meter_vars[index],dp,tpowstr); } + if (!dvalid[index]) nojson = 1; + if (json) { // json export if (index==0) { @@ -1953,6 +1958,7 @@ void SML_Init(void) { for (uint32_t cnt=0;cnt