Merge remote-tracking branch 'upstream/dev' into MM10

This commit is contained in:
MichaelDvP
2020-01-01 13:24:26 +01:00
4 changed files with 39 additions and 29 deletions

View File

@@ -557,8 +557,6 @@ void publishEMSValues(bool force) {
StaticJsonDocument<MQTT_MAX_PAYLOAD_SIZE> doc;
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?
if (ems_getBoilerEnabled() && (ems_Device_has_flags(EMS_DEVICE_UPDATE_FLAG_BOILER) || force)) {
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
// 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) {
myDebugLog("Publishing hot water and heating states via MQTT");
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);
EMSESP_Settings.master_thermostat = pid;
ems_setMasterThermostat(pid);
// force a scan
ems_clearDeviceList();
ems_doReadCommand(EMS_TYPE_UBADevices, EMS_Boiler.device_id);
ok = true;
}
}

View File

@@ -123,7 +123,7 @@ void ems_init() {
// init all mixing modules
for (uint8_t i = 0; i < EMS_THERMOSTAT_MAXHC; i++) {
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].valveStatus = EMS_VALUE_INT_NOTSET;
EMS_Mixing.hc[i].flowSetTemp = EMS_VALUE_INT_NOTSET;
@@ -751,10 +751,10 @@ void ems_parseTelegram(uint8_t * telegram, uint8_t length) {
*/
if (length == 1) {
uint8_t value = telegram[0]; // 1st byte of data package
static uint32_t _last_emsPollFrequency = 0;
// check first for a Poll for us
if ((value ^ 0x80 ^ EMS_Sys_Status.emsIDMask) == EMS_ID_ME) {
static uint32_t _last_emsPollFrequency = 0;
uint32_t timenow_microsecs = micros();
EMS_Sys_Status.emsPollFrequency = (timenow_microsecs - _last_emsPollFrequency);
_last_emsPollFrequency = timenow_microsecs;
@@ -878,7 +878,6 @@ void _printMessage(_EMS_RxTelegram * EMS_RxTelegram) {
uint8_t length = EMS_RxTelegram->data_length;
char output_str[200] = {0};
char buffer[16] = {0};
char color_s[20] = {0};
char type_s[30];
@@ -900,6 +899,7 @@ void _printMessage(_EMS_RxTelegram * EMS_RxTelegram) {
}
if (length) {
char buffer[16] = {0};
// type
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
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.product_id = product_id;
EMS_Boiler.device_flags = flags;
@@ -2030,14 +2031,16 @@ void ems_scanDevices() {
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, 0x21
Device_Ids.push_back(0x21); // Mixing Devices - 0x20, 0x21
Device_Ids.push_back(0x10); // Thermostats - 0x10, 0x17, 0x18
Device_Ids.push_back(0x17); // Thermostats - 0x10, 0x17, 0x18
Device_Ids.push_back(0x18); // Thermostats - 0x10, 0x17, 0x18
Device_Ids.push_back(EMS_ID_CONTROLLER); // Controllers - 0x09
Device_Ids.push_back(EMS_ID_CONNECT1); // Connect - 0x02
Device_Ids.push_back(EMS_ID_CONNECT2); // Connect - 0x50
Device_Ids.push_back(EMS_ID_GATEWAY); // Gateway - 0x48
Device_Ids.push_back(EMS_ID_MIXING1); // Mixing Devices - 0x20, 0x21
Device_Ids.push_back(EMS_ID_MIXING2); // Mixing Devices - 0x20, 0x21
Device_Ids.push_back(EMS_ID_THERMOSTAT1); // 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)
Device_Ids.sort();
@@ -2084,22 +2087,26 @@ void ems_printDevices() {
if (!Devices.empty()) {
bool have_unknowns = false;
char device_string[100];
char device_type[30];
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) {
if ((it)->known) {
strlcpy(device_string, (it)->device_desc_p, sizeof(device_string));
ems_getDeviceTypeDescription(it->device_id, device_type); // get type string, e.g. "Boiler"
if (it->known) {
strlcpy(device_string, it->device_desc_p, sizeof(device_string));
} else {
strlcpy(device_string, EMS_MODELTYPE_UNKNOWN_STRING, sizeof(device_string)); // Unknown
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,
device_string,
COLOR_BOLD_OFF,
(it)->device_id,
(it)->product_id,
(it)->version);
it->device_id,
it->product_id,
it->version);
}
myDebug_P(PSTR("")); // newline

View File

@@ -264,6 +264,7 @@ static const _EMS_Device EMS_Devices[] = {
{169, EMS_DEVICE_TYPE_CONTROLLER, "BC40 Base 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
{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
{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

View File

@@ -1 +1 @@
#define APP_VERSION "1.9.5b7"
#define APP_VERSION "1.9.5b8"