diff --git a/sonoff/language/de-DE.h b/sonoff/language/de-DE.h
index fde844b8b..7a2a169b2 100644
--- a/sonoff/language/de-DE.h
+++ b/sonoff/language/de-DE.h
@@ -42,7 +42,7 @@
#define D_HOUR_MINUTE_SEPARATOR ":"
#define D_MINUTE_SECOND_SEPARATOR ":"
-#define D_DAY3LIST "SonMonDieMitDonFriSam"
+#define D_DAY3LIST "So Mo Di Mi Do Fr Sa "
#define D_MONTH3LIST "JanFebMärAprMaiJunJulAugSepOktNovDez"
// Non JSON decimal separator
diff --git a/sonoff/settings.h b/sonoff/settings.h
index d9c53a4bc..e9fe0f296 100644
--- a/sonoff/settings.h
+++ b/sonoff/settings.h
@@ -258,7 +258,7 @@ struct SYSCFG {
byte free_6b8[72]; // 6B8
- char rules[256]; // 700
+ char rules[MAX_RULE_SIZE]; // 700
// 800 - FFF free locations
} Settings;
diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h
index 0869c6929..279c1652d 100644
--- a/sonoff/sonoff.h
+++ b/sonoff/sonoff.h
@@ -48,6 +48,7 @@ typedef unsigned long power_t; // Power (Relay) type
#define MAX_FRIENDLYNAMES 4 // Max number of Friendly names
#define MAX_DOMOTICZ_IDX 4 // Max number of Domoticz device, key and switch indices
#define MAX_DOMOTICZ_SNS_IDX 12 // Max number of Domoticz sensors indices
+#define MAX_RULE_SIZE 256 // Max number of characters in rules
#define MODULE SONOFF_BASIC // [Module] Select default model
@@ -163,7 +164,9 @@ enum LichtSubtypes {LST_NONE, LST_SINGLE, LST_COLDWARM, LST_RGB, LST_RGBW, LST_R
enum LichtSchemes {LS_POWER, LS_WAKEUP, LS_CYCLEUP, LS_CYCLEDN, LS_RANDOM, LS_MAX};
enum XsnsFunctions {FUNC_INIT, FUNC_LOOP, FUNC_EVERY_50_MSECOND, FUNC_EVERY_SECOND, FUNC_PREP_BEFORE_TELEPERIOD, FUNC_JSON_APPEND, FUNC_WEB_APPEND, FUNC_SAVE_BEFORE_RESTART,
- FUNC_COMMAND, FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA, FUNC_SET_POWER, FUNC_SHOW_SENSOR};
+ FUNC_COMMAND, FUNC_NTP_INIT, FUNC_NTP_SET,
+ FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA, FUNC_MQTT_DISCONNECTED, FUNC_MQTT_CONNECTED,
+ FUNC_SET_POWER, FUNC_SHOW_SENSOR};
const uint8_t kDefaultRfCode[9] PROGMEM = { 0x21, 0x16, 0x01, 0x0E, 0x03, 0x48, 0x2E, 0x1A, 0x00 };
diff --git a/sonoff/support.ino b/sonoff/support.ino
index 58ecce027..591a4c571 100644
--- a/sonoff/support.ino
+++ b/sonoff/support.ino
@@ -1376,6 +1376,12 @@ void RtcSecond()
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION "(" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"),
GetTime(0).c_str(), GetTime(2).c_str(), GetTime(3).c_str());
AddLog(LOG_LEVEL_DEBUG);
+
+ if (local_time < 1451602800) {
+ XdrvCall(FUNC_NTP_SET);
+ } else {
+ XdrvCall(FUNC_NTP_SET);
+ }
} else {
ntp_sync_minute++; // Try again in next minute
}
diff --git a/sonoff/webserver.ino b/sonoff/webserver.ino
index b697e2bab..20ddb0b0c 100644
--- a/sonoff/webserver.ino
+++ b/sonoff/webserver.ino
@@ -183,12 +183,10 @@ const char HTTP_BTN_RSTRT[] PROGMEM =
"
";
const char HTTP_BTN_MENU_MODULE[] PROGMEM =
"
";
-#ifdef USE_TIMERS
-#ifdef USE_TIMERS_WEB
+#if defined(USE_TIMERS) && defined(USE_TIMERS_WEB)
const char HTTP_BTN_MENU_TIMER[] PROGMEM =
"
";
-#endif // USE_TIMERS_WEB
-#endif // USE_TIMERS
+#endif // USE_TIMERS and USE_TIMERS_WEB
const char HTTP_BTN_MENU_WIFI[] PROGMEM =
"
";
const char HTTP_BTN_MENU_MQTT[] PROGMEM =
@@ -340,11 +338,9 @@ void StartWebserver(int type, IPAddress ipweb)
WebServer->on("/", HandleRoot);
WebServer->on("/cn", HandleConfiguration);
WebServer->on("/md", HandleModuleConfiguration);
-#ifdef USE_TIMERS
-#ifdef USE_TIMERS_WEB
+#if defined(USE_TIMERS) && defined(USE_TIMERS_WEB)
WebServer->on("/tm", HandleTimerConfiguration);
-#endif // USE_TIMERS_WEB
-#endif // USE_TIMERS
+#endif // USE_TIMERS and USE_TIMERS_WEB
WebServer->on("/w1", HandleWifiConfigurationWithScan);
WebServer->on("/w0", HandleWifiConfiguration);
if (Settings.flag.mqtt_enabled) {
@@ -632,11 +628,9 @@ void HandleConfiguration()
page.replace(F("{v}"), FPSTR(S_CONFIGURATION));
page += FPSTR(HTTP_HEAD_STYLE);
page += FPSTR(HTTP_BTN_MENU_MODULE);
-#ifdef USE_TIMERS
-#ifdef USE_TIMERS_WEB
+#if defined(USE_TIMERS) && defined(USE_TIMERS_WEB)
if (devices_present) page += FPSTR(HTTP_BTN_MENU_TIMER);
-#endif // USE_TIMERS_WEB
-#endif // USE_TIMERS
+#endif // USE_TIMERS and USE_TIMERS_WEB
page += FPSTR(HTTP_BTN_MENU_WIFI);
if (Settings.flag.mqtt_enabled) page += FPSTR(HTTP_BTN_MENU_MQTT);
page += FPSTR(HTTP_BTN_MENU4);
@@ -1103,13 +1097,11 @@ void HandleSaveSettings()
Settings.seriallog_level, Settings.weblog_level, Settings.syslog_level, Settings.syslog_host, Settings.syslog_port, Settings.tele_period);
AddLog(LOG_LEVEL_INFO);
break;
-#ifdef USE_TIMERS
-#ifdef USE_TIMERS_WEB
+#if defined(USE_TIMERS) && defined(USE_TIMERS_WEB)
case 7:
TimerSaveSettings();
break;
-#endif // USE_TIMERS_WEB
-#endif // USE_TIMERS
+#endif // USE_TIMERS and USE_TIMERS_WEB
#ifdef USE_DOMOTICZ
case 4:
DomoticzSaveSettings();
diff --git a/sonoff/xdrv_00_mqtt.ino b/sonoff/xdrv_00_mqtt.ino
index f9be1003c..ca74724c3 100644
--- a/sonoff/xdrv_00_mqtt.ino
+++ b/sonoff/xdrv_00_mqtt.ino
@@ -316,6 +316,8 @@ void MqttDisconnected(int state)
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MQTT D_CONNECT_FAILED_TO " %s:%d, rc %d. " D_RETRY_IN " %d " D_UNIT_SECOND),
Settings.mqtt_host, Settings.mqtt_port, state, mqtt_retry_counter);
AddLog(LOG_LEVEL_INFO);
+
+ XdrvCall(FUNC_MQTT_DISCONNECTED);
}
void MqttConnected()
@@ -371,6 +373,8 @@ void MqttConnected()
XdrvCall(FUNC_MQTT_INIT);
}
mqtt_initial_connection_state = 0;
+
+ XdrvCall(FUNC_MQTT_CONNECTED);
}
#ifdef USE_MQTT_TLS
diff --git a/sonoff/xsns_01_counter.ino b/sonoff/xsns_01_counter.ino
index 68cc418d0..397f3d853 100644
--- a/sonoff/xsns_01_counter.ino
+++ b/sonoff/xsns_01_counter.ino
@@ -105,7 +105,7 @@ void CounterShow(boolean json)
if (json) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_COUNTER "%d\":%s"), mqtt_data, i +1, counter);
#ifdef USE_DOMOTICZ
- if (1 == dsxflg) {
+ if ((0 == tele_period) && (1 == dsxflg)) {
DomoticzSensor(DZ_COUNT, RtcSettings.pulse_counter[i]);
dsxflg++;
}
diff --git a/sonoff/xsns_04_snfsc.ino b/sonoff/xsns_04_snfsc.ino
index 944dff985..63bdcc5d8 100644
--- a/sonoff/xsns_04_snfsc.ino
+++ b/sonoff/xsns_04_snfsc.ino
@@ -123,10 +123,12 @@ void SonoffScShow(boolean json)
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SonoffSC\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s,\"" D_JSON_LIGHT "\":%d,\"" D_JSON_NOISE "\":%d,\"" D_JSON_AIRQUALITY "\":%d}"),
mqtt_data, temperature, humidity, sc_value[2], sc_value[3], sc_value[4]);
#ifdef USE_DOMOTICZ
- DomoticzTempHumSensor(temperature, humidity);
- DomoticzSensor(DZ_ILLUMINANCE, sc_value[2]);
- DomoticzSensor(DZ_COUNT, sc_value[3]);
- DomoticzSensor(DZ_AIRQUALITY, 500 + ((100 - sc_value[4]) * 20));
+ if (0 == tele_period) {
+ DomoticzTempHumSensor(temperature, humidity);
+ DomoticzSensor(DZ_ILLUMINANCE, sc_value[2]);
+ DomoticzSensor(DZ_COUNT, sc_value[3]);
+ DomoticzSensor(DZ_AIRQUALITY, 500 + ((100 - sc_value[4]) * 20));
+ }
#endif // USE_DOMOTICZ
#ifdef USE_WEBSERVER
} else {
diff --git a/sonoff/xsns_05_ds18b20.ino b/sonoff/xsns_05_ds18b20.ino
index bec747c45..6faeeed18 100644
--- a/sonoff/xsns_05_ds18b20.ino
+++ b/sonoff/xsns_05_ds18b20.ino
@@ -197,7 +197,7 @@ void Ds18b20Show(boolean json)
if(json) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"DS18B20\":{\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, temperature);
#ifdef USE_DOMOTICZ
- DomoticzSensor(DZ_TEMP, temperature);
+ if (0 == tele_period) DomoticzSensor(DZ_TEMP, temperature);
#endif // USE_DOMOTICZ
#ifdef USE_WEBSERVER
} else {
diff --git a/sonoff/xsns_05_ds18x20.ino b/sonoff/xsns_05_ds18x20.ino
index 23dc4482e..4f17e94cd 100644
--- a/sonoff/xsns_05_ds18x20.ino
+++ b/sonoff/xsns_05_ds18x20.ino
@@ -380,7 +380,7 @@ void Ds18x20Show(boolean json)
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_ID "\":\"%s\",\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, stemp, address, temperature);
}
#ifdef USE_DOMOTICZ
- if (domoticz_flag) {
+ if ((0 == tele_period) && domoticz_flag) {
DomoticzSensor(DZ_TEMP, temperature);
domoticz_flag = false;
}
diff --git a/sonoff/xsns_05_ds18x20_legacy.ino b/sonoff/xsns_05_ds18x20_legacy.ino
index 085280ece..bd78ff424 100644
--- a/sonoff/xsns_05_ds18x20_legacy.ino
+++ b/sonoff/xsns_05_ds18x20_legacy.ino
@@ -188,7 +188,7 @@ void Ds18x20Show(boolean json)
mqtt_data, stemp, i +1, ds18x20_types, Ds18x20Addresses(i).c_str(), temperature);
strcpy(stemp, ",");
#ifdef USE_DOMOTICZ
- if (1 == dsxflg) {
+ if ((0 == tele_period) && (1 == dsxflg)) {
DomoticzSensor(DZ_TEMP, temperature);
}
#endif // USE_DOMOTICZ
diff --git a/sonoff/xsns_06_dht.ino b/sonoff/xsns_06_dht.ino
index e23d1989f..2bca2d87f 100644
--- a/sonoff/xsns_06_dht.ino
+++ b/sonoff/xsns_06_dht.ino
@@ -226,7 +226,7 @@ void DhtShow(boolean json)
if (json) {
snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMPHUM, mqtt_data, Dht[i].stype, temperature, humidity);
#ifdef USE_DOMOTICZ
- if (!dsxflg) {
+ if ((0 == tele_period) && !dsxflg) {
DomoticzTempHumSensor(temperature, humidity);
dsxflg++;
}
diff --git a/sonoff/xsns_07_sht1x.ino b/sonoff/xsns_07_sht1x.ino
index 6ff557aff..08afed555 100644
--- a/sonoff/xsns_07_sht1x.ino
+++ b/sonoff/xsns_07_sht1x.ino
@@ -199,7 +199,7 @@ void ShtShow(boolean json)
if (json) {
snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMPHUM, mqtt_data, "SHT1X", temperature, humidity);
#ifdef USE_DOMOTICZ
- DomoticzTempHumSensor(temperature, humidity);
+ if (0 == tele_period) DomoticzTempHumSensor(temperature, humidity);
#endif // USE_DOMOTICZ
#ifdef USE_WEBSERVER
} else {
diff --git a/sonoff/xsns_08_htu21.ino b/sonoff/xsns_08_htu21.ino
index d4d52a6e3..a36ad0db7 100644
--- a/sonoff/xsns_08_htu21.ino
+++ b/sonoff/xsns_08_htu21.ino
@@ -262,7 +262,7 @@ void HtuShow(boolean json)
if (json) {
snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMPHUM, mqtt_data, htu_types, temperature, humidity);
#ifdef USE_DOMOTICZ
- DomoticzTempHumSensor(temperature, humidity);
+ if (0 == tele_period) DomoticzTempHumSensor(temperature, humidity);
#endif // USE_DOMOTICZ
#ifdef USE_WEBSERVER
} else {
diff --git a/sonoff/xsns_09_bmp.ino b/sonoff/xsns_09_bmp.ino
index abfe2e582..9ca0fa491 100644
--- a/sonoff/xsns_09_bmp.ino
+++ b/sonoff/xsns_09_bmp.ino
@@ -465,7 +465,7 @@ void BmpShow(boolean json)
mqtt_data, bmp_name, temperature, (bmp_model >= 2) ? json_humidity : "", pressure, (Settings.altitude != 0) ? json_sealevel : "");
#endif // USE_BME680
#ifdef USE_DOMOTICZ
- DomoticzTempHumPressureSensor(temperature, humidity, pressure);
+ if (0 == tele_period) DomoticzTempHumPressureSensor(temperature, humidity, pressure);
#endif // USE_DOMOTICZ
#ifdef USE_WEBSERVER
} else {
diff --git a/sonoff/xsns_10_bh1750.ino b/sonoff/xsns_10_bh1750.ino
index f39833fc4..9c02f02e0 100644
--- a/sonoff/xsns_10_bh1750.ino
+++ b/sonoff/xsns_10_bh1750.ino
@@ -77,7 +77,7 @@ void Bh1750Show(boolean json)
if (json) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"BH1750\":{\"" D_JSON_ILLUMINANCE "\":%d}"), mqtt_data, illuminance);
#ifdef USE_DOMOTICZ
- DomoticzSensor(DZ_ILLUMINANCE, illuminance);
+ if (0 == tele_period) DomoticzSensor(DZ_ILLUMINANCE, illuminance);
#endif // USE_DOMOTICZ
#ifdef USE_WEBSERVER
} else {
diff --git a/sonoff/xsns_11_veml6070.ino b/sonoff/xsns_11_veml6070.ino
index aa5dba112..557f615f3 100644
--- a/sonoff/xsns_11_veml6070.ino
+++ b/sonoff/xsns_11_veml6070.ino
@@ -82,7 +82,7 @@ void Veml6070Show(boolean json)
if (json) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"VEML6070\":{\"" D_JSON_UV_LEVEL "\":%d}"), mqtt_data, uvlevel);
#ifdef USE_DOMOTICZ
- DomoticzSensor(DZ_ILLUMINANCE, uvlevel);
+ if (0 == tele_period) DomoticzSensor(DZ_ILLUMINANCE, uvlevel);
#endif // USE_DOMOTICZ
#ifdef USE_WEBSERVER
} else {
diff --git a/sonoff/xsns_13_ina219.ino b/sonoff/xsns_13_ina219.ino
index 8fb4e2f1b..50bcb1642 100644
--- a/sonoff/xsns_13_ina219.ino
+++ b/sonoff/xsns_13_ina219.ino
@@ -216,8 +216,10 @@ void Ina219Show(boolean json)
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"INA219\":{\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s,\"" D_JSON_POWERUSAGE "\":%s}"),
mqtt_data, voltage, current, power);
#ifdef USE_DOMOTICZ
- DomoticzSensor(DZ_VOLTAGE, voltage);
- DomoticzSensor(DZ_CURRENT, current);
+ if (0 == tele_period) {
+ DomoticzSensor(DZ_VOLTAGE, voltage);
+ DomoticzSensor(DZ_CURRENT, current);
+ }
#endif // USE_DOMOTICZ
#ifdef USE_WEBSERVER
} else {
diff --git a/sonoff/xsns_14_sht3x.ino b/sonoff/xsns_14_sht3x.ino
index afedf31fc..76a808474 100644
--- a/sonoff/xsns_14_sht3x.ino
+++ b/sonoff/xsns_14_sht3x.ino
@@ -107,7 +107,7 @@ void Sht3xShow(boolean json)
if (json) {
snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMPHUM, mqtt_data, types, temperature, humidity);
#ifdef USE_DOMOTICZ
- if (0 == i) { // We want the same first sensor to report to Domoticz in case a read is missed
+ if ((0 == tele_period) && (0 == i)) { // We want the same first sensor to report to Domoticz in case a read is missed
DomoticzTempHumSensor(temperature, humidity);
}
#endif // USE_DOMOTICZ
diff --git a/sonoff/xsns_15_mhz19.ino b/sonoff/xsns_15_mhz19.ino
index a5e09725c..4cbf88c9e 100644
--- a/sonoff/xsns_15_mhz19.ino
+++ b/sonoff/xsns_15_mhz19.ino
@@ -265,7 +265,7 @@ void MhzShow(boolean json)
if (json) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_CO2 "\":%d,\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, mhz_types, mhz_last_ppm, temperature);
#ifdef USE_DOMOTICZ
- DomoticzSensor(DZ_AIRQUALITY, mhz_last_ppm);
+ if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, mhz_last_ppm);
#endif // USE_DOMOTICZ
#ifdef USE_WEBSERVER
} else {
diff --git a/sonoff/xsns_16_tsl2561.ino b/sonoff/xsns_16_tsl2561.ino
index 24ae0dee6..6fe09a88f 100644
--- a/sonoff/xsns_16_tsl2561.ino
+++ b/sonoff/xsns_16_tsl2561.ino
@@ -71,7 +71,7 @@ void Tsl2561Show(boolean json)
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"TSL2561\":{\"" D_JSON_ILLUMINANCE "\":%u.%03u}"),
mqtt_data, milliLux/1000, milliLux%1000);
#ifdef USE_DOMOTICZ
- DomoticzSensor(DZ_ILLUMINANCE, (milliLux+500)/1000);
+ if (0 == tele_period) DomoticzSensor(DZ_ILLUMINANCE, (milliLux+500)/1000);
#endif // USE_DOMOTICZ
#ifdef USE_WEBSERVER
} else {
diff --git a/sonoff/xsns_17_senseair.ino b/sonoff/xsns_17_senseair.ino
index eb647b11c..3e938bdea 100644
--- a/sonoff/xsns_17_senseair.ino
+++ b/sonoff/xsns_17_senseair.ino
@@ -213,7 +213,7 @@ void SenseairShow(boolean json)
}
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data);
#ifdef USE_DOMOTICZ
- DomoticzSensor(DZ_AIRQUALITY, senseair_co2);
+ if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, senseair_co2);
#endif // USE_DOMOTICZ
#ifdef USE_WEBSERVER
} else {
diff --git a/sonoff/xsns_18_pms5003.ino b/sonoff/xsns_18_pms5003.ino
index 18b26263e..55a3b134e 100644
--- a/sonoff/xsns_18_pms5003.ino
+++ b/sonoff/xsns_18_pms5003.ino
@@ -131,9 +131,11 @@ void PmsShow(boolean json)
pms_data.pm10_env, pms_data.pm25_env, pms_data.pm100_env,
pms_data.particles_03um, pms_data.particles_05um, pms_data.particles_10um, pms_data.particles_25um, pms_data.particles_50um, pms_data.particles_100um);
#ifdef USE_DOMOTICZ
- DomoticzSensor(DZ_COUNT, pms_data.pm10_env); // PM1
- DomoticzSensor(DZ_VOLTAGE, pms_data.pm25_env); // PM2.5
- DomoticzSensor(DZ_CURRENT, pms_data.pm100_env); // PM10
+ if (0 == tele_period) {
+ DomoticzSensor(DZ_COUNT, pms_data.pm10_env); // PM1
+ DomoticzSensor(DZ_VOLTAGE, pms_data.pm25_env); // PM2.5
+ DomoticzSensor(DZ_CURRENT, pms_data.pm100_env); // PM10
+ }
#endif // USE_DOMOTICZ
#ifdef USE_WEBSERVER
} else {
diff --git a/sonoff/xsns_20_novasds.ino b/sonoff/xsns_20_novasds.ino
index 8f6b591da..5c38ff0f5 100644
--- a/sonoff/xsns_20_novasds.ino
+++ b/sonoff/xsns_20_novasds.ino
@@ -108,8 +108,10 @@ void NovaSdsShow(boolean json)
if (json) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SDS0X1\":{\"PM2.5\":%s,\"PM10\":%s}"), mqtt_data, pm2_5, pm10);
#ifdef USE_DOMOTICZ
- DomoticzSensor(DZ_VOLTAGE, pm2_5); // PM2.5
- DomoticzSensor(DZ_CURRENT, pm10); // PM10
+ if (0 == tele_period) {
+ DomoticzSensor(DZ_VOLTAGE, pm2_5); // PM2.5
+ DomoticzSensor(DZ_CURRENT, pm10); // PM10
+ }
#endif // USE_DOMOTICZ
#ifdef USE_WEBSERVER
} else {
diff --git a/sonoff/xsns_21_sgp30.ino b/sonoff/xsns_21_sgp30.ino
index eed03ce7f..d30281155 100644
--- a/sonoff/xsns_21_sgp30.ino
+++ b/sonoff/xsns_21_sgp30.ino
@@ -74,7 +74,7 @@ void Sgp30Show(boolean json)
if (json) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SGP30\":{\"" D_JSON_ECO2 "\":%d,\"" D_JSON_TVOC "\":%d}"), mqtt_data, sgp.eCO2, sgp.TVOC);
#ifdef USE_DOMOTICZ
- DomoticzSensor(DZ_AIRQUALITY, sgp.eCO2);
+ if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, sgp.eCO2);
#endif // USE_DOMOTICZ
} else {
#ifdef USE_WEBSERVER