Replace optional MQTT_TELE_RETAIN to Energy Margins message by ``SensorRetain``

This commit is contained in:
Theo Arends 2024-06-07 11:48:52 +02:00
parent d16a502f36
commit 9350f68ac5
5 changed files with 13 additions and 13 deletions

View File

@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
### Changed
- Matter refactoring of bridged devices (#21575)
- ESP32 Core3 platform update from 2024.05.13 to 2024.06.10 (#21569)
- Optional MQTT_TELE_RETAIN to Energy Margins message replaced by ``SensorRetain``
### Fixed
- Berry `input()` returns empty string and does not crash (#21565)

View File

@ -125,6 +125,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- Matter support for Air Quality sensors [#21559](https://github.com/arendst/Tasmota/issues/21559)
### Changed
- Optional MQTT_TELE_RETAIN to Energy Margins message replaced by ``SensorRetain``
- ESP32 Core3 platform update from 2024.05.13 to 2024.06.10 [#21569](https://github.com/arendst/Tasmota/issues/21569)
- Matter refactoring of bridged devices [#21575](https://github.com/arendst/Tasmota/issues/21575)

View File

@ -861,13 +861,19 @@ void MqttPublishPrefixTopicRulesProcess_P(uint32_t prefix, const char* subtopic)
MqttPublishPrefixTopicRulesProcess_P(prefix, subtopic, false);
}
void MqttPublishTeleSensor(void) {
// Publish tele/<device>/SENSOR default ResponseData string with optional retained
void MqttPublishTele(const char* subtopic) {
// Publish tele/<device>/<subtopic> default ResponseData string with optional retained
// then process rules
#ifdef USE_INFLUXDB
InfluxDbProcess(1); // Use a copy of ResponseData
#endif
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_SENSOR), Settings->flag.mqtt_sensor_retain); // CMND_SENSORRETAIN
MqttPublishPrefixTopicRulesProcess_P(TELE, subtopic, Settings->flag.mqtt_sensor_retain); // CMND_SENSORRETAIN
}
void MqttPublishTeleSensor(void) {
// Publish tele/<device>/SENSOR default ResponseData string with optional retained
// then process rules
MqttPublishTele(PSTR(D_RSLT_SENSOR));
}
void MqttPublishPowerState(uint32_t device) {

View File

@ -29,10 +29,6 @@
//#define USE_ENERGY_MARGIN_DETECTION
// #define USE_ENERGY_POWER_LIMIT
#ifndef MQTT_TELE_RETAIN
#define MQTT_TELE_RETAIN 0
#endif
#define ENERGY_NONE 0
#define ENERGY_WATCHDOG 4 // Allow up to 4 seconds before deciding no valid data present
@ -564,7 +560,7 @@ void EnergyMarginCheck(void) {
}
if (jsonflg) {
ResponseJsonEndEnd();
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_MARGINS), MQTT_TELE_RETAIN);
MqttPublishTele(PSTR(D_RSLT_MARGINS));
EnergyMqttShow();
Energy->margin_stable = 3; // Allow 2 seconds to stabilize before reporting
}

View File

@ -26,10 +26,6 @@
#define XDRV_03 3
#define XSNS_03 3
#ifndef MQTT_TELE_RETAIN
#define MQTT_TELE_RETAIN 0
#endif
#define ENERGY_NONE 0
#define ENERGY_WATCHDOG 4 // Allow up to 4 seconds before deciding no valid data present
@ -787,7 +783,7 @@ void EnergyMarginCheck(void) {
}
if (jsonflg) {
ResponseJsonEndEnd();
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_MARGINS), MQTT_TELE_RETAIN);
MqttPublishTele(PSTR(D_RSLT_MARGINS));
EnergyMqttShow();
Energy->margin_stable = 3; // Allow 2 seconds to stabilize before reporting
}