mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
small improvements in listen mode
This commit is contained in:
@@ -721,6 +721,11 @@ void publishValues(bool force) {
|
||||
return;
|
||||
}
|
||||
|
||||
// don't publish is publish time is set to 0
|
||||
if (EMSESP_Settings.publish_time == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
char s[20] = {0}; // for formatting strings
|
||||
StaticJsonDocument<MQTT_MAX_PAYLOAD_SIZE> doc;
|
||||
char data[MQTT_MAX_PAYLOAD_SIZE] = {0};
|
||||
@@ -2101,7 +2106,7 @@ void loop() {
|
||||
|
||||
// publish the values to MQTT, only if the values have changed
|
||||
// although we don't want to publish when doing a deep scan of the thermostat
|
||||
if (ems_getEmsRefreshed() && (scanThermostat_count == 0) && (!EMSESP_Settings.listen_mode)) {
|
||||
if (ems_getEmsRefreshed() && (scanThermostat_count == 0)) {
|
||||
publishValues(false);
|
||||
ems_setEmsRefreshed(false); // reset
|
||||
}
|
||||
|
||||
15
src/ems.cpp
15
src/ems.cpp
@@ -581,9 +581,6 @@ void _ems_sendTelegram() {
|
||||
// if we're preventing all outbound traffic, quit
|
||||
if (ems_getTxDisabled()) {
|
||||
EMS_TxQueue.shift(); // remove from queue
|
||||
if (ems_getLogging() != EMS_SYS_LOGGING_NONE) {
|
||||
myDebug_P(PSTR("in Listen Mode. All Tx is disabled."));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1861,8 +1858,10 @@ void _process_UBADevices(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
if ((byte & 0x01) && ((saved_byte & 0x01) == 0)) {
|
||||
uint8_t device_id = ((data_byte + 1) * 8) + bit;
|
||||
if (device_id != EMS_ID_ME) {
|
||||
myDebug("[EMS] Querying EMS Device ID 0x%02X", device_id);
|
||||
ems_doReadCommand(EMS_TYPE_Version, device_id); // get version, but ignore ourselves
|
||||
myDebug("[EMS] Detected new EMS Device with ID 0x%02X", device_id);
|
||||
if (!ems_getTxDisabled()) {
|
||||
ems_doReadCommand(EMS_TYPE_Version, device_id); // get version, but ignore ourselves
|
||||
}
|
||||
}
|
||||
}
|
||||
byte = byte >> 1;
|
||||
@@ -2562,7 +2561,7 @@ void ems_printDevices() {
|
||||
myDebug_P(PSTR("Note: if any devices are marked as 'unknown?' please report this as a GitHub issue so the EMS devices list can be "
|
||||
"updated."));
|
||||
} else {
|
||||
myDebug_P(PSTR("No devices detected."));
|
||||
myDebug_P(PSTR("No devices recognized. This could be because Tx is disabled or failing."));
|
||||
}
|
||||
|
||||
myDebug_P(PSTR("")); // newline
|
||||
@@ -2620,6 +2619,10 @@ void ems_doReadCommand(uint16_t type, uint8_t dest, bool forceRefresh) {
|
||||
* telegram is a string of hex values
|
||||
*/
|
||||
void ems_sendRawTelegram(char * telegram) {
|
||||
if (ems_getLogging() != EMS_SYS_LOGGING_NONE) {
|
||||
myDebug_P(PSTR("in Listen Mode. All Tx is disabled."));
|
||||
}
|
||||
|
||||
uint8_t count = 0;
|
||||
char * p;
|
||||
char value[10] = {0};
|
||||
|
||||
Reference in New Issue
Block a user