mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
This commit is contained in:
@@ -113,7 +113,7 @@ static const command_t project_cmds[] PROGMEM = {
|
|||||||
{false, "refresh", "fetch values from the EMS devices"},
|
{false, "refresh", "fetch values from the EMS devices"},
|
||||||
{false, "devices", "list detected EMS devices"},
|
{false, "devices", "list detected EMS devices"},
|
||||||
{false, "queue", "show current Tx queue"},
|
{false, "queue", "show current Tx queue"},
|
||||||
{false, "autodetect", "scan for EMS devices and external sensors"},
|
{false, "autodetect [scan]", "scan for EMS devices and external sensors. scan uses brute-force"},
|
||||||
{false, "send XX ...", "send raw telegram data to EMS bus (XX are hex values)"},
|
{false, "send XX ...", "send raw telegram data to EMS bus (XX are hex values)"},
|
||||||
{false, "thermostat read <type ID>", "send read request to the thermostat for heating circuit hc 1-4"},
|
{false, "thermostat read <type ID>", "send read request to the thermostat for heating circuit hc 1-4"},
|
||||||
{false, "thermostat temp [hc] <degrees>", "set current thermostat temperature"},
|
{false, "thermostat temp [hc] <degrees>", "set current thermostat temperature"},
|
||||||
@@ -1275,12 +1275,20 @@ void TelnetCommandCallback(uint8_t wc, const char * commandLine) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(first_cmd, "autodetect") == 0) {
|
if (strcmp(first_cmd, "autodetect") == 0) {
|
||||||
|
if (wc == 2) {
|
||||||
|
char * second_cmd = _readWord();
|
||||||
|
if (strcmp(second_cmd, "scan") == 0) {
|
||||||
|
ems_scanDevices(); // known device scan
|
||||||
|
ok = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
myDebug("Scanning for new EMS devices and attached external sensors...");
|
myDebug("Scanning for new EMS devices and attached external sensors...");
|
||||||
scanDallas();
|
scanDallas();
|
||||||
ems_clearDeviceList();
|
ems_clearDeviceList();
|
||||||
ems_doReadCommand(EMS_TYPE_UBADevices, EMS_Boiler.device_id);
|
ems_doReadCommand(EMS_TYPE_UBADevices, EMS_Boiler.device_id);
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// logging
|
// logging
|
||||||
if ((strcmp(first_cmd, "log") == 0) && (wc >= 2)) {
|
if ((strcmp(first_cmd, "log") == 0) && (wc >= 2)) {
|
||||||
|
|||||||
51
src/ems.cpp
51
src/ems.cpp
@@ -1839,7 +1839,7 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
uint8_t found_index = 0;
|
uint8_t found_index = 0;
|
||||||
bool typeFound = false;
|
bool typeFound = false;
|
||||||
while (i < _EMS_Devices_max) {
|
while (i < _EMS_Devices_max) {
|
||||||
if ((EMS_Devices[i].product_id == product_id) && (EMS_Devices[i].type != EMS_DEVICE_TYPE_BOILER)) {
|
if ((EMS_Devices[i].product_id == product_id)) {
|
||||||
// we have a matching product id
|
// we have a matching product id
|
||||||
typeFound = true;
|
typeFound = true;
|
||||||
found_index = i;
|
found_index = i;
|
||||||
@@ -1857,9 +1857,15 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
const char * device_desc_p = (EMS_Devices[found_index].device_desc); // pointer to the full description of the device
|
const char * device_desc_p = (EMS_Devices[found_index].device_desc); // pointer to the full description of the device
|
||||||
_EMS_DEVICE_TYPE type = EMS_Devices[found_index].type; // device type
|
_EMS_DEVICE_TYPE type = EMS_Devices[found_index].type; // device type
|
||||||
|
|
||||||
// we recognized it, see if we already have it in our recognized list
|
// sometimes boilers have a built-in controller on device ID 0x09
|
||||||
|
// we don't want this to appear as another boiler so switch them
|
||||||
|
if ((type == EMS_DEVICE_TYPE_BOILER) && (device_id = EMS_ID_CONTROLLER)) {
|
||||||
|
type = EMS_DEVICE_TYPE_CONTROLLER;
|
||||||
|
}
|
||||||
|
|
||||||
|
// we recognized it, add it to list
|
||||||
if (_addDevice(type, product_id, device_id, device_desc_p, version, brand)) {
|
if (_addDevice(type, product_id, device_id, device_desc_p, version, brand)) {
|
||||||
return; // already in list
|
return; // already in list, don't bother initializing it
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t flags = EMS_Devices[found_index].flags; // it's a new entry, get the specifics
|
uint8_t flags = EMS_Devices[found_index].flags; // it's a new entry, get the specifics
|
||||||
@@ -2388,7 +2394,7 @@ void ems_setThermostatTemp(float temperature, uint8_t hc_num, uint8_t temptype)
|
|||||||
|
|
||||||
EMS_TxTelegram.type_validate = EMS_ID_NONE; // validate by reading from a different telegram
|
EMS_TxTelegram.type_validate = EMS_ID_NONE; // validate by reading from a different telegram
|
||||||
|
|
||||||
} else if (model == EMS_DEVICE_FLAG_RC35) {
|
} else if ((model == EMS_DEVICE_FLAG_RC35) || (model == EMS_DEVICE_FLAG_RC30N)) {
|
||||||
switch (temptype) {
|
switch (temptype) {
|
||||||
case 1: // change the night temp
|
case 1: // change the night temp
|
||||||
EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_temp_night;
|
EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_temp_night;
|
||||||
@@ -2401,15 +2407,16 @@ void ems_setThermostatTemp(float temperature, uint8_t hc_num, uint8_t temptype)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case 0: // automatic selection, if no type is defined, we use the standard code
|
case 0: // automatic selection, if no type is defined, we use the standard code
|
||||||
|
if (model == EMS_DEVICE_FLAG_RC35) {
|
||||||
|
// https://github.com/proddy/EMS-ESP/issues/310
|
||||||
EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_seltemp;
|
EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_seltemp;
|
||||||
|
} else {
|
||||||
/* commented out for https://github.com/proddy/EMS-ESP/issues/310
|
|
||||||
if (EMS_Thermostat.hc[hc_num - 1].day_mode == 0) {
|
if (EMS_Thermostat.hc[hc_num - 1].day_mode == 0) {
|
||||||
EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_temp_night;
|
EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_temp_night;
|
||||||
} else if (EMS_Thermostat.hc[hc_num - 1].day_mode == 1) {
|
} else if (EMS_Thermostat.hc[hc_num - 1].day_mode == 1) {
|
||||||
EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_temp_day;
|
EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_temp_day;
|
||||||
}
|
}
|
||||||
*/
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3171,3 +3178,33 @@ void ems_doReadCommand(uint16_t type, uint8_t dest) {
|
|||||||
|
|
||||||
EMS_TxQueue.push(EMS_TxTelegram);
|
EMS_TxQueue.push(EMS_TxTelegram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the versions of our connected devices
|
||||||
|
*/
|
||||||
|
void ems_scanDevices() {
|
||||||
|
myDebug_P(PSTR("Started scanning the EMS bus for known devices"));
|
||||||
|
|
||||||
|
std::list<uint8_t> Device_Ids; // create a new list
|
||||||
|
|
||||||
|
Device_Ids.push_back(EMS_ID_BOILER); // UBAMaster/Boilers - 0x08
|
||||||
|
Device_Ids.push_back(EMS_ID_HP); // HeatPump - 0x38
|
||||||
|
Device_Ids.push_back(EMS_ID_SM); // Solar Module - 0x30
|
||||||
|
Device_Ids.push_back(0x09); // Controllers - 0x09
|
||||||
|
Device_Ids.push_back(0x02); // Connect - 0x02
|
||||||
|
Device_Ids.push_back(0x48); // Gateway - 0x48
|
||||||
|
Device_Ids.push_back(0x20); // Mixing Devices - 0x20
|
||||||
|
Device_Ids.push_back(0x21); // Mixing Devices - 0x21
|
||||||
|
Device_Ids.push_back(0x10); // Thermostats - 0x10
|
||||||
|
Device_Ids.push_back(0x17); // Thermostats - 0x17
|
||||||
|
Device_Ids.push_back(0x18); // Thermostats - 0x18
|
||||||
|
|
||||||
|
// remove duplicates and reserved IDs (like our own device)
|
||||||
|
// Device_Ids.sort();
|
||||||
|
// Device_Ids.unique();
|
||||||
|
|
||||||
|
// send the read command with Version command
|
||||||
|
for (uint8_t device_id : Device_Ids) {
|
||||||
|
ems_doReadCommand(EMS_TYPE_Version, device_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,9 +50,10 @@
|
|||||||
#define EMS_DEVICE_FLAG_RC10 2
|
#define EMS_DEVICE_FLAG_RC10 2
|
||||||
#define EMS_DEVICE_FLAG_RC20 3
|
#define EMS_DEVICE_FLAG_RC20 3
|
||||||
#define EMS_DEVICE_FLAG_RC30 4
|
#define EMS_DEVICE_FLAG_RC30 4
|
||||||
#define EMS_DEVICE_FLAG_RC35 5
|
#define EMS_DEVICE_FLAG_RC30N 5 // newer type of RC30 with RC35 circuit
|
||||||
#define EMS_DEVICE_FLAG_RC300 6
|
#define EMS_DEVICE_FLAG_RC35 6
|
||||||
#define EMS_DEVICE_FLAG_JUNKERS 7
|
#define EMS_DEVICE_FLAG_RC300 7
|
||||||
|
#define EMS_DEVICE_FLAG_JUNKERS 8
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EMS_THERMOSTAT_MODE_UNKNOWN,
|
EMS_THERMOSTAT_MODE_UNKNOWN,
|
||||||
@@ -479,6 +480,7 @@ void ems_Device_add_flags(unsigned int flags);
|
|||||||
bool ems_Device_has_flags(unsigned int flags);
|
bool ems_Device_has_flags(unsigned int flags);
|
||||||
void ems_Device_remove_flags(unsigned int flags);
|
void ems_Device_remove_flags(unsigned int flags);
|
||||||
bool ems_isHT3();
|
bool ems_isHT3();
|
||||||
|
void ems_scanDevices();
|
||||||
|
|
||||||
// private functions
|
// private functions
|
||||||
uint8_t _crcCalculator(uint8_t * data, uint8_t len);
|
uint8_t _crcCalculator(uint8_t * data, uint8_t len);
|
||||||
|
|||||||
@@ -14,8 +14,9 @@
|
|||||||
// Fixed EMS Device IDs
|
// Fixed EMS Device IDs
|
||||||
#define EMS_ID_ME 0x0B // our device, hardcoded as the "Service Key"
|
#define EMS_ID_ME 0x0B // our device, hardcoded as the "Service Key"
|
||||||
#define EMS_ID_BOILER 0x08 // all UBA Boilers have 0x08
|
#define EMS_ID_BOILER 0x08 // all UBA Boilers have 0x08
|
||||||
|
|
||||||
#define EMS_ID_SM 0x30 // Solar Module SM10, SM100, SM200 and ISM1
|
#define EMS_ID_SM 0x30 // Solar Module SM10, SM100, SM200 and ISM1
|
||||||
|
#define EMS_ID_HP 0x38 // Heat Pump
|
||||||
|
#define EMS_ID_CONTROLLER 0x09 // controllers, some are built in
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Common Type
|
* Common Type
|
||||||
@@ -278,7 +279,7 @@ static const _EMS_Device EMS_Devices[] = {
|
|||||||
// Buderus/Nefit specific
|
// Buderus/Nefit specific
|
||||||
{79, EMS_DEVICE_TYPE_THERMOSTAT, "RC10/Moduline 100", EMS_DEVICE_FLAG_RC10}, // 0x17
|
{79, EMS_DEVICE_TYPE_THERMOSTAT, "RC10/Moduline 100", EMS_DEVICE_FLAG_RC10}, // 0x17
|
||||||
{77, EMS_DEVICE_TYPE_THERMOSTAT, "RC20/Moduline 300", EMS_DEVICE_FLAG_RC20}, // 0x17
|
{77, EMS_DEVICE_TYPE_THERMOSTAT, "RC20/Moduline 300", EMS_DEVICE_FLAG_RC20}, // 0x17
|
||||||
{67, EMS_DEVICE_TYPE_THERMOSTAT, "RC30", EMS_DEVICE_FLAG_RC35}, // 0x10 - based on RC35
|
{67, EMS_DEVICE_TYPE_THERMOSTAT, "RC30", EMS_DEVICE_FLAG_RC30N}, // 0x10 - based on RC35
|
||||||
{78, EMS_DEVICE_TYPE_THERMOSTAT, "Moduline 400", EMS_DEVICE_FLAG_RC30}, // 0x10
|
{78, EMS_DEVICE_TYPE_THERMOSTAT, "Moduline 400", EMS_DEVICE_FLAG_RC30}, // 0x10
|
||||||
{86, EMS_DEVICE_TYPE_THERMOSTAT, "RC35", EMS_DEVICE_FLAG_RC35}, // 0x10
|
{86, EMS_DEVICE_TYPE_THERMOSTAT, "RC35", EMS_DEVICE_FLAG_RC35}, // 0x10
|
||||||
{93, EMS_DEVICE_TYPE_THERMOSTAT, "RC20RF", EMS_DEVICE_FLAG_RC20}, // 0x19
|
{93, EMS_DEVICE_TYPE_THERMOSTAT, "RC20RF", EMS_DEVICE_FLAG_RC20}, // 0x19
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define APP_VERSION "1.9.5b25"
|
#define APP_VERSION "1.9.5b26"
|
||||||
|
|||||||
Reference in New Issue
Block a user