mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +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, "devices", "list detected EMS devices"},
|
||||
{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, "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"},
|
||||
@@ -1275,11 +1275,19 @@ void TelnetCommandCallback(uint8_t wc, const char * commandLine) {
|
||||
}
|
||||
|
||||
if (strcmp(first_cmd, "autodetect") == 0) {
|
||||
myDebug("Scanning for new EMS devices and attached external sensors...");
|
||||
scanDallas();
|
||||
ems_clearDeviceList();
|
||||
ems_doReadCommand(EMS_TYPE_UBADevices, EMS_Boiler.device_id);
|
||||
ok = true;
|
||||
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...");
|
||||
scanDallas();
|
||||
ems_clearDeviceList();
|
||||
ems_doReadCommand(EMS_TYPE_UBADevices, EMS_Boiler.device_id);
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
|
||||
// logging
|
||||
|
||||
61
src/ems.cpp
61
src/ems.cpp
@@ -1839,7 +1839,7 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
uint8_t found_index = 0;
|
||||
bool typeFound = false;
|
||||
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
|
||||
typeFound = true;
|
||||
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
|
||||
_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)) {
|
||||
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
|
||||
@@ -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
|
||||
|
||||
} else if (model == EMS_DEVICE_FLAG_RC35) {
|
||||
} else if ((model == EMS_DEVICE_FLAG_RC35) || (model == EMS_DEVICE_FLAG_RC30N)) {
|
||||
switch (temptype) {
|
||||
case 1: // change the night temp
|
||||
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;
|
||||
default:
|
||||
case 0: // automatic selection, if no type is defined, we use the standard code
|
||||
EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_seltemp;
|
||||
|
||||
/* commented out for https://github.com/proddy/EMS-ESP/issues/310
|
||||
if (EMS_Thermostat.hc[hc_num - 1].day_mode == 0) {
|
||||
EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_temp_night;
|
||||
} else if (EMS_Thermostat.hc[hc_num - 1].day_mode == 1) {
|
||||
EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_temp_day;
|
||||
if (model == EMS_DEVICE_FLAG_RC35) {
|
||||
// https://github.com/proddy/EMS-ESP/issues/310
|
||||
EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_seltemp;
|
||||
} else {
|
||||
if (EMS_Thermostat.hc[hc_num - 1].day_mode == 0) {
|
||||
EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_temp_night;
|
||||
} else if (EMS_Thermostat.hc[hc_num - 1].day_mode == 1) {
|
||||
EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_temp_day;
|
||||
}
|
||||
}
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3171,3 +3178,33 @@ void ems_doReadCommand(uint16_t type, uint8_t dest) {
|
||||
|
||||
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_RC20 3
|
||||
#define EMS_DEVICE_FLAG_RC30 4
|
||||
#define EMS_DEVICE_FLAG_RC35 5
|
||||
#define EMS_DEVICE_FLAG_RC300 6
|
||||
#define EMS_DEVICE_FLAG_JUNKERS 7
|
||||
#define EMS_DEVICE_FLAG_RC30N 5 // newer type of RC30 with RC35 circuit
|
||||
#define EMS_DEVICE_FLAG_RC35 6
|
||||
#define EMS_DEVICE_FLAG_RC300 7
|
||||
#define EMS_DEVICE_FLAG_JUNKERS 8
|
||||
|
||||
typedef enum {
|
||||
EMS_THERMOSTAT_MODE_UNKNOWN,
|
||||
@@ -479,6 +480,7 @@ void ems_Device_add_flags(unsigned int flags);
|
||||
bool ems_Device_has_flags(unsigned int flags);
|
||||
void ems_Device_remove_flags(unsigned int flags);
|
||||
bool ems_isHT3();
|
||||
void ems_scanDevices();
|
||||
|
||||
// private functions
|
||||
uint8_t _crcCalculator(uint8_t * data, uint8_t len);
|
||||
|
||||
@@ -12,10 +12,11 @@
|
||||
#include "ems.h"
|
||||
|
||||
// Fixed EMS Device IDs
|
||||
#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_SM 0x30 // Solar Module SM10, SM100, SM200 and ISM1
|
||||
#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_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
|
||||
@@ -278,7 +279,7 @@ static const _EMS_Device EMS_Devices[] = {
|
||||
// Buderus/Nefit specific
|
||||
{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
|
||||
{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
|
||||
{86, EMS_DEVICE_TYPE_THERMOSTAT, "RC35", EMS_DEVICE_FLAG_RC35}, // 0x10
|
||||
{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