From 8e4b91837b3ffa16913bd2ed0f2a2391a5d571e4 Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Wed, 18 Sep 2019 18:54:28 +0200 Subject: [PATCH] fix sgp30 --- sonoff/xsns_21_sgp30.ino | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sonoff/xsns_21_sgp30.ino b/sonoff/xsns_21_sgp30.ino index 356c690b8..a8b047715 100644 --- a/sonoff/xsns_21_sgp30.ino +++ b/sonoff/xsns_21_sgp30.ino @@ -124,14 +124,11 @@ void Sgp30Show(bool json) if (sgp30_ready) { char abs_hum[33]; - if (global_update && global_humidity>0 && global_temperature!=9999) { - // has humidity + temperature - dtostrfd(sgp30_abshum,4,abs_hum); - } - if (json) { ResponseAppend_P(PSTR(",\"SGP30\":{\"" D_JSON_ECO2 "\":%d,\"" D_JSON_TVOC "\":%d"), sgp.eCO2, sgp.TVOC); - if (global_update) { + if (global_update) && global_humidity>0 && global_temperature!=9999) { + // has humidity + temperature + dtostrfd(sgp30_abshum,4,abs_hum); ResponseAppend_P(PSTR(",\"" D_JSON_AHUM "\":%s"),abs_hum); } ResponseJsonEnd();