From 280f0a9de7966159e8e76f50b55b13c8d46ab9c9 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 29 Oct 2020 13:37:09 +0100 Subject: [PATCH] Use global struct --- tasmota/support.ino | 6 +++--- tasmota/support_command.ino | 6 +++--- tasmota/support_tasmota.ino | 28 ++++++++++++++-------------- tasmota/tasmota.ino | 12 +++++++----- tasmota/xdrv_02_mqtt.ino | 2 +- tasmota/xdrv_03_energy.ino | 8 ++++---- tasmota/xdrv_10_rules.ino | 6 +++--- tasmota/xdrv_10_scripter.ino | 6 +++--- tasmota/xdrv_12_home_assistant.ino | 6 +++--- tasmota/xdrv_13_display.ino | 2 +- tasmota/xdrv_15_pca9685.ino | 2 +- tasmota/xdrv_27_shutter.ino | 2 +- tasmota/xnrg_14_bl0940.ino | 2 +- tasmota/xsns_01_counter.ino | 4 ++-- tasmota/xsns_02_analog.ino | 6 +++--- tasmota/xsns_04_snfsc.ino | 4 ++-- tasmota/xsns_05_ds18x20.ino | 4 ++-- tasmota/xsns_05_ds18x20_esp32.ino | 4 ++-- tasmota/xsns_06_dht.ino | 2 +- tasmota/xsns_07_sht1x.ino | 2 +- tasmota/xsns_08_htu21.ino | 2 +- tasmota/xsns_09_bmp.ino | 4 ++-- tasmota/xsns_10_bh1750.ino | 2 +- tasmota/xsns_11_veml6070.ino | 2 +- tasmota/xsns_13_ina219.ino | 2 +- tasmota/xsns_14_sht3x.ino | 2 +- tasmota/xsns_15_mhz19.ino | 2 +- tasmota/xsns_16_tsl2561.ino | 2 +- tasmota/xsns_17_senseair.ino | 2 +- tasmota/xsns_18_pms5003.ino | 2 +- tasmota/xsns_20_novasds.ino | 8 ++++---- tasmota/xsns_21_sgp30.ino | 2 +- tasmota/xsns_22_sr04.ino | 2 +- tasmota/xsns_24_si1145.ino | 2 +- tasmota/xsns_26_lm75ad.ino | 2 +- tasmota/xsns_29_mcp230xx.ino | 2 +- tasmota/xsns_31_ccs811.ino | 2 +- tasmota/xsns_32_mpu6050.ino | 2 +- tasmota/xsns_37_rfsensor.ino | 6 +++--- tasmota/xsns_38_az7798.ino | 2 +- tasmota/xsns_39_max31855.ino | 4 ++-- tasmota/xsns_41_max44009.ino | 2 +- tasmota/xsns_42_scd30.ino | 2 +- tasmota/xsns_45_vl53l0x.ino | 2 +- tasmota/xsns_47_max31865.ino | 2 +- tasmota/xsns_48_chirp.ino | 2 +- tasmota/xsns_53_sml.ino | 2 +- tasmota/xsns_54_ina226.ino | 2 +- tasmota/xsns_55_hih_series.ino | 2 +- tasmota/xsns_56_hpma.ino | 2 +- tasmota/xsns_57_tsl2591.ino | 2 +- tasmota/xsns_58_dht12.ino | 2 +- tasmota/xsns_59_ds1624.ino | 2 +- tasmota/xsns_63_aht1x.ino | 2 +- tasmota/xsns_65_hdc1080.ino | 2 +- tasmota/xsns_66_iAQ.ino | 8 ++++---- tasmota/xsns_71_veml7700.ino | 4 ++-- tasmota/xsns_72_mcp9808.ino | 2 +- tasmota/xsns_73_hp303b.ino | 2 +- tasmota/xsns_74_lmt01.ino | 4 ++-- tasmota/xsns_77_vl53l1x.ino | 2 +- tasmota/xsns_78_ezohum.ino | 2 +- 62 files changed, 112 insertions(+), 110 deletions(-) diff --git a/tasmota/support.ino b/tasmota/support.ino index de13338f9..d4ebc7ce8 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -1928,14 +1928,14 @@ void SetSeriallog(uint32_t loglevel) { Settings.seriallog_level = loglevel; seriallog_level = loglevel; - seriallog_timer = 0; + TasmotaGlobal.seriallog_timer = 0; } void SetSyslog(uint32_t loglevel) { Settings.syslog_level = loglevel; syslog_level = loglevel; - syslog_timer = 0; + TasmotaGlobal.syslog_timer = 0; } #ifdef USE_WEBSERVER @@ -1984,7 +1984,7 @@ void Syslog(void) delay(1); // Add time for UDP handling (#5512) } else { syslog_level = 0; - syslog_timer = SYSLOG_TIMER; + TasmotaGlobal.syslog_timer = SYSLOG_TIMER; AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SYSLOG_HOST_NOT_FOUND ". " D_RETRY_IN " %d " D_UNIT_SECOND), SYSLOG_TIMER); } } diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 49a4ed3d1..7f42711ce 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -816,7 +816,7 @@ void CmndBlinkcount(void) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 65536)) { Settings.blinkcount = XdrvMailbox.payload; // 0 - 65535 - if (blink_counter) { blink_counter = Settings.blinkcount *2; } + if (TasmotaGlobal.blink_counter) { TasmotaGlobal.blink_counter = Settings.blinkcount *2; } } ResponseCmndNumber(Settings.blinkcount); } @@ -1698,9 +1698,9 @@ void CmndTeleperiod(void) if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 3601)) { Settings.tele_period = (1 == XdrvMailbox.payload) ? TELE_PERIOD : XdrvMailbox.payload; if ((Settings.tele_period > 0) && (Settings.tele_period < 10)) Settings.tele_period = 10; // Do not allow periods < 10 seconds -// tele_period = Settings.tele_period; +// TasmotaGlobal.tele_period = Settings.tele_period; } - tele_period = Settings.tele_period; // Show teleperiod data also on empty command + TasmotaGlobal.tele_period = Settings.tele_period; // Show teleperiod data also on empty command ResponseCmndNumber(Settings.tele_period); } diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index 02dbf8a29..c81c196b8 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -607,7 +607,7 @@ void ExecuteCommandPower(uint32_t device, uint32_t state, uint32_t source) TasmotaGlobal.blink_power = (TasmotaGlobal.power >> (device -1))&1; // Prep to Toggle } TasmotaGlobal.blink_timer = millis() + 100; - blink_counter = ((!Settings.blinkcount) ? 64000 : (Settings.blinkcount *2)) +1; + TasmotaGlobal.blink_counter = ((!Settings.blinkcount) ? 64000 : (Settings.blinkcount *2)) +1; TasmotaGlobal.blink_mask |= mask; // Set device mask MqttPublishPowerBlinkState(device); return; @@ -815,9 +815,9 @@ void PerformEverySecond(void) } } - if (seriallog_timer) { - seriallog_timer--; - if (!seriallog_timer) { + if (TasmotaGlobal.seriallog_timer) { + TasmotaGlobal.seriallog_timer--; + if (!TasmotaGlobal.seriallog_timer) { if (seriallog_level) { AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SERIAL_LOGGING_DISABLED)); } @@ -825,9 +825,9 @@ void PerformEverySecond(void) } } - if (syslog_timer) { // Restore syslog level - syslog_timer--; - if (!syslog_timer) { + if (TasmotaGlobal.syslog_timer) { // Restore syslog level + TasmotaGlobal.syslog_timer--; + if (!TasmotaGlobal.syslog_timer) { syslog_level = Settings.syslog_level; if (Settings.syslog_level) { AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SYSLOG_LOGGING_REENABLED)); // Might trigger disable again (on purpose) @@ -838,14 +838,14 @@ void PerformEverySecond(void) ResetGlobalValues(); if (Settings.tele_period) { - if (tele_period >= 9999) { + if (TasmotaGlobal.tele_period >= 9999) { if (!global_state.network_down) { - tele_period = 0; // Allow teleperiod once wifi is connected + TasmotaGlobal.tele_period = 0; // Allow teleperiod once wifi is connected } } else { - tele_period++; - if (tele_period >= Settings.tele_period) { - tele_period = 0; + TasmotaGlobal.tele_period++; + if (TasmotaGlobal.tele_period >= Settings.tele_period) { + TasmotaGlobal.tele_period = 0; MqttPublishTeleState(); @@ -905,8 +905,8 @@ void Every100mSeconds(void) if (TasmotaGlobal.blink_mask) { if (TimeReached(TasmotaGlobal.blink_timer)) { SetNextTimeInterval(TasmotaGlobal.blink_timer, 100 * Settings.blinktime); - blink_counter--; - if (!blink_counter) { + TasmotaGlobal.blink_counter--; + if (!TasmotaGlobal.blink_counter) { StopAllPowerBlink(); } else { TasmotaGlobal.blink_power ^= 1; diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index efaaf7af7..d52d1c3c1 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -100,6 +100,11 @@ struct { float humidity; // Provide a global humidity to be used by some sensors float pressure_hpa; // Provide a global pressure to be used by some sensors + uint16_t blink_counter; // Number of blink cycles + uint16_t seriallog_timer; // Timer to disable Seriallog + uint16_t syslog_timer; // Timer to re-enable syslog_level + uint16_t tele_period; // Tele period timer + uint8_t blinks; // Number of LED blinks uint8_t restart_flag; // Tasmota restart flag uint8_t ota_state_flag; // OTA state flag @@ -107,10 +112,6 @@ struct { } TasmotaGlobal; -uint16_t tele_period = 9999; // Tele period timer -uint16_t blink_counter = 0; // Number of blink cycles -uint16_t seriallog_timer = 0; // Timer to disable Seriallog -uint16_t syslog_timer = 0; // Timer to re-enable syslog_level uint16_t gpio_pin[MAX_GPIO_PIN] = { 0 }; // GPIO functions indexed by pin number int16_t save_data_counter; // Counter and flag for config save to Flash RulesBitfield rules_flag; // Rule state flags (16 bits) @@ -190,6 +191,7 @@ void setup(void) { TasmotaGlobal.temperature_celsius = NAN; TasmotaGlobal.blinks = 201; TasmotaGlobal.wifi_state_flag = WIFI_RESTART; + TasmotaGlobal.tele_period = 9999; global_state.data = 0xF; // Init global state (wifi_down, mqtt_down) to solve possible network issues @@ -227,7 +229,7 @@ void setup(void) { // mdns_delayed_start = Settings.param[P_MDNS_DELAYED_START]; seriallog_level = Settings.seriallog_level; - seriallog_timer = SERIALLOG_TIMER; + TasmotaGlobal.seriallog_timer = SERIALLOG_TIMER; syslog_level = Settings.syslog_level; stop_flash_rotate = Settings.flag.stop_flash_rotate; // SetOption12 - Switch between dynamic or fixed slot flash save location save_data_counter = Settings.save_data; diff --git a/tasmota/xdrv_02_mqtt.ino b/tasmota/xdrv_02_mqtt.ino index 481b70300..4abf077f1 100644 --- a/tasmota/xdrv_02_mqtt.ino +++ b/tasmota/xdrv_02_mqtt.ino @@ -558,7 +558,7 @@ void MqttConnected(void) MqttPublishAllPowerState(); if (Settings.tele_period) { - tele_period = Settings.tele_period -5; // Enable TelePeriod in 5 seconds + TasmotaGlobal.tele_period = Settings.tele_period -5; // Enable TelePeriod in 5 seconds } rules_flag.system_boot = 1; XdrvCall(FUNC_MQTT_INIT); diff --git a/tasmota/xdrv_03_energy.ino b/tasmota/xdrv_03_energy.ino index 6cbb320d1..a41cc4dda 100644 --- a/tasmota/xdrv_03_energy.ino +++ b/tasmota/xdrv_03_energy.ino @@ -490,12 +490,12 @@ void EnergyMarginCheck(void) void EnergyMqttShow(void) { // {"Time":"2017-12-16T11:48:55","ENERGY":{"Total":0.212,"Yesterday":0.000,"Today":0.014,"Period":2.0,"Power":22.0,"Factor":1.00,"Voltage":213.6,"Current":0.100}} - int tele_period_save = tele_period; - tele_period = 2; + int tele_period_save = TasmotaGlobal.tele_period; + TasmotaGlobal.tele_period = 2; mqtt_data[0] = '\0'; ResponseAppendTime(); EnergyShow(true); - tele_period = tele_period_save; + TasmotaGlobal.tele_period = tele_period_save; ResponseJsonEnd(); MqttPublishTeleSensor(); } @@ -1033,7 +1033,7 @@ void EnergyShow(bool json) char value3_chr[FLOATSZ *3]; if (json) { - bool show_energy_period = (0 == tele_period); + bool show_energy_period = (0 == TasmotaGlobal.tele_period); ResponseAppend_P(PSTR(",\"" D_RSLT_ENERGY "\":{\"" D_JSON_TOTAL_START_TIME "\":\"%s\",\"" D_JSON_TOTAL "\":%s"), GetDateAndTime(DT_ENERGY).c_str(), diff --git a/tasmota/xdrv_10_rules.ino b/tasmota/xdrv_10_rules.ino index 625ad41a5..55c77a83a 100644 --- a/tasmota/xdrv_10_rules.ino +++ b/tasmota/xdrv_10_rules.ino @@ -949,10 +949,10 @@ void RulesEvery100ms(void) { if (Settings.rule_enabled && !Rules.busy && (TasmotaGlobal.uptime > 4)) { // Any rule enabled and allow 4 seconds start-up time for sensors (#3811) mqtt_data[0] = '\0'; - int tele_period_save = tele_period; - tele_period = 2; // Do not allow HA updates during next function call + int tele_period_save = TasmotaGlobal.tele_period; + TasmotaGlobal.tele_period = 2; // Do not allow HA updates during next function call XsnsNextCall(FUNC_JSON_APPEND, rules_xsns_index); // ,"INA219":{"Voltage":4.494,"Current":0.020,"Power":0.089} - tele_period = tele_period_save; + TasmotaGlobal.tele_period = tele_period_save; if (strlen(mqtt_data)) { mqtt_data[0] = '{'; // {"INA219":{"Voltage":4.494,"Current":0.020,"Power":0.089} ResponseJsonEnd(); diff --git a/tasmota/xdrv_10_scripter.ino b/tasmota/xdrv_10_scripter.ino index 51927693e..d69c755e1 100755 --- a/tasmota/xdrv_10_scripter.ino +++ b/tasmota/xdrv_10_scripter.ino @@ -4497,10 +4497,10 @@ void ScripterEvery100ms(void) { if (Settings.rule_enabled && (TasmotaGlobal.uptime > 4)) { mqtt_data[0] = '\0'; - uint16_t script_tele_period_save = tele_period; - tele_period = 2; + uint16_t script_tele_period_save = TasmotaGlobal.tele_period; + TasmotaGlobal.tele_period = 2; XsnsNextCall(FUNC_JSON_APPEND, script_xsns_index); - tele_period = script_tele_period_save; + TasmotaGlobal.tele_period = script_tele_period_save; if (strlen(mqtt_data)) { mqtt_data[0] = '{'; snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); diff --git a/tasmota/xdrv_12_home_assistant.ino b/tasmota/xdrv_12_home_assistant.ino index f74739e3f..3ea8a7b96 100644 --- a/tasmota/xdrv_12_home_assistant.ino +++ b/tasmota/xdrv_12_home_assistant.ino @@ -851,10 +851,10 @@ void HAssAnnounceSensors(void) do { mqtt_data[0] = '\0'; - int tele_period_save = tele_period; - tele_period = 2; // Do not allow HA updates during next function call + int tele_period_save = TasmotaGlobal.tele_period; + TasmotaGlobal.tele_period = 2; // Do not allow HA updates during next function call XsnsNextCall(FUNC_JSON_APPEND, hass_xsns_index); // ,"INA219":{"Voltage":4.494,"Current":0.020,"Power":0.089} - tele_period = tele_period_save; + TasmotaGlobal.tele_period = tele_period_save; size_t sensordata_len = strlen(mqtt_data); char sensordata[sensordata_len+2]; // dynamically adjust the size strcpy(sensordata, mqtt_data); // we can use strcpy since the buffer has the right size diff --git a/tasmota/xdrv_13_display.ino b/tasmota/xdrv_13_display.ino index de5144ffe..fa6056754 100644 --- a/tasmota/xdrv_13_display.ino +++ b/tasmota/xdrv_13_display.ino @@ -1262,7 +1262,7 @@ bool DisplayMqttData(void) void DisplayLocalSensor(void) { - if ((Settings.display_mode &0x02) && (0 == tele_period)) { + if ((Settings.display_mode &0x02) && (0 == TasmotaGlobal.tele_period)) { char no_topic[1] = { 0 }; // DisplayAnalyzeJson(mqtt_topic, mqtt_data); // Add local topic DisplayAnalyzeJson(no_topic, mqtt_data); // Discard any topic diff --git a/tasmota/xdrv_15_pca9685.ino b/tasmota/xdrv_15_pca9685.ino index e4852ad92..f57a10fd2 100644 --- a/tasmota/xdrv_15_pca9685.ino +++ b/tasmota/xdrv_15_pca9685.ino @@ -196,7 +196,7 @@ bool Xdrv15(uint8_t function) else if (pca9685_detected) { switch (function) { case FUNC_EVERY_SECOND: - if (tele_period == 0) { + if (TasmotaGlobal.tele_period == 0) { PCA9685_OutputTelemetry(true); } break; diff --git a/tasmota/xdrv_27_shutter.ino b/tasmota/xdrv_27_shutter.ino index f7d054a41..c9c384b1d 100644 --- a/tasmota/xdrv_27_shutter.ino +++ b/tasmota/xdrv_27_shutter.ino @@ -1504,7 +1504,7 @@ bool Xdrv27(uint8_t function) ResponseAppend_P(","); ResponseAppend_P(JSON_SHUTTER_POS, i+1, position, Shutter[i].direction,target); #ifdef USE_DOMOTICZ - if ((0 == tele_period) && (0 == i)) { + if ((0 == TasmotaGlobal.tele_period) && (0 == i)) { DomoticzSensor(DZ_SHUTTER, position); } #endif // USE_DOMOTICZ diff --git a/tasmota/xnrg_14_bl0940.ino b/tasmota/xnrg_14_bl0940.ino index 7b021106f..78169af29 100644 --- a/tasmota/xnrg_14_bl0940.ino +++ b/tasmota/xnrg_14_bl0940.ino @@ -273,7 +273,7 @@ void Bl0940Show(bool json) { if (json) { ResponseAppend_P(JSON_SNS_TEMP, "BL0940", temperature); - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { #ifdef USE_DOMOTICZ DomoticzSensor(DZ_TEMP, temperature); #endif // USE_DOMOTICZ diff --git a/tasmota/xsns_01_counter.ino b/tasmota/xsns_01_counter.ino index fd6b26ca5..234401ffe 100644 --- a/tasmota/xsns_01_counter.ino +++ b/tasmota/xsns_01_counter.ino @@ -210,12 +210,12 @@ void CounterShow(bool json) ResponseAppend_P(PSTR("%s\"C%d\":%s"), (header)?",":"", i +1, counter); header = true; #ifdef USE_DOMOTICZ - if ((0 == tele_period) && (1 == dsxflg)) { + if ((0 == TasmotaGlobal.tele_period) && (1 == dsxflg)) { DomoticzSensor(DZ_COUNT, RtcSettings.pulse_counter[i]); dsxflg++; } #endif // USE_DOMOTICZ - if ((0 == tele_period ) && (Settings.flag3.counter_reset_on_tele)) { + if ((0 == TasmotaGlobal.tele_period ) && (Settings.flag3.counter_reset_on_tele)) { RtcSettings.pulse_counter[i] = 0; } #ifdef USE_WEBSERVER diff --git a/tasmota/xsns_02_analog.ino b/tasmota/xsns_02_analog.ino index 8802fc12e..89281e467 100644 --- a/tasmota/xsns_02_analog.ino +++ b/tasmota/xsns_02_analog.ino @@ -414,7 +414,7 @@ void AdcShow(bool json) { if (json) { AdcShowContinuation(&jsonflg); ResponseAppend_P(PSTR("\"" D_JSON_TEMPERATURE "%s\":%s"), adc_idx, temperature); - if ((0 == tele_period) && (!domo_flag[ADC_TEMP])) { + if ((0 == TasmotaGlobal.tele_period) && (!domo_flag[ADC_TEMP])) { #ifdef USE_DOMOTICZ DomoticzSensor(DZ_TEMP, temperature); domo_flag[ADC_TEMP] = true; @@ -437,7 +437,7 @@ void AdcShow(bool json) { AdcShowContinuation(&jsonflg); ResponseAppend_P(PSTR("\"" D_JSON_ILLUMINANCE "%s\":%d"), adc_idx, adc_light); #ifdef USE_DOMOTICZ - if ((0 == tele_period) && (!domo_flag[ADC_LIGHT])) { + if ((0 == TasmotaGlobal.tele_period) && (!domo_flag[ADC_LIGHT])) { DomoticzSensor(DZ_ILLUMINANCE, adc_light); domo_flag[ADC_LIGHT] = true; } @@ -480,7 +480,7 @@ void AdcShow(bool json) { ResponseAppend_P(PSTR("\"CTEnergy%s\":{\"" D_JSON_ENERGY "\":%s,\"" D_JSON_POWERUSAGE "\":%s,\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s}"), adc_idx, energy_chr, power_chr, voltage_chr, current_chr); #ifdef USE_DOMOTICZ - if ((0 == tele_period) && (!domo_flag[ADC_CT_POWER])) { + if ((0 == TasmotaGlobal.tele_period) && (!domo_flag[ADC_CT_POWER])) { DomoticzSensor(DZ_POWER_ENERGY, power_chr); DomoticzSensor(DZ_VOLTAGE, voltage_chr); DomoticzSensor(DZ_CURRENT, current_chr); diff --git a/tasmota/xsns_04_snfsc.ino b/tasmota/xsns_04_snfsc.ino index 7652f8483..a13e673e8 100644 --- a/tasmota/xsns_04_snfsc.ino +++ b/tasmota/xsns_04_snfsc.ino @@ -120,7 +120,7 @@ void SonoffScShow(bool json) ResponseAppendTHD(t, h); ResponseAppend_P(PSTR(",\"" D_JSON_LIGHT "\":%d,\"" D_JSON_NOISE "\":%d,\"" D_JSON_AIRQUALITY "\":%d}"), sc_value[2], sc_value[3], sc_value[4]); #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { DomoticzTempHumPressureSensor(t, h); DomoticzSensor(DZ_ILLUMINANCE, sc_value[2]); DomoticzSensor(DZ_COUNT, sc_value[3]); @@ -129,7 +129,7 @@ void SonoffScShow(bool json) #endif // USE_DOMOTICZ #ifdef USE_KNX - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { KnxSensor(KNX_TEMPERATURE, t); KnxSensor(KNX_HUMIDITY, h); } diff --git a/tasmota/xsns_05_ds18x20.ino b/tasmota/xsns_05_ds18x20.ino index 4d9176c26..303cd1035 100644 --- a/tasmota/xsns_05_ds18x20.ino +++ b/tasmota/xsns_05_ds18x20.ino @@ -500,12 +500,12 @@ void Ds18x20Show(bool json) } ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_ID "\":\"%s\",\"" D_JSON_TEMPERATURE "\":%s}"), ds18x20_types, address, temperature); #ifdef USE_DOMOTICZ - if ((0 == tele_period) && (0 == i)) { + if ((0 == TasmotaGlobal.tele_period) && (0 == i)) { DomoticzSensor(DZ_TEMP, temperature); } #endif // USE_DOMOTICZ #ifdef USE_KNX - if ((0 == tele_period) && (0 == i)) { + if ((0 == TasmotaGlobal.tele_period) && (0 == i)) { KnxSensor(KNX_TEMPERATURE, ds18x20_sensor[index].temperature); } #endif // USE_KNX diff --git a/tasmota/xsns_05_ds18x20_esp32.ino b/tasmota/xsns_05_ds18x20_esp32.ino index 8647bcf01..e33c5f245 100644 --- a/tasmota/xsns_05_ds18x20_esp32.ino +++ b/tasmota/xsns_05_ds18x20_esp32.ino @@ -203,12 +203,12 @@ void Ds18x20Show(bool json) ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_ID "\":\"%s\",\"" D_JSON_TEMPERATURE "\":%s}"), ds18x20_types, address, temperature); dsxflg++; #ifdef USE_DOMOTICZ - if ((0 == tele_period) && (1 == dsxflg)) { + if ((0 == TasmotaGlobal.tele_period) && (1 == dsxflg)) { DomoticzSensor(DZ_TEMP, temperature); } #endif // USE_DOMOTICZ #ifdef USE_KNX - if ((0 == tele_period) && (1 == dsxflg)) { + if ((0 == TasmotaGlobal.tele_period) && (1 == dsxflg)) { KnxSensor(KNX_TEMPERATURE, t); } #endif // USE_KNX diff --git a/tasmota/xsns_06_dht.ino b/tasmota/xsns_06_dht.ino index 6bece3af1..705e91cad 100644 --- a/tasmota/xsns_06_dht.ino +++ b/tasmota/xsns_06_dht.ino @@ -245,7 +245,7 @@ void DhtEverySecond(void) void DhtShow(bool json) { for (uint32_t i = 0; i < dht_sensors; i++) { - TempHumDewShow(json, ((0 == tele_period) && (0 == i)), Dht[i].stype, Dht[i].t, Dht[i].h); + TempHumDewShow(json, ((0 == TasmotaGlobal.tele_period) && (0 == i)), Dht[i].stype, Dht[i].t, Dht[i].h); } } diff --git a/tasmota/xsns_07_sht1x.ino b/tasmota/xsns_07_sht1x.ino index 50780f66c..16161a9a1 100644 --- a/tasmota/xsns_07_sht1x.ino +++ b/tasmota/xsns_07_sht1x.ino @@ -183,7 +183,7 @@ void ShtEverySecond(void) void ShtShow(bool json) { if (sht_valid) { - TempHumDewShow(json, (0 == tele_period), sht_types, sht_temperature, sht_humidity); + TempHumDewShow(json, (0 == TasmotaGlobal.tele_period), sht_types, sht_temperature, sht_humidity); } } diff --git a/tasmota/xsns_08_htu21.ino b/tasmota/xsns_08_htu21.ino index 1367279b6..d27d1bbec 100644 --- a/tasmota/xsns_08_htu21.ino +++ b/tasmota/xsns_08_htu21.ino @@ -247,7 +247,7 @@ void HtuEverySecond(void) void HtuShow(bool json) { if (Htu.valid) { - TempHumDewShow(json, (0 == tele_period), Htu.types, Htu.temperature, Htu.humidity); + TempHumDewShow(json, (0 == TasmotaGlobal.tele_period), Htu.types, Htu.temperature, Htu.humidity); } } diff --git a/tasmota/xsns_09_bmp.ino b/tasmota/xsns_09_bmp.ino index c86d85128..d776fe793 100644 --- a/tasmota/xsns_09_bmp.ino +++ b/tasmota/xsns_09_bmp.ino @@ -567,7 +567,7 @@ void BmpShow(bool json) #endif // USE_BME680 #ifdef USE_DOMOTICZ - if ((0 == tele_period) && (0 == bmp_idx)) { // We want the same first sensor to report to Domoticz in case a read is missed + if ((0 == TasmotaGlobal.tele_period) && (0 == bmp_idx)) { // We want the same first sensor to report to Domoticz in case a read is missed DomoticzTempHumPressureSensor(bmp_temperature, bmp_humidity, bmp_pressure); #ifdef USE_BME680 if (bmp_sensors[bmp_idx].bmp_model >= 3) { DomoticzSensor(DZ_AIRQUALITY, (uint32_t)bmp_sensors[bmp_idx].bmp_gas_resistance); } @@ -576,7 +576,7 @@ void BmpShow(bool json) #endif // USE_DOMOTICZ #ifdef USE_KNX - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { KnxSensor(KNX_TEMPERATURE, bmp_temperature); KnxSensor(KNX_HUMIDITY, bmp_humidity); } diff --git a/tasmota/xsns_10_bh1750.ino b/tasmota/xsns_10_bh1750.ino index 2c3c801a7..dfd9d013b 100644 --- a/tasmota/xsns_10_bh1750.ino +++ b/tasmota/xsns_10_bh1750.ino @@ -176,7 +176,7 @@ void Bh1750Show(bool json) { if (json) { ResponseAppend_P(JSON_SNS_ILLUMINANCE, sensor_name, Bh1750_sensors[sensor_index].illuminance); #ifdef USE_DOMOTICZ - if ((0 == tele_period) && (0 == sensor_index)) { + if ((0 == TasmotaGlobal.tele_period) && (0 == sensor_index)) { DomoticzSensor(DZ_ILLUMINANCE, Bh1750_sensors[sensor_index].illuminance); } #endif // USE_DOMOTICZ diff --git a/tasmota/xsns_11_veml6070.ino b/tasmota/xsns_11_veml6070.ino index 600364503..c97e68c97 100644 --- a/tasmota/xsns_11_veml6070.ino +++ b/tasmota/xsns_11_veml6070.ino @@ -277,7 +277,7 @@ void Veml6070Show(bool json) veml6070_name, str_uvrisk, str_uvrisk_text, str_uvpower); #endif // USE_VEML6070_SHOW_RAW #ifdef USE_DOMOTICZ - if (0 == tele_period) { DomoticzSensor(DZ_ILLUMINANCE, uvlevel); } + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_ILLUMINANCE, uvlevel); } #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/tasmota/xsns_13_ina219.ino b/tasmota/xsns_13_ina219.ino index be651acbb..c0c8f87d4 100644 --- a/tasmota/xsns_13_ina219.ino +++ b/tasmota/xsns_13_ina219.ino @@ -297,7 +297,7 @@ void Ina219Show(bool json) ResponseAppend_P(PSTR(",\"%s\":{\"Id\":%02x,\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s,\"" D_JSON_POWERUSAGE "\":%s}"), name, ina219_addresses[i], voltage, current, power); #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_VOLTAGE, voltage); DomoticzSensor(DZ_CURRENT, current); } diff --git a/tasmota/xsns_14_sht3x.ino b/tasmota/xsns_14_sht3x.ino index ca3bcf78e..bb98cc5b0 100644 --- a/tasmota/xsns_14_sht3x.ino +++ b/tasmota/xsns_14_sht3x.ino @@ -100,7 +100,7 @@ void Sht3xShow(bool json) if (Sht3xRead(t, h, sht3x_sensors[i].address)) { char types[11]; snprintf_P(types, sizeof(types), PSTR("%s%c0x%02X"), sht3x_sensors[i].types, IndexSeparator(), sht3x_sensors[i].address); // "SHT3X-0xXX" - TempHumDewShow(json, ((0 == tele_period) && (0 == i)), types, t, h); + TempHumDewShow(json, ((0 == TasmotaGlobal.tele_period) && (0 == i)), types, t, h); } } } diff --git a/tasmota/xsns_15_mhz19.ino b/tasmota/xsns_15_mhz19.ino index bc0ee8904..8fe450f87 100644 --- a/tasmota/xsns_15_mhz19.ino +++ b/tasmota/xsns_15_mhz19.ino @@ -346,7 +346,7 @@ void MhzShow(bool json) if (json) { ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_MODEL "\":\"%s\",\"" D_JSON_CO2 "\":%d,\"" D_JSON_TEMPERATURE "\":%s}"), types, model, mhz_last_ppm, temperature); #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_AIRQUALITY, mhz_last_ppm); DomoticzSensor(DZ_TEMP, temperature); } diff --git a/tasmota/xsns_16_tsl2561.ino b/tasmota/xsns_16_tsl2561.ino index 511344b19..23f1b33cf 100644 --- a/tasmota/xsns_16_tsl2561.ino +++ b/tasmota/xsns_16_tsl2561.ino @@ -102,7 +102,7 @@ void Tsl2561Show(bool json) ResponseAppend_P(PSTR(",\"TSL2561\":{\"" D_JSON_ILLUMINANCE "\":%u.%03u,\"IR\":%u,\"Broadband\":%u}"), tsl2561_milliLux / 1000, tsl2561_milliLux % 1000, tsl2561_ir, tsl2561_full); #ifdef USE_DOMOTICZ - if (0 == tele_period) { DomoticzSensor(DZ_ILLUMINANCE, (tsl2561_milliLux + 500) / 1000); } + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_ILLUMINANCE, (tsl2561_milliLux + 500) / 1000); } #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/tasmota/xsns_17_senseair.ino b/tasmota/xsns_17_senseair.ino index 90ba979bb..eb6d3030f 100644 --- a/tasmota/xsns_17_senseair.ino +++ b/tasmota/xsns_17_senseair.ino @@ -154,7 +154,7 @@ void SenseairShow(bool json) } ResponseJsonEnd(); #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_AIRQUALITY, senseair_co2); } #endif // USE_DOMOTICZ diff --git a/tasmota/xsns_18_pms5003.ino b/tasmota/xsns_18_pms5003.ino index d54527ddc..a203b6846 100644 --- a/tasmota/xsns_18_pms5003.ino +++ b/tasmota/xsns_18_pms5003.ino @@ -295,7 +295,7 @@ void PmsShow(bool json) pms_data.particles_03um, pms_data.particles_05um, pms_data.particles_10um, pms_data.particles_25um, pms_data.particles_50um, pms_data.particles_100um); #endif // PMS_MODEL_PMS3003 #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.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 diff --git a/tasmota/xsns_20_novasds.ino b/tasmota/xsns_20_novasds.ino index ffaee14bc..3834ff984 100644 --- a/tasmota/xsns_20_novasds.ino +++ b/tasmota/xsns_20_novasds.ino @@ -162,17 +162,17 @@ void NovaSdsSecond(void) // Every second else cont_mode = 0; - if(tele_period == Settings.tele_period - Settings.novasds_startingoffset && !cont_mode) + if(TasmotaGlobal.tele_period == Settings.tele_period - Settings.novasds_startingoffset && !cont_mode) { //lets start fan and laser NovaSdsCommand(NOVA_SDS_SLEEP_AND_WORK, NOVA_SDS_SET_MODE, NOVA_SDS_WORK, NOVA_SDS_DEVICE_ID, nullptr); } - if(tele_period >= Settings.tele_period-5 && tele_period <= Settings.tele_period-2) + if(TasmotaGlobal.tele_period >= Settings.tele_period-5 && TasmotaGlobal.tele_period <= Settings.tele_period-2) { //we are doing 4 measurements here if(!(NovaSdsReadData())) novasds_valid=0; pm100_sum += novasds_data.pm100; pm25_sum += novasds_data.pm25; } - if(tele_period == Settings.tele_period-1) + if(TasmotaGlobal.tele_period == Settings.tele_period-1) { //calculate the average of 4 measuremens novasds_data.pm100 = pm100_sum >> 2; novasds_data.pm25 = pm25_sum >> 2; @@ -232,7 +232,7 @@ void NovaSdsShow(bool json) if (json) { ResponseAppend_P(PSTR(",\"SDS0X1\":{\"PM2.5\":%s,\"PM10\":%s}"), pm2_5, pm10); #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_VOLTAGE, pm2_5); // PM2.5 DomoticzSensor(DZ_CURRENT, pm10); // PM10 } diff --git a/tasmota/xsns_21_sgp30.ino b/tasmota/xsns_21_sgp30.ino index 2ef827124..bac02976c 100644 --- a/tasmota/xsns_21_sgp30.ino +++ b/tasmota/xsns_21_sgp30.ino @@ -126,7 +126,7 @@ void Sgp30Show(bool json) } ResponseJsonEnd(); #ifdef USE_DOMOTICZ - if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, sgp.eCO2); + if (0 == TasmotaGlobal.tele_period) DomoticzSensor(DZ_AIRQUALITY, sgp.eCO2); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/tasmota/xsns_22_sr04.ino b/tasmota/xsns_22_sr04.ino index 187a67c3f..70f0308f9 100644 --- a/tasmota/xsns_22_sr04.ino +++ b/tasmota/xsns_22_sr04.ino @@ -170,7 +170,7 @@ void Sr04Show(bool json) if(json) { ResponseAppend_P(PSTR(",\"SR04\":{\"" D_JSON_DISTANCE "\":%s}"), distance_chr); #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_COUNT, distance_chr); // Send distance as Domoticz Counter value } #endif // USE_DOMOTICZ diff --git a/tasmota/xsns_24_si1145.ino b/tasmota/xsns_24_si1145.ino index ad89cad3b..e7d4e8577 100644 --- a/tasmota/xsns_24_si1145.ino +++ b/tasmota/xsns_24_si1145.ino @@ -355,7 +355,7 @@ void Si1145Show(bool json) ResponseAppend_P(PSTR(",\"SI1145\":{\"" D_JSON_ILLUMINANCE "\":%d,\"" D_JSON_INFRARED "\":%d,\"" D_JSON_UV_INDEX "\":%d.%d}"), si1145_visible, si1145_infrared, si1145_uvindex /100, si1145_uvindex %100); #ifdef USE_DOMOTICZ - if (0 == tele_period) DomoticzSensor(DZ_ILLUMINANCE, si1145_visible); + if (0 == TasmotaGlobal.tele_period) DomoticzSensor(DZ_ILLUMINANCE, si1145_visible); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/tasmota/xsns_26_lm75ad.ino b/tasmota/xsns_26_lm75ad.ino index d5073f759..2a938e6e6 100644 --- a/tasmota/xsns_26_lm75ad.ino +++ b/tasmota/xsns_26_lm75ad.ino @@ -91,7 +91,7 @@ void LM75ADShow(bool json) if (json) { ResponseAppend_P(JSON_SNS_TEMP, "LM75AD", temperature); #ifdef USE_DOMOTICZ - if (0 == tele_period) DomoticzSensor(DZ_TEMP, temperature); + if (0 == TasmotaGlobal.tele_period) DomoticzSensor(DZ_TEMP, temperature); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/tasmota/xsns_29_mcp230xx.ino b/tasmota/xsns_29_mcp230xx.ino index b12eceeff..5b0612415 100644 --- a/tasmota/xsns_29_mcp230xx.ino +++ b/tasmota/xsns_29_mcp230xx.ino @@ -845,7 +845,7 @@ bool Xsns29(uint8_t function) MCP230xx_Interrupt_Counter_Report(); } } - if (tele_period == 0) { + if (TasmotaGlobal.tele_period == 0) { if (mcp230xx_int_retainer_en) { // We have pins configured for interrupt retain reporting MCP230xx_Interrupt_Retain_Report(); } diff --git a/tasmota/xsns_31_ccs811.ino b/tasmota/xsns_31_ccs811.ino index 4962cca92..c11fd79d4 100644 --- a/tasmota/xsns_31_ccs811.ino +++ b/tasmota/xsns_31_ccs811.ino @@ -91,7 +91,7 @@ void CCS811Show(bool json) if (json) { ResponseAppend_P(PSTR(",\"CCS811\":{\"" D_JSON_ECO2 "\":%d,\"" D_JSON_TVOC "\":%d}"), eCO2,TVOC); #ifdef USE_DOMOTICZ - if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, eCO2); + if (0 == TasmotaGlobal.tele_period) DomoticzSensor(DZ_AIRQUALITY, eCO2); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/tasmota/xsns_32_mpu6050.ino b/tasmota/xsns_32_mpu6050.ino index c1f792ae7..e02933798 100644 --- a/tasmota/xsns_32_mpu6050.ino +++ b/tasmota/xsns_32_mpu6050.ino @@ -262,7 +262,7 @@ bool Xsns32(uint8_t function) else if (MPU_6050_found) { switch (function) { case FUNC_EVERY_SECOND: - if (tele_period == Settings.tele_period -3) { + if (TasmotaGlobal.tele_period == Settings.tele_period -3) { MPU_6050PerformReading(); } break; diff --git a/tasmota/xsns_37_rfsensor.ino b/tasmota/xsns_37_rfsensor.ino index 53945f2bb..ab42563eb 100644 --- a/tasmota/xsns_37_rfsensor.ino +++ b/tasmota/xsns_37_rfsensor.ino @@ -279,7 +279,7 @@ void RfSnsTheoV2Show(bool json) ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_ILLUMINANCE "\":%d,\"" D_JSON_VOLTAGE "\":%s}"), sensor, temperature, rfsns_theo_v2_t1[i].lux, voltage); #ifdef USE_DOMOTICZ - if ((0 == tele_period) && !sensor_once) { + if ((0 == TasmotaGlobal.tele_period) && !sensor_once) { DomoticzSensor(DZ_TEMP, temperature); DomoticzSensor(DZ_ILLUMINANCE, rfsns_theo_v2_t1[i].lux); sensor_once = true; @@ -317,7 +317,7 @@ void RfSnsTheoV2Show(bool json) ResponseAppendTHD(temp, humi); ResponseAppend_P(PSTR(",\"" D_JSON_VOLTAGE "\":%s}"), voltage); - if ((0 == tele_period) && !sensor_once) { + if ((0 == TasmotaGlobal.tele_period) && !sensor_once) { #ifdef USE_DOMOTICZ DomoticzTempHumPressureSensor(temp, humi); // #endif // USE_DOMOTICZ @@ -573,7 +573,7 @@ void RfSnsAlectoV2Show(bool json) ResponseAppendTHD(temp, humi); ResponseAppend_P(PSTR(",\"Rain\":%s,\"Wind\":%s,\"Gust\":%s%s}"), rain, wind, gust, (rfsns_alecto_v2->type) ? direction : ""); - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { #ifdef USE_DOMOTICZ // Use a rules to send data to Domoticz where also a local BMP280 is connected: // on tele-alectov2#temperature do var1 %value% endon on tele-alectov2#humidity do var2 %value% endon on tele-bmp280#pressure do publish domoticz/in {"idx":68,"svalue":"%var1%;%var2%;0;%value%;0"} endon diff --git a/tasmota/xsns_38_az7798.ino b/tasmota/xsns_38_az7798.ino index 352f59389..1b5ba7f5f 100644 --- a/tasmota/xsns_38_az7798.ino +++ b/tasmota/xsns_38_az7798.ino @@ -283,7 +283,7 @@ void AzShow(bool json) ResponseAppendTHD(az_temperature, az_humidity); ResponseJsonEnd(); #ifdef USE_DOMOTICZ - if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, az_co2); + if (0 == TasmotaGlobal.tele_period) DomoticzSensor(DZ_AIRQUALITY, az_co2); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/tasmota/xsns_39_max31855.ino b/tasmota/xsns_39_max31855.ino index fcdb69094..a6e592c21 100644 --- a/tasmota/xsns_39_max31855.ino +++ b/tasmota/xsns_39_max31855.ino @@ -151,12 +151,12 @@ void MAX31855_Show(bool Json) { ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_PROBETEMPERATURE "\":%s,\"" D_JSON_REFERENCETEMPERATURE "\":%s,\"" D_JSON_ERROR "\":%d}"), \ sensor_name, probetemp, referencetemp, MAX31855_Result.ErrorCode); #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_TEMP, probetemp); } #endif // USE_DOMOTICZ #ifdef USE_KNX - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { KnxSensor(KNX_TEMPERATURE, MAX31855_Result.ProbeTemperature); } #endif // USE_KNX diff --git a/tasmota/xsns_41_max44009.ino b/tasmota/xsns_41_max44009.ino index 231cc961a..471840050 100644 --- a/tasmota/xsns_41_max44009.ino +++ b/tasmota/xsns_41_max44009.ino @@ -122,7 +122,7 @@ void Max4409Show(bool json) if (json) { ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_ILLUMINANCE "\":%s}"), max44009_types, illum_str); #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_ILLUMINANCE, illum_str); } #endif // USE_DOMOTICZ diff --git a/tasmota/xsns_42_scd30.ino b/tasmota/xsns_42_scd30.ino index 4c73d3b15..50e3968ec 100644 --- a/tasmota/xsns_42_scd30.ino +++ b/tasmota/xsns_42_scd30.ino @@ -372,7 +372,7 @@ void Scd30Show(bool json) ResponseAppendTHD(t, h); ResponseJsonEnd(); #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_AIRQUALITY, scd30_CO2); DomoticzTempHumPressureSensor(t, h); } diff --git a/tasmota/xsns_45_vl53l0x.ino b/tasmota/xsns_45_vl53l0x.ino index f3a9bbe74..623dda9a0 100644 --- a/tasmota/xsns_45_vl53l0x.ino +++ b/tasmota/xsns_45_vl53l0x.ino @@ -119,7 +119,7 @@ void Vl53l0Show(boolean json) { if (json) { ResponseAppend_P(PSTR(",\"VL53L0X\":{\"" D_JSON_DISTANCE "\":%d}"), Vl53l0x.distance); #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_ILLUMINANCE, Vl53l0x.distance); } #endif // USE_DOMOTICZ diff --git a/tasmota/xsns_47_max31865.ino b/tasmota/xsns_47_max31865.ino index adf4d3611..de67a737e 100644 --- a/tasmota/xsns_47_max31865.ino +++ b/tasmota/xsns_47_max31865.ino @@ -97,7 +97,7 @@ void MAX31865_Show(bool Json) { if (Json) { ResponseAppend_P(PSTR(",\"MAX31865%c%d\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_RESISTANCE "\":%s,\"" D_JSON_ERROR "\":%d}"), \ IndexSeparator(), i, temperature, resistance, MAX31865_Result[i].ErrorCode); - if ((0 == tele_period) && (!report_once)) { + if ((0 == TasmotaGlobal.tele_period) && (!report_once)) { #ifdef USE_DOMOTICZ DomoticzSensor(DZ_TEMP, temperature); #endif // USE_DOMOTICZ diff --git a/tasmota/xsns_48_chirp.ino b/tasmota/xsns_48_chirp.ino index 934dff205..3ef5ea72c 100644 --- a/tasmota/xsns_48_chirp.ino +++ b/tasmota/xsns_48_chirp.ino @@ -443,7 +443,7 @@ void ChirpShow(bool json) ResponseAppend_P(PSTR(",\"%s%u\":{\"sleeping\"}"),chirp_name, i); } #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { DomoticzTempHumPressureSensor(t_temperature, chirp_sensor[i].moisture); DomoticzSensor(DZ_ILLUMINANCE,chirp_sensor[i].light); // this is not LUX!! } diff --git a/tasmota/xsns_53_sml.ino b/tasmota/xsns_53_sml.ino index b37ea147b..4fcdca118 100755 --- a/tasmota/xsns_53_sml.ino +++ b/tasmota/xsns_53_sml.ino @@ -1796,7 +1796,7 @@ void SML_Show(boolean json) { /* #ifdef USE_DOMOTICZ - if (json && !tele_period) { + if (json && !TasmotaGlobal.tele_period) { char str[16]; dtostrfd(meter_vars[0], 1, str); DomoticzSensorPowerEnergy(meter_vars[1], str); // PowerUsage, EnergyToday diff --git a/tasmota/xsns_54_ina226.ino b/tasmota/xsns_54_ina226.ino index 77904f374..434adb2e2 100644 --- a/tasmota/xsns_54_ina226.ino +++ b/tasmota/xsns_54_ina226.ino @@ -516,7 +516,7 @@ void Ina226Show(bool json) ResponseAppend_P(PSTR(",\"%s\":{\"Id\":%d,\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s,\"" D_JSON_POWERUSAGE "\":%s}"), name, i, voltage, current, power); #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_VOLTAGE, voltage); DomoticzSensor(DZ_CURRENT, current); } diff --git a/tasmota/xsns_55_hih_series.ino b/tasmota/xsns_55_hih_series.ino index c7d1bf70b..89278e432 100644 --- a/tasmota/xsns_55_hih_series.ino +++ b/tasmota/xsns_55_hih_series.ino @@ -96,7 +96,7 @@ void Hih6EverySecond(void) void Hih6Show(bool json) { if (Hih6.valid) { - TempHumDewShow(json, (0 == tele_period), Hih6.types, Hih6.temperature, Hih6.humidity); + TempHumDewShow(json, (0 == TasmotaGlobal.tele_period), Hih6.types, Hih6.temperature, Hih6.humidity); } } diff --git a/tasmota/xsns_56_hpma.ino b/tasmota/xsns_56_hpma.ino index a0e8aef5a..576cf19d2 100644 --- a/tasmota/xsns_56_hpma.ino +++ b/tasmota/xsns_56_hpma.ino @@ -96,7 +96,7 @@ void HpmaShow(bool json) if (json) { ResponseAppend_P(PSTR(",\"HPMA\":{\"PM2.5\":%d,\"PM10\":%d}"), hpma_data.pm2_5, hpma_data.pm10); #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_VOLTAGE, pm2_5); // PM2.5 DomoticzSensor(DZ_CURRENT, pm10); // PM10 } diff --git a/tasmota/xsns_57_tsl2591.ino b/tasmota/xsns_57_tsl2591.ino index 8a96648e1..ae7bdba8d 100644 --- a/tasmota/xsns_57_tsl2591.ino +++ b/tasmota/xsns_57_tsl2591.ino @@ -80,7 +80,7 @@ void Tsl2591Show(bool json) if (json) { ResponseAppend_P(PSTR(",\"TSL2591\":{\"" D_JSON_ILLUMINANCE "\":%s}"), lux_str); #ifdef USE_DOMOTICZ - if (0 == tele_period) { DomoticzSensor(DZ_ILLUMINANCE, tsl2591_lux); } + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_ILLUMINANCE, tsl2591_lux); } #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/tasmota/xsns_58_dht12.ino b/tasmota/xsns_58_dht12.ino index e7ba41af7..a772e3cea 100644 --- a/tasmota/xsns_58_dht12.ino +++ b/tasmota/xsns_58_dht12.ino @@ -90,7 +90,7 @@ void Dht12EverySecond(void) void Dht12Show(bool json) { if (Dht12.valid) { - TempHumDewShow(json, (0 == tele_period), Dht12.name, Dht12.temperature, Dht12.humidity); + TempHumDewShow(json, (0 == TasmotaGlobal.tele_period), Dht12.name, Dht12.temperature, Dht12.humidity); } } diff --git a/tasmota/xsns_59_ds1624.ino b/tasmota/xsns_59_ds1624.ino index 96adc4938..7fece459d 100644 --- a/tasmota/xsns_59_ds1624.ino +++ b/tasmota/xsns_59_ds1624.ino @@ -185,7 +185,7 @@ void DS1624Show(bool json) dtostrfd(ds1624_sns[i].value, Settings.flag2.temperature_resolution, temperature); if (json) { ResponseAppend_P(JSON_SNS_TEMP, ds1624_sns[i].name, temperature); - if ((0 == tele_period) && once) { + if ((0 == TasmotaGlobal.tele_period) && once) { #ifdef USE_DOMOTICZ DomoticzSensor(DZ_TEMP, temperature); #endif // USE_DOMOTICZ diff --git a/tasmota/xsns_63_aht1x.ino b/tasmota/xsns_63_aht1x.ino index 101c8495b..cba95662a 100644 --- a/tasmota/xsns_63_aht1x.ino +++ b/tasmota/xsns_63_aht1x.ino @@ -176,7 +176,7 @@ void AHT1XShow(bool json) { float hum = ConvertHumidity(aht1x_sensors[i].humidity); char types[11]; // AHT1X-0x38 snprintf_P(types, sizeof(types), PSTR("%s%c0x%02X"), aht1x_sensors[i].types, IndexSeparator(), aht1x_sensors[i].address); // "X-0xXX" - TempHumDewShow(json, ((0 == tele_period) && (0 == i)), types, tem, hum); + TempHumDewShow(json, ((0 == TasmotaGlobal.tele_period) && (0 == i)), types, tem, hum); } } diff --git a/tasmota/xsns_65_hdc1080.ino b/tasmota/xsns_65_hdc1080.ino index 9fe90442f..1a70cf0a0 100644 --- a/tasmota/xsns_65_hdc1080.ino +++ b/tasmota/xsns_65_hdc1080.ino @@ -273,7 +273,7 @@ void HdcEverySecond(void) { */ void HdcShow(bool json) { if (hdc_valid) { - TempHumDewShow(json, (0 == tele_period), hdc_type_name, hdc_temperature, hdc_humidity); + TempHumDewShow(json, (0 == TasmotaGlobal.tele_period), hdc_type_name, hdc_temperature, hdc_humidity); } } diff --git a/tasmota/xsns_66_iAQ.ino b/tasmota/xsns_66_iAQ.ino index d115d0965..ed89c855e 100644 --- a/tasmota/xsns_66_iAQ.ino +++ b/tasmota/xsns_66_iAQ.ino @@ -50,14 +50,14 @@ void IAQ_Read(void) { uint8_t buf[9]; buf[2] = IAQ_STATUS_I2C_ERR; // populate entry with error code - Wire.requestFrom((uint8_t)I2_ADR_IAQ,sizeof(buf)); + Wire.requestFrom((uint8_t)I2_ADR_IAQ,sizeof(buf)); for( uint32_t i=0; i<9; i++ ) { buf[i]= Wire.read(); } // AddLog_P2(LOG_LEVEL_DEBUG, "iAQ: buffer %x %x %x %x %x %x %x %x %x ", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], buf[8]); iAQ.pred = (buf[0]<<8) + buf[1]; iAQ.status = buf[2]; - iAQ.resistance = ((uint32_t)buf[3]<<24) + ((uint32_t)buf[4]<<16) + ((uint32_t)buf[5]<<8) + (uint32_t)buf[6]; + iAQ.resistance = ((uint32_t)buf[3]<<24) + ((uint32_t)buf[4]<<16) + ((uint32_t)buf[5]<<8) + (uint32_t)buf[6]; iAQ.Tvoc = (buf[7]<<8) + buf[8]; } @@ -86,7 +86,7 @@ void IAQ_Show(uint8_t json) else { ResponseAppend_P(PSTR(",\"IAQ\":{\"" D_JSON_ECO2 "\":%u,\"" D_JSON_TVOC "\":%u,\"" D_JSON_RESISTANCE "\":%u}"), iAQ.pred, iAQ.Tvoc, iAQ.resistance); #ifdef USE_DOMOTICZ - if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, iAQ.pred); + if (0 == TasmotaGlobal.tele_period) DomoticzSensor(DZ_AIRQUALITY, iAQ.pred); #endif // USE_DOMOTICZ } #ifdef USE_WEBSERVER @@ -100,7 +100,7 @@ void IAQ_Show(uint8_t json) break; default: WSContentSend_PD(HTTP_SNS_IAQ_ERROR, D_ERROR); - } + } #endif } } diff --git a/tasmota/xsns_71_veml7700.ino b/tasmota/xsns_71_veml7700.ino index 695e35824..655d52992 100644 --- a/tasmota/xsns_71_veml7700.ino +++ b/tasmota/xsns_71_veml7700.ino @@ -107,7 +107,7 @@ void VEML7700Show(bool json) ResponseAppend_P(JSON_SNS_VEML7700, D_NAME_VEML7700, veml7700_sensor.lux_normalized, veml7700_sensor.white_normalized); #ifdef USE_DOMOTICZ - if (0 == tele_period) DomoticzSensor(DZ_ILLUMINANCE, veml7700_sensor.lux_normalized); + if (0 == TasmotaGlobal.tele_period) DomoticzSensor(DZ_ILLUMINANCE, veml7700_sensor.lux_normalized); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { @@ -157,7 +157,7 @@ bool VEML7700Cmd(void) { } } Response_P(S_JSON_VEML7700_COMMAND_NVALUE, command, veml7700.getPersistence()); - break; + break; default: return false; } diff --git a/tasmota/xsns_72_mcp9808.ino b/tasmota/xsns_72_mcp9808.ino index 8af129f97..587123d2c 100644 --- a/tasmota/xsns_72_mcp9808.ino +++ b/tasmota/xsns_72_mcp9808.ino @@ -86,7 +86,7 @@ void MCP9808Show(bool json) { if (json) { ResponseAppend_P(JSON_SNS_TEMP, sensor_name, temperature); - if ((0 == tele_period) && (0 == i)) { + if ((0 == TasmotaGlobal.tele_period) && (0 == i)) { #ifdef USE_DOMOTICZ DomoticzSensor(DZ_TEMP, temperature); #endif // USE_DOMOTICZ diff --git a/tasmota/xsns_73_hp303b.ino b/tasmota/xsns_73_hp303b.ino index 6b42e8e85..30a14945c 100644 --- a/tasmota/xsns_73_hp303b.ino +++ b/tasmota/xsns_73_hp303b.ino @@ -122,7 +122,7 @@ void HP303B_Show(bool json) { ResponseJsonEnd(); #ifdef USE_DOMOTICZ // Domoticz and knx only support one temp sensor - if ((0 == tele_period) && (0 == i)) { + if ((0 == TasmotaGlobal.tele_period) && (0 == i)) { DomoticzSensor(DZ_TEMP, hp303b_sensor[i].temperature); } #endif // USE_DOMOTICZ diff --git a/tasmota/xsns_74_lmt01.ino b/tasmota/xsns_74_lmt01.ino index 522b82281..85d97a492 100644 --- a/tasmota/xsns_74_lmt01.ino +++ b/tasmota/xsns_74_lmt01.ino @@ -91,12 +91,12 @@ void LMT01_Show(bool Json) { if (Json) { ResponseAppend_P(JSON_SNS_TEMP, "LMT01", temp); #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_TEMP, temp); } #endif // USE_DOMOTICZ #ifdef USE_KNX - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { KnxSensor(KNX_TEMPERATURE, lmt01_temperature); } #endif // USE_KNX diff --git a/tasmota/xsns_77_vl53l1x.ino b/tasmota/xsns_77_vl53l1x.ino index 170ca4128..23be88a69 100644 --- a/tasmota/xsns_77_vl53l1x.ino +++ b/tasmota/xsns_77_vl53l1x.ino @@ -79,7 +79,7 @@ void Vl53l1Every_Second(void) { void Vl53l1Show(bool json) { if (json) { #ifdef USE_DOMOTICZ - if (0 == tele_period) { + if (0 == TasmotaGlobal.tele_period) { Vl53l1Every_Second(); } #endif // USE_DOMOTICZ diff --git a/tasmota/xsns_78_ezohum.ino b/tasmota/xsns_78_ezohum.ino index 62b6edc68..a403eeb56 100644 --- a/tasmota/xsns_78_ezohum.ino +++ b/tasmota/xsns_78_ezohum.ino @@ -48,7 +48,7 @@ struct EZOHUM : public EZOStruct { dtostrfd(humidity, Settings.flag2.humidity_resolution, parameter); WSContentSend_PD(HTTP_SNS_HUM, name, parameter); } else { - TempHumDewShow(json, (0 == tele_period), name, temperature, humidity); + TempHumDewShow(json, (0 == TasmotaGlobal.tele_period), name, temperature, humidity); } }