diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index bb884411e..27e090b17 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -113,7 +113,7 @@ static const command_t project_cmds[] PROGMEM = { {false, "queue", "show current Tx queue"}, {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 [temp]", "set current thermostat temperature. temp=0-6 (see wiki)"}, + {false, "thermostat temp [mode] [hc]", "set current thermostat temperature. mode=0-6 (see wiki), hc=1-4"}, {false, "thermostat mode ", "set mode (0=off, 1=manual, 2=auto) for heating circuit hc 1-4"}, {false, "boiler read ", "send read request to boiler"}, {false, "boiler wwtemp ", "set boiler warm water temperature"}, @@ -1602,20 +1602,24 @@ void TelnetCommandCallback(uint8_t wc, const char * commandLine) { } // thermostat commands + // thermostat temp if ((strcmp(first_cmd, "thermostat") == 0) && (wc >= 3)) { char * second_cmd = _readWord(); if (strcmp(second_cmd, "temp") == 0) { - uint8_t hc = _readIntNumber(); // next parameter is the heating circuit - float temp = _readFloatNumber(); // read in next param which is the temp - if (wc == 5) { - // we have a temp mode given - _THERMOSTAT_TEMP_MODE temp_mode = (_THERMOSTAT_TEMP_MODE)_readIntNumber(); // next parameter is the temp mode type - ems_setThermostatTemp(temp, hc, temp_mode); + float temp = _readFloatNumber(); // read in next param which is the temp + + if (wc == 3) { + // no more params + ems_setThermostatTemp(temp, EMS_THERMOSTAT_DEFAULTHC); + ok = true; } else { - ems_setThermostatTemp(temp, hc); + // get modevalue and heatingcircuit + _THERMOSTAT_TEMP_MODE temp_mode = (_THERMOSTAT_TEMP_MODE)_readIntNumber(); // next parameter is the temp mode type + uint8_t hc = _readIntNumber(); // next parameter is the heating circuit + ems_setThermostatTemp(temp, hc, temp_mode); + ok = true; } - ok = true; } else if (strcmp(second_cmd, "mode") == 0) { uint8_t hc = _readIntNumber(); // next parameter is the heating circuit ems_setThermostatMode(_readIntNumber(), hc); diff --git a/src/ems.cpp b/src/ems.cpp index 60508a276..332a89b9a 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -266,8 +266,9 @@ bool ems_getHeatPumpEnabled() { return (EMS_HeatPump.device_id != EMS_ID_NONE); } +// thermostat has already the 7th bit (to indicate write) stripped uint8_t ems_getThermostatFlags() { - return (EMS_Thermostat.device_flags & 0x7F); // strip 7th bit which is used to show whether Write is supported + return (EMS_Thermostat.device_flags); } uint8_t ems_getSolarModuleFlags() { @@ -1840,6 +1841,15 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) { brand = 0; // unknown } + /* + // override to emulate other thermostats - FR100 + if (device_id == 0x17) { + brand = 2; + device_id = 0x10; + product_id = 107; + } +*/ + // first scan through matching boilers, as these are unique to DeviceID 0x08 uint8_t i = 0; while (i < _EMS_Devices_max) { @@ -2451,16 +2461,14 @@ void ems_setThermostatTemp(float temperature, uint8_t hc_num, _THERMOSTAT_TEMP_M EMS_TxTelegram.type_validate = EMS_TxTelegram.type; } - else if (model == EMS_DEVICE_FLAG_JUNKERS) { + else if (model & EMS_DEVICE_FLAG_JUNKERS) { EMS_TxTelegram.emsplus = true; // Assuming here that all Junkers use EMS+ // figure out if we have older or new thermostats - // Heating Circuits on 0x65 or 0x79 (see https://github.com/proddy/EMS-ESP/issues/335#issuecomment-593324716) - // strip 7th (write) and 6th (junkers) bits to leave EMS_DEVICE_FLAG_JUNKERS_CONFIG1 or CONFIG2 - bool newer_junkers = ((model & 0x3F) == EMS_DEVICE_FLAG_JUNKERS_CONFIG1); - - if (newer_junkers) { - // new models like the FW series + // Heating Circuits on 0x65 (EMS_DEVICE_FLAG_JUNKERS_CONFIG1) or 0x79 (EMS_DEVICE_FLAG_JUNKERS_CONFIG2) + // see https://github.com/proddy/EMS-ESP/issues/335#issuecomment-593324716) + if ((model & 0x3F) == EMS_DEVICE_FLAG_JUNKERS_CONFIG1) { + // EMS_DEVICE_FLAG_JUNKERS_CONFIG1 - new models like the FW series switch (temptype) { case THERMOSTAT_TEMP_MODE_NOFROST: EMS_TxTelegram.offset = EMS_OFFSET_JunkersSetMessage_no_frost_temp; @@ -2483,6 +2491,7 @@ void ems_setThermostatTemp(float temperature, uint8_t hc_num, _THERMOSTAT_TEMP_M EMS_TxTelegram.type = EMS_TYPE_JunkersSetMessage1_HC1 + hc_num - 1; // 0x65 EMS_TxTelegram.comparisonPostRead = EMS_TYPE_JunkersStatusMessage_HC1 + hc_num - 1; } else { + // EMS_DEVICE_FLAG_JUNKERS_CONFIG2 switch (temptype) { case THERMOSTAT_TEMP_MODE_NOFROST: EMS_TxTelegram.offset = EMS_OFFSET_JunkersSetMessage2_no_frost_temp; diff --git a/src/version.h b/src/version.h index d01d75c46..28bd23e18 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define APP_VERSION "1.9.5b48" +#define APP_VERSION "1.9.5b49"