mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
Merge remote-tracking branch 'upstream/dev' into MM10
This commit is contained in:
@@ -557,8 +557,6 @@ void publishEMSValues(bool force) {
|
|||||||
StaticJsonDocument<MQTT_MAX_PAYLOAD_SIZE> doc;
|
StaticJsonDocument<MQTT_MAX_PAYLOAD_SIZE> doc;
|
||||||
char data[MQTT_MAX_PAYLOAD_SIZE] = {0};
|
char data[MQTT_MAX_PAYLOAD_SIZE] = {0};
|
||||||
|
|
||||||
static uint8_t last_boilerActive = 0xFF; // for remembering last setting of the tap water or heating on/off
|
|
||||||
|
|
||||||
// do we have boiler changes?
|
// do we have boiler changes?
|
||||||
if (ems_getBoilerEnabled() && (ems_Device_has_flags(EMS_DEVICE_UPDATE_FLAG_BOILER) || force)) {
|
if (ems_getBoilerEnabled() && (ems_Device_has_flags(EMS_DEVICE_UPDATE_FLAG_BOILER) || force)) {
|
||||||
JsonObject rootBoiler = doc.to<JsonObject>();
|
JsonObject rootBoiler = doc.to<JsonObject>();
|
||||||
@@ -663,6 +661,7 @@ void publishEMSValues(bool force) {
|
|||||||
|
|
||||||
// see if the heating or hot tap water has changed, if so send
|
// see if the heating or hot tap water has changed, if so send
|
||||||
// last_boilerActive stores heating in bit 1 and tap water in bit 2
|
// last_boilerActive stores heating in bit 1 and tap water in bit 2
|
||||||
|
static uint8_t last_boilerActive = 0xFF; // for remembering last setting of the tap water or heating on/off
|
||||||
if ((last_boilerActive != ((EMS_Boiler.tapwaterActive << 1) + EMS_Boiler.heatingActive)) || force) {
|
if ((last_boilerActive != ((EMS_Boiler.tapwaterActive << 1) + EMS_Boiler.heatingActive)) || force) {
|
||||||
myDebugLog("Publishing hot water and heating states via MQTT");
|
myDebugLog("Publishing hot water and heating states via MQTT");
|
||||||
myESP.mqttPublish(TOPIC_BOILER_TAPWATER_ACTIVE, EMS_Boiler.tapwaterActive == 1 ? "1" : "0");
|
myESP.mqttPublish(TOPIC_BOILER_TAPWATER_ACTIVE, EMS_Boiler.tapwaterActive == 1 ? "1" : "0");
|
||||||
@@ -1112,6 +1111,9 @@ bool SetListCallback(MYESP_FSACTION_t action, uint8_t wc, const char * setting,
|
|||||||
uint8_t pid = atoi(value);
|
uint8_t pid = atoi(value);
|
||||||
EMSESP_Settings.master_thermostat = pid;
|
EMSESP_Settings.master_thermostat = pid;
|
||||||
ems_setMasterThermostat(pid);
|
ems_setMasterThermostat(pid);
|
||||||
|
// force a scan
|
||||||
|
ems_clearDeviceList();
|
||||||
|
ems_doReadCommand(EMS_TYPE_UBADevices, EMS_Boiler.device_id);
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
57
src/ems.cpp
57
src/ems.cpp
@@ -123,7 +123,7 @@ void ems_init() {
|
|||||||
// init all mixing modules
|
// init all mixing modules
|
||||||
for (uint8_t i = 0; i < EMS_THERMOSTAT_MAXHC; i++) {
|
for (uint8_t i = 0; i < EMS_THERMOSTAT_MAXHC; i++) {
|
||||||
EMS_Mixing.hc[i].hc = i + 1;
|
EMS_Mixing.hc[i].hc = i + 1;
|
||||||
EMS_Mixing.hc[i].flowTemp = EMS_VALUE_SHORT_NOTSET;
|
EMS_Mixing.hc[i].flowTemp = EMS_VALUE_USHORT_NOTSET;
|
||||||
EMS_Mixing.hc[i].pumpMod = EMS_VALUE_INT_NOTSET;
|
EMS_Mixing.hc[i].pumpMod = EMS_VALUE_INT_NOTSET;
|
||||||
EMS_Mixing.hc[i].valveStatus = EMS_VALUE_INT_NOTSET;
|
EMS_Mixing.hc[i].valveStatus = EMS_VALUE_INT_NOTSET;
|
||||||
EMS_Mixing.hc[i].flowSetTemp = EMS_VALUE_INT_NOTSET;
|
EMS_Mixing.hc[i].flowSetTemp = EMS_VALUE_INT_NOTSET;
|
||||||
@@ -750,14 +750,14 @@ void ems_parseTelegram(uint8_t * telegram, uint8_t length) {
|
|||||||
* or either a return code like 0x01 or 0x04 from the last Write command
|
* or either a return code like 0x01 or 0x04 from the last Write command
|
||||||
*/
|
*/
|
||||||
if (length == 1) {
|
if (length == 1) {
|
||||||
uint8_t value = telegram[0]; // 1st byte of data package
|
uint8_t value = telegram[0]; // 1st byte of data package
|
||||||
static uint32_t _last_emsPollFrequency = 0;
|
|
||||||
|
|
||||||
// check first for a Poll for us
|
// check first for a Poll for us
|
||||||
if ((value ^ 0x80 ^ EMS_Sys_Status.emsIDMask) == EMS_ID_ME) {
|
if ((value ^ 0x80 ^ EMS_Sys_Status.emsIDMask) == EMS_ID_ME) {
|
||||||
uint32_t timenow_microsecs = micros();
|
static uint32_t _last_emsPollFrequency = 0;
|
||||||
EMS_Sys_Status.emsPollFrequency = (timenow_microsecs - _last_emsPollFrequency);
|
uint32_t timenow_microsecs = micros();
|
||||||
_last_emsPollFrequency = timenow_microsecs;
|
EMS_Sys_Status.emsPollFrequency = (timenow_microsecs - _last_emsPollFrequency);
|
||||||
|
_last_emsPollFrequency = timenow_microsecs;
|
||||||
|
|
||||||
// do we have something to send thats waiting in the Tx queue?
|
// do we have something to send thats waiting in the Tx queue?
|
||||||
// if so send it if the Queue is not in a wait state
|
// if so send it if the Queue is not in a wait state
|
||||||
@@ -878,7 +878,6 @@ void _printMessage(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
uint8_t length = EMS_RxTelegram->data_length;
|
uint8_t length = EMS_RxTelegram->data_length;
|
||||||
|
|
||||||
char output_str[200] = {0};
|
char output_str[200] = {0};
|
||||||
char buffer[16] = {0};
|
|
||||||
char color_s[20] = {0};
|
char color_s[20] = {0};
|
||||||
char type_s[30];
|
char type_s[30];
|
||||||
|
|
||||||
@@ -900,6 +899,7 @@ void _printMessage(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (length) {
|
if (length) {
|
||||||
|
char buffer[16] = {0};
|
||||||
// type
|
// type
|
||||||
strlcat(output_str, ", type 0x", sizeof(output_str));
|
strlcat(output_str, ", type 0x", sizeof(output_str));
|
||||||
|
|
||||||
@@ -1731,7 +1731,8 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
|
|
||||||
uint8_t flags = EMS_Devices[i].flags; // its a new entry, set the specifics
|
uint8_t flags = EMS_Devices[i].flags; // its a new entry, set the specifics
|
||||||
|
|
||||||
if (type == EMS_DEVICE_TYPE_BOILER) {
|
if ((type == EMS_DEVICE_TYPE_BOILER) && (device_id == EMS_ID_BOILER)) {
|
||||||
|
// with UBAMasters, there is only one device_id 0x08. To avoid https://github.com/proddy/EMS-ESP/issues/271
|
||||||
EMS_Boiler.device_id = device_id;
|
EMS_Boiler.device_id = device_id;
|
||||||
EMS_Boiler.product_id = product_id;
|
EMS_Boiler.product_id = product_id;
|
||||||
EMS_Boiler.device_flags = flags;
|
EMS_Boiler.device_flags = flags;
|
||||||
@@ -2027,17 +2028,19 @@ void ems_scanDevices() {
|
|||||||
|
|
||||||
std::list<uint8_t> Device_Ids; // create a new list
|
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_BOILER); // UBAMaster/Boilers - 0x08
|
||||||
Device_Ids.push_back(EMS_ID_HP); // HeatPump - 0x38
|
Device_Ids.push_back(EMS_ID_HP); // HeatPump - 0x38
|
||||||
Device_Ids.push_back(EMS_ID_SM); // Solar Module - 0x30
|
Device_Ids.push_back(EMS_ID_SM); // Solar Module - 0x30
|
||||||
Device_Ids.push_back(0x09); // Controllers - 0x09
|
Device_Ids.push_back(EMS_ID_CONTROLLER); // Controllers - 0x09
|
||||||
Device_Ids.push_back(0x02); // Connect - 0x02
|
Device_Ids.push_back(EMS_ID_CONNECT1); // Connect - 0x02
|
||||||
Device_Ids.push_back(0x48); // Gateway - 0x48
|
Device_Ids.push_back(EMS_ID_CONNECT2); // Connect - 0x50
|
||||||
Device_Ids.push_back(0x20); // Mixing Devices - 0x20, 0x21
|
Device_Ids.push_back(EMS_ID_GATEWAY); // Gateway - 0x48
|
||||||
Device_Ids.push_back(0x21); // Mixing Devices - 0x20, 0x21
|
Device_Ids.push_back(EMS_ID_MIXING1); // Mixing Devices - 0x20, 0x21
|
||||||
Device_Ids.push_back(0x10); // Thermostats - 0x10, 0x17, 0x18
|
Device_Ids.push_back(EMS_ID_MIXING2); // Mixing Devices - 0x20, 0x21
|
||||||
Device_Ids.push_back(0x17); // Thermostats - 0x10, 0x17, 0x18
|
Device_Ids.push_back(EMS_ID_THERMOSTAT1); // Thermostats - 0x10, 0x17, 0x18
|
||||||
Device_Ids.push_back(0x18); // Thermostats - 0x10, 0x17, 0x18
|
Device_Ids.push_back(EMS_ID_THERMOSTAT2); // Thermostats - 0x10, 0x17, 0x18
|
||||||
|
Device_Ids.push_back(EMS_ID_THERMOSTAT3); // Thermostats - 0x10, 0x17, 0x18
|
||||||
|
Device_Ids.push_back(EMS_ID_SWITCH); // Switch - 0x11
|
||||||
|
|
||||||
// remove duplicates and reserved IDs (like our own device)
|
// remove duplicates and reserved IDs (like our own device)
|
||||||
Device_Ids.sort();
|
Device_Ids.sort();
|
||||||
@@ -2084,22 +2087,26 @@ void ems_printDevices() {
|
|||||||
if (!Devices.empty()) {
|
if (!Devices.empty()) {
|
||||||
bool have_unknowns = false;
|
bool have_unknowns = false;
|
||||||
char device_string[100];
|
char device_string[100];
|
||||||
|
char device_type[30];
|
||||||
myDebug_P(PSTR("and %d were recognized by EMS-ESP as:"), Devices.size());
|
myDebug_P(PSTR("and %d were recognized by EMS-ESP as:"), Devices.size());
|
||||||
for (std::list<_Detected_Device>::iterator it = Devices.begin(); it != Devices.end(); ++it) {
|
for (std::list<_Detected_Device>::iterator it = Devices.begin(); it != Devices.end(); ++it) {
|
||||||
if ((it)->known) {
|
ems_getDeviceTypeDescription(it->device_id, device_type); // get type string, e.g. "Boiler"
|
||||||
strlcpy(device_string, (it)->device_desc_p, sizeof(device_string));
|
|
||||||
|
if (it->known) {
|
||||||
|
strlcpy(device_string, it->device_desc_p, sizeof(device_string));
|
||||||
} else {
|
} else {
|
||||||
strlcpy(device_string, EMS_MODELTYPE_UNKNOWN_STRING, sizeof(device_string)); // Unknown
|
strlcpy(device_string, EMS_MODELTYPE_UNKNOWN_STRING, sizeof(device_string)); // Unknown
|
||||||
have_unknowns = true;
|
have_unknowns = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
myDebug_P(PSTR(" %s%s%s (DeviceID:0x%02X ProductID:%d Version:%s)"),
|
myDebug_P(PSTR(" %s: %s%s%s (DeviceID:0x%02X ProductID:%d Version:%s)"),
|
||||||
|
device_type,
|
||||||
COLOR_BOLD_ON,
|
COLOR_BOLD_ON,
|
||||||
device_string,
|
device_string,
|
||||||
COLOR_BOLD_OFF,
|
COLOR_BOLD_OFF,
|
||||||
(it)->device_id,
|
it->device_id,
|
||||||
(it)->product_id,
|
it->product_id,
|
||||||
(it)->version);
|
it->version);
|
||||||
}
|
}
|
||||||
|
|
||||||
myDebug_P(PSTR("")); // newline
|
myDebug_P(PSTR("")); // newline
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ const _EMS_Device_Types EMS_Devices_Types[] = {
|
|||||||
#define EMS_OFFSET_MMPLUSStatusMessage_valve_status 2 // valve in percent
|
#define EMS_OFFSET_MMPLUSStatusMessage_valve_status 2 // valve in percent
|
||||||
|
|
||||||
// MM10
|
// MM10
|
||||||
#define EMS_TYPE_MMStatusMessage 0xAB // mixer status
|
#define EMS_TYPE_MMStatusMessage 0xAB // mixer status
|
||||||
#define EMS_OFFSET_MMStatusMessage_flow_set 0 // flow setpoint
|
#define EMS_OFFSET_MMStatusMessage_flow_set 0 // flow setpoint
|
||||||
#define EMS_OFFSET_MMStatusMessage_flow_temp 1 // flow temperature
|
#define EMS_OFFSET_MMStatusMessage_flow_temp 1 // flow temperature
|
||||||
#define EMS_OFFSET_MMStatusMessage_pump_mod 3 // pump modulation in percent
|
#define EMS_OFFSET_MMStatusMessage_pump_mod 3 // pump modulation in percent
|
||||||
@@ -264,6 +264,7 @@ static const _EMS_Device EMS_Devices[] = {
|
|||||||
{169, EMS_DEVICE_TYPE_CONTROLLER, "BC40 Base Controller", EMS_DEVICE_FLAG_NONE}, // 0x09
|
{169, EMS_DEVICE_TYPE_CONTROLLER, "BC40 Base Controller", EMS_DEVICE_FLAG_NONE}, // 0x09
|
||||||
{152, EMS_DEVICE_TYPE_CONTROLLER, "Controller", EMS_DEVICE_FLAG_NONE}, // 0x09
|
{152, EMS_DEVICE_TYPE_CONTROLLER, "Controller", EMS_DEVICE_FLAG_NONE}, // 0x09
|
||||||
{95, EMS_DEVICE_TYPE_CONTROLLER, "HT3 Controller", EMS_DEVICE_FLAG_NONE}, // 0x09
|
{95, EMS_DEVICE_TYPE_CONTROLLER, "HT3 Controller", EMS_DEVICE_FLAG_NONE}, // 0x09
|
||||||
|
{209, EMS_DEVICE_TYPE_CONTROLLER, "W-B ErP Boiler Control Panel", EMS_DEVICE_FLAG_NONE}, // 0x09
|
||||||
{230, EMS_DEVICE_TYPE_CONTROLLER, "BC Base Controller", EMS_DEVICE_FLAG_NONE}, // 0x09
|
{230, EMS_DEVICE_TYPE_CONTROLLER, "BC Base Controller", EMS_DEVICE_FLAG_NONE}, // 0x09
|
||||||
{205, EMS_DEVICE_TYPE_CONNECT, "Nefit Moduline Easy Connect", EMS_DEVICE_FLAG_NONE}, // 0x02
|
{205, EMS_DEVICE_TYPE_CONNECT, "Nefit Moduline Easy Connect", EMS_DEVICE_FLAG_NONE}, // 0x02
|
||||||
{206, EMS_DEVICE_TYPE_CONNECT, "Bosch Easy Connect", EMS_DEVICE_FLAG_NONE}, // 0x02
|
{206, EMS_DEVICE_TYPE_CONNECT, "Bosch Easy Connect", EMS_DEVICE_FLAG_NONE}, // 0x02
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define APP_VERSION "1.9.5b7"
|
#define APP_VERSION "1.9.5b8"
|
||||||
|
|||||||
Reference in New Issue
Block a user