mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
Use global struct
This commit is contained in:
parent
8e6f303403
commit
280f0a9de7
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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(),
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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!!
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user