diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index 05a61bd56..7abea5f20 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -136,7 +136,7 @@ static const command_t project_cmds[] PROGMEM = { {false, "queue", "show current Tx queue"}, {false, "autodetect [deep]", "detect EMS devices and attempt to automatically set boiler and thermostat types"}, {false, "shower ", "toggle either timer or alert on/off"}, - {false, "send XX ...", "send raw telegram data as hex to EMS bus"}, + {false, "send XX ...", "send raw telegram data to EMS bus (XX are hex values)"}, {false, "thermostat read ", "send read request to the thermostat for heating circuit hc 1-4"}, {false, "thermostat temp [hc] ", "set current thermostat temperature"}, {false, "thermostat mode [hc] ", "set mode (0=low/night, 1=manual/day, 2=auto) for heating circuit hc 1-4"}, @@ -1103,7 +1103,7 @@ void do_systemCheck() { // only if we have a EMS connection void do_regularUpdates() { if (ems_getBusConnected() && !ems_getTxDisabled()) { - myDebugLog("Requesting scheduled EMS device data"); + myDebugLog("Starting scheduled query from EMS devices"); ems_getThermostatValues(); ems_getBoilerValues(); ems_getSolarModuleValues(); diff --git a/src/ems.cpp b/src/ems.cpp index 05641ccba..cf2329c60 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -454,11 +454,10 @@ void ems_tx_pollAck() { * len is length of all the data in bytes (including the header & CRC byte at end) */ uint8_t _crcCalculator(uint8_t * data, uint8_t len) { - if (len <= 1) { return 0; } - + uint8_t crc = 0; // read data and stop before the CRC @@ -1887,10 +1886,23 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) { return; } - uint8_t product_id = _toByte(0); + uint8_t offset = 0; + + // check for 2nd subscriber + // e.g. 18 0B 02 00 00 00 00 5E 02 01 + if (EMS_RxTelegram->data[0] == 0x00) { + // see if we have a 2nd subscriber + if (EMS_RxTelegram->data[3] != 0x00) { + offset = 3; + } else { + return; // ignore telegram + } + } + + uint8_t product_id = _toByte(offset); char version[10] = {0}; - snprintf(version, sizeof(version), "%02d.%02d", _toByte(1), _toByte(2)); + snprintf(version, sizeof(version), "%02d.%02d", _toByte(offset + 1), _toByte(offset + 2)); // see if its a known boiler int i = 0; @@ -2053,12 +2065,10 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) { if (typeFound) { myDebug_P(PSTR("Device found: %s (DeviceID:0x%02X ProductID:%d Version:%s)"), Other_Devices[i].model_string, Other_Devices[i].device_id, product_id, version); - // add to list _addDevice(EMS_MODELTYPE_OTHER, product_id, Other_Devices[i].device_id, version, Other_Devices[i].model_string); // type 3 = other - return; } else { - myDebug_P(PSTR("Unrecognized device found: %s (DeviceID:0x%02X ProductID:%d Version:%s)"), EMS_RxTelegram->src, product_id, version); + myDebug_P(PSTR("Unrecognized device found: (DeviceID:0x%02X ProductID:%d Version:%s)"), EMS_RxTelegram->src, product_id, version); // add to list _addDevice(EMS_MODELTYPE_OTHER, product_id, EMS_RxTelegram->src, version, "unknown?"); // type 4 = unknown } @@ -2624,8 +2634,11 @@ 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.")); + if (EMS_Sys_Status.emsTxDisabled) { + if (ems_getLogging() != EMS_SYS_LOGGING_NONE) { + myDebug_P(PSTR("in Listen Mode. All Tx is disabled.")); + } + return; } uint8_t count = 0; diff --git a/src/version.h b/src/version.h index 0bbbbeac6..c920085e7 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define APP_VERSION "1.9.1b5" +#define APP_VERSION "1.9.1b6"