rename topics

This commit is contained in:
MichaelDvP
2020-10-24 17:47:10 +02:00
parent b42b7664ee
commit 9ecb4f4a73
19 changed files with 161 additions and 184 deletions

View File

@@ -107,37 +107,37 @@ void Boiler::register_mqtt_ha_config(bool force) {
Mqtt::register_mqtt_ha_binary_sensor(F_(heatingActive), this->device_type(), "heating_active");
// main
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(serviceCodeNumber), this->device_type(), "serviceCodeNumber", nullptr, F_(iconpower));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(selFlowTemp), this->device_type(), "selFlowTemp", F_(degrees), F_(iconcruise));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(selBurnPow), this->device_type(), "selBurnPow", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(curBurnPow), this->device_type(), "curBurnPow", F_(percent), F_(iconfire));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(pumpMod), this->device_type(), "pumpMod", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(pumpMod2), this->device_type(), "pumpMod2", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(outdoorTemp), this->device_type(), "outdoorTemp", F_(degrees), F_(iconexport));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(curFlowTemp), this->device_type(), "curFlowTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(retTemp), this->device_type(), "retTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(switchTemp), this->device_type(), "switchTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(sysPress), this->device_type(), "sysPress", F_(bar), nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(boilTemp), this->device_type(), "boilTemp", F_(degrees), nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(burnGas), this->device_type(), "burnGas", nullptr, F_(iconfire));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(flameCurr), this->device_type(), "flameCurr", F_(uA), F_(iconflash));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(heatPump), this->device_type(), "heatPump", nullptr, F_(iconwaterpump));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(fanWork), this->device_type(), "fanWork", nullptr, F_(iconfan));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(ignWork), this->device_type(), "ignWork", nullptr, F_(iconflash));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(exhaustTemp), this->device_type(), "exhaustTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(heatingActivated), this->device_type(), "heatingActivated", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(heatingTemp), this->device_type(), "heatingTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(pumpModMax), this->device_type(), "pumpModMax", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(pumpModMin), this->device_type(), "pumpModMin", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(pumpDelay), this->device_type(), "pumpDelay", F_(min), nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(burnMinPeriod), this->device_type(), "burnMinPeriod", F_(min), nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(burnMinPower), this->device_type(), "burnMinPower", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(burnMaxPower), this->device_type(), "burnMaxPower", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(boilHystOn), this->device_type(), "boilHystOn", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(boilHystOff), this->device_type(), "boilHystOff", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(setFlowTemp), this->device_type(), "setFlowTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(setBurnPow), this->device_type(), "setBurnPow", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(burnStarts), this->device_type(), "burnStarts", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(serviceCodeNumber), this->device_type(), "serviceCodeNumber", nullptr, F_(iconpower));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(selFlowTemp), this->device_type(), "selFlowTemp", F_(degrees), F_(iconcruise));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(selBurnPow), this->device_type(), "selBurnPow", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(curBurnPow), this->device_type(), "curBurnPow", F_(percent), F_(iconfire));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(pumpMod), this->device_type(), "pumpMod", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(pumpMod2), this->device_type(), "pumpMod2", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(outdoorTemp), this->device_type(), "outdoorTemp", F_(degrees), F_(iconexport));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(curFlowTemp), this->device_type(), "curFlowTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(retTemp), this->device_type(), "retTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(switchTemp), this->device_type(), "switchTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(sysPress), this->device_type(), "sysPress", F_(bar), nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(boilTemp), this->device_type(), "boilTemp", F_(degrees), nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(burnGas), this->device_type(), "burnGas", nullptr, F_(iconfire));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(flameCurr), this->device_type(), "flameCurr", F_(uA), F_(iconflash));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(heatPump), this->device_type(), "heatPump", nullptr, F_(iconwaterpump));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(fanWork), this->device_type(), "fanWork", nullptr, F_(iconfan));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(ignWork), this->device_type(), "ignWork", nullptr, F_(iconflash));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(exhaustTemp), this->device_type(), "exhaustTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(heatingActivated), this->device_type(), "heatingActivated", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(heatingTemp), this->device_type(), "heatingTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(pumpModMax), this->device_type(), "pumpModMax", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(pumpModMin), this->device_type(), "pumpModMin", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(pumpDelay), this->device_type(), "pumpDelay", F_(min), nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(burnMinPeriod), this->device_type(), "burnMinPeriod", F_(min), nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(burnMinPower), this->device_type(), "burnMinPower", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(burnMaxPower), this->device_type(), "burnMaxPower", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(boilHystOn), this->device_type(), "boilHystOn", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(boilHystOff), this->device_type(), "boilHystOff", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(setFlowTemp), this->device_type(), "setFlowTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(setBurnPow), this->device_type(), "setBurnPow", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(burnStarts), this->device_type(), "burnStarts", nullptr, nullptr);
// ww
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_ww), F_(wWSelTemp), this->device_type(), "wWSelTemp", F_(degrees), F_(iconcruise));
@@ -618,7 +618,7 @@ void Boiler::publish_values(JsonObject & json, bool force) {
DynamicJsonDocument doc_main(EMSESP_MAX_JSON_SIZE_LARGE);
JsonObject json_main = doc_main.to<JsonObject>();
if (export_values_main(json_main)) {
Mqtt::publish(F("boiler_data_main"), doc_main.as<JsonObject>());
Mqtt::publish(F("boiler_data"), doc_main.as<JsonObject>());
}
DynamicJsonDocument doc_ww(EMSESP_MAX_JSON_SIZE_LARGE);
@@ -759,31 +759,6 @@ void Boiler::check_active() {
EMSESP::tap_water_active(b); // let EMS-ESP know, used in the Shower class
}
/*
// hot tap water, using flow to check instead of the burner power
// send these values back to the main EMSESP, so other classes (e.g. Shower) can use it
if (Helpers::hasValue(wWCurFlow_) && Helpers::hasValue(burnGas_) && (wWType_ > 0) && (wWType_ < 3)) {
tap_water_active_ = ((wWCurFlow_ != 0) && (burnGas_ != EMS_VALUE_BOOL_OFF));
EMSESP::tap_water_active(tap_water_active_);
}
// heating
// using a quick hack for checking the heating by looking at the Selected Flow Temp, but doesn't work for all boilers apparently
if (Helpers::hasValue(selFlowTemp_) && Helpers::hasValue(burnGas_)) {
heating_active_ = (!tap_water_active_ && ((selFlowTemp_ >= EMS_BOILER_SELFLOWTEMP_HEATING) && (burnGas_ != EMS_VALUE_BOOL_OFF)));
}
// 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
uint8_t latest_boilerState = (tap_water_active_ << 1) + heating_active_;
if (latest_boilerState != last_boilerState) {
last_boilerState = latest_boilerState;
static char s[10];
Mqtt::publish(F("tapwater_active"), Helpers::render_boolean(s, tap_water_active_));
static char s2[10];
Mqtt::publish(F("heating_active"), Helpers::render_boolean(s2, heating_active_));
}
*/
}
// 0x33

View File

@@ -16,17 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mixing.h"
#include "mixer.h"
namespace emsesp {
REGISTER_FACTORY(Mixing, EMSdevice::DeviceType::MIXING);
REGISTER_FACTORY(Mixer, EMSdevice::DeviceType::MIXER);
uuid::log::Logger Mixing::logger_{F_(mixing), uuid::log::Facility::CONSOLE};
uuid::log::Logger Mixer::logger_{F_(mixer), uuid::log::Facility::CONSOLE};
Mixing::Mixing(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand)
Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand)
: EMSdevice(device_type, device_id, product_id, version, name, flags, brand) {
LOG_DEBUG(F("Adding new Mixing module with device ID 0x%02X"), device_id);
LOG_DEBUG(F("Adding new Mixer with device ID 0x%02X"), device_id);
if (flags == EMSdevice::EMS_DEVICE_FLAG_MMPLUS) {
if (device_id <= 0x27) {
@@ -56,7 +56,7 @@ Mixing::Mixing(uint8_t device_type, uint8_t device_id, uint8_t product_id, const
}
// output json to web UI
void Mixing::device_info_web(JsonArray & root) {
void Mixer::device_info_web(JsonArray & root) {
if (type() == Type::NONE) {
return; // don't have any values yet
}
@@ -84,7 +84,7 @@ void Mixing::device_info_web(JsonArray & root) {
}
// check to see if values have been updated
bool Mixing::updated_values() {
bool Mixer::updated_values() {
if (changed_) {
changed_ = false;
return true;
@@ -93,7 +93,7 @@ bool Mixing::updated_values() {
}
// display all values into the shell console
void Mixing::show_values(uuid::console::Shell & shell) {
void Mixer::show_values(uuid::console::Shell & shell) {
EMSdevice::show_values(shell); // always call this to show header
if (type() == Type::NONE) {
@@ -125,7 +125,7 @@ void Mixing::show_values(uuid::console::Shell & shell) {
// publish values via MQTT
// topic is mixing_data<id>
void Mixing::publish_values(JsonObject & json, bool force) {
void Mixer::publish_values(JsonObject & json, bool force) {
// handle HA first
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
register_mqtt_ha_config(force);
@@ -136,9 +136,11 @@ void Mixing::publish_values(JsonObject & json, bool force) {
JsonObject json = doc.to<JsonObject>();
if (export_values_format(Mqtt::mqtt_format(), json)) {
char topic[30];
char s[5];
strlcpy(topic, "mixing_data", 30);
strlcat(topic, Helpers::itoa(s, device_id() - 0x20 + 1), 30); // append device_id to topic
if (type() == Type::HC) {
snprintf_P(topic, 30, PSTR("mixer_data_hc%d"),hc_);
} else {
snprintf_P(topic, 30, PSTR("mixer_data_wwc%d"),hc_);
}
Mqtt::publish(topic, doc.as<JsonObject>());
}
} else {
@@ -148,7 +150,7 @@ void Mixing::publish_values(JsonObject & json, bool force) {
}
// publish config topic for HA MQTT Discovery
void Mixing::register_mqtt_ha_config(bool force) {
void Mixer::register_mqtt_ha_config(bool force) {
if ((mqtt_ha_config_ && !force)) {
return;
}
@@ -167,32 +169,32 @@ void Mixing::register_mqtt_ha_config(bool force) {
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
char name[20];
snprintf_P(name, sizeof(name), PSTR("Mixing %02X"), device_id() - 0x20 + 1);
snprintf_P(name, sizeof(name), PSTR("Mixer %02X"), device_id() - 0x20 + 1);
doc["name"] = name;
char uniq_id[20];
snprintf_P(uniq_id, sizeof(uniq_id), PSTR("mixing%02X"), device_id() - 0x20 + 1);
snprintf_P(uniq_id, sizeof(uniq_id), PSTR("mixer%02X"), device_id() - 0x20 + 1);
doc["uniq_id"] = uniq_id;
doc["ic"] = F("mdi:home-thermometer-outline");
char stat_t[50];
snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/mixing_data"), System::hostname().c_str());
snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/mixer_data"), System::hostname().c_str());
doc["stat_t"] = stat_t;
doc["val_tpl"] = F("{{value_json.type}}"); // HA needs a single value. We take the type which is wwc or hc
JsonObject dev = doc.createNestedObject("dev");
dev["name"] = F("EMS-ESP Mixing");
dev["name"] = F("EMS-ESP Mixer");
dev["sw"] = EMSESP_APP_VERSION;
dev["mf"] = this->brand_to_string();
dev["mdl"] = this->name();
JsonArray ids = dev.createNestedArray("ids");
ids.add("ems-esp-mixing");
ids.add("ems-esp-mixer");
std::string topic(100, '\0');
if (this->type() == Type::HC) {
snprintf_P(&topic[0], topic.capacity() + 1, PSTR("homeassistant/climate/ems-esp/mixing_hc%d/config"), hc_);
snprintf_P(&topic[0], topic.capacity() + 1, PSTR("homeassistant/climate/ems-esp/mixer_hc%d/config"), hc_);
Mqtt::publish_retain(topic, doc.as<JsonObject>(), true); // publish the config payload with retain flag
char hc_name[10];
snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc_);
@@ -202,7 +204,7 @@ void Mixing::register_mqtt_ha_config(bool force) {
Mqtt::register_mqtt_ha_sensor(hc_name, nullptr, F_(valveStatus), this->device_type(), "valveStatus", nullptr, nullptr);
} else {
// WWC
snprintf_P(&topic[0], topic.capacity() + 1, PSTR("homeassistant/climate/ems-esp/mixing_wwc%d/config"), hc_);
snprintf_P(&topic[0], topic.capacity() + 1, PSTR("homeassistant/climate/ems-esp/mixer_wwc%d/config"), hc_);
Mqtt::publish_retain(topic, doc.as<JsonObject>(), true); // publish the config payload with retain flag
char wwc_name[10];
snprintf_P(wwc_name, sizeof(wwc_name), PSTR("wwc%d"), hc_);
@@ -214,13 +216,13 @@ void Mixing::register_mqtt_ha_config(bool force) {
mqtt_ha_config_ = true; // done
}
bool Mixing::export_values(JsonObject & json) {
bool Mixer::export_values(JsonObject & json) {
return export_values_format(Mqtt::Format::NESTED, json);
}
// creates JSON doc from values
// returns false if empty
bool Mixing::export_values_format(uint8_t mqtt_format, JsonObject & json) {
bool Mixer::export_values_format(uint8_t mqtt_format, JsonObject & json) {
// check if there is data for the mixing unit
if (!Helpers::hasValue(status_)) {
return 0;
@@ -231,14 +233,14 @@ bool Mixing::export_values_format(uint8_t mqtt_format, JsonObject & json) {
if (this->type() == Type::HC) {
snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc_);
if (mqtt_format == Mqtt::Format::NESTED) {
json_hc = json.createNestedObject(hc_name);
if (mqtt_format == Mqtt::Format::SINGLE) {
json_hc = json;
json["type"] = F("hc");
} else if (mqtt_format == Mqtt::Format::HA) {
json_hc = json.createNestedObject(hc_name);
json_hc["type"] = F("hc");
} else {
json_hc = json;
json["type"] = F("hc");
json_hc = json.createNestedObject(hc_name);
}
if (Helpers::hasValue(flowTemp_)) {
json_hc["flowTemp"] = (float)flowTemp_ / 10;
@@ -259,14 +261,14 @@ bool Mixing::export_values_format(uint8_t mqtt_format, JsonObject & json) {
// WWC
snprintf_P(hc_name, sizeof(hc_name), PSTR("wwc%d"), hc_);
if (mqtt_format == Mqtt::Format::NESTED) {
json_hc = json.createNestedObject(hc_name);
if (mqtt_format == Mqtt::Format::SINGLE) {
json_hc = json;
json["type"] = F("wwc");
} else if (mqtt_format == Mqtt::Format::HA) {
json_hc = json.createNestedObject(hc_name);
json_hc["type"] = F("wwc");
} else {
json_hc = json;
json["type"] = F("wwc");
json_hc = json.createNestedObject(hc_name);
}
if (Helpers::hasValue(flowTemp_)) {
json_hc["wwTemp"] = (float)flowTemp_ / 10;
@@ -285,7 +287,7 @@ bool Mixing::export_values_format(uint8_t mqtt_format, JsonObject & json) {
// heating circuits 0x02D7, 0x02D8 etc...
// e.g. A0 00 FF 00 01 D7 00 00 00 80 00 00 00 00 03 C5
// A0 0B FF 00 01 D7 00 00 00 80 00 00 00 00 03 80
void Mixing::process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> telegram) {
void Mixer::process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> telegram) {
type(Type::HC);
hc_ = telegram->type_id - 0x02D7 + 1; // determine which circuit this is
changed_ |= telegram->read_value(flowTemp_, 3); // is * 10
@@ -294,10 +296,10 @@ void Mixing::process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> tele
changed_ |= telegram->read_value(status_, 2); // valve status
}
// Mixing module warm water loading/DHW - 0x0331, 0x0332
// Mixer warm water loading/DHW - 0x0331, 0x0332
// e.g. A9 00 FF 00 02 32 02 6C 00 3C 00 3C 3C 46 02 03 03 00 3C // on 0x28
// A8 00 FF 00 02 31 02 35 00 3C 00 3C 3C 46 02 03 03 00 3C // in 0x29
void Mixing::process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> telegram) {
void Mixer::process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> telegram) {
type(Type::WWC);
hc_ = telegram->type_id - 0x0331 + 1; // determine which circuit this is. There are max 2.
changed_ |= telegram->read_value(flowTemp_, 0); // is * 10
@@ -305,10 +307,10 @@ void Mixing::process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> tel
changed_ |= telegram->read_value(status_, 11); // temp status
}
// Mixing IMP - 0x010C
// Mixer IMP - 0x010C
// e.g. A0 00 FF 00 00 0C 01 00 00 00 00 00 54
// A1 00 FF 00 00 0C 02 04 00 01 1D 00 82
void Mixing::process_IPMStatusMessage(std::shared_ptr<const Telegram> telegram) {
void Mixer::process_IPMStatusMessage(std::shared_ptr<const Telegram> telegram) {
type(Type::HC);
hc_ = device_id() - 0x20 + 1;
@@ -329,10 +331,10 @@ void Mixing::process_IPMStatusMessage(std::shared_ptr<const Telegram> telegram)
changed_ |= telegram->read_bitvalue(pumpStatus_, 1, 0); // pump is also in unmixed circuits
}
// Mixing on a MM10 - 0xAB
// e.g. Mixing Module -> All, type 0xAB, telegram: 21 00 AB 00 2D 01 BE 64 04 01 00 (CRC=15) #data=7
// Mixer on a MM10 - 0xAB
// e.g. Mixer Module -> All, type 0xAB, telegram: 21 00 AB 00 2D 01 BE 64 04 01 00 (CRC=15) #data=7
// see also https://github.com/proddy/EMS-ESP/issues/386
void Mixing::process_MMStatusMessage(std::shared_ptr<const Telegram> telegram) {
void Mixer::process_MMStatusMessage(std::shared_ptr<const Telegram> telegram) {
type(Type::HC);
// the heating circuit is determine by which device_id it is, 0x20 - 0x23
@@ -348,17 +350,17 @@ void Mixing::process_MMStatusMessage(std::shared_ptr<const Telegram> telegram) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
// Mixing on a MM10 - 0xAA
// e.g. Thermostat -> Mixing Module, type 0xAA, telegram: 10 21 AA 00 FF 0C 0A 11 0A 32 xx
void Mixing::process_MMConfigMessage(std::shared_ptr<const Telegram> telegram) {
// Mixer on a MM10 - 0xAA
// e.g. Thermostat -> Mixer Module, type 0xAA, telegram: 10 21 AA 00 FF 0C 0A 11 0A 32 xx
void Mixer::process_MMConfigMessage(std::shared_ptr<const Telegram> telegram) {
hc_ = device_id() - 0x20 + 1;
// pos 0: active FF = on
// pos 1: valve runtime 0C = 120 sec in units of 10 sec
}
// Mixing on a MM10 - 0xAC
// e.g. Thermostat -> Mixing Module, type 0xAC, telegram: 10 21 AC 00 1E 64 01 AB
void Mixing::process_MMSetMessage(std::shared_ptr<const Telegram> telegram) {
// Mixer on a MM10 - 0xAC
// e.g. Thermostat -> Mixer Module, type 0xAC, telegram: 10 21 AC 00 1E 64 01 AB
void Mixer::process_MMSetMessage(std::shared_ptr<const Telegram> telegram) {
hc_ = device_id() - 0x20 + 1;
// pos 0: flowtemp setpoint 1E = 30°C
// pos 1: position in %

View File

@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EMSESP_MIXING_H
#define EMSESP_MIXING_H
#ifndef EMSESP_MIXER_H
#define EMSESP_MIXER_H
#include <Arduino.h>
#include <ArduinoJson.h>
@@ -32,9 +32,9 @@
namespace emsesp {
class Mixing : public EMSdevice {
class Mixer : public EMSdevice {
public:
Mixing(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
virtual void show_values(uuid::console::Shell & shell);
virtual void publish_values(JsonObject & json, bool force);

View File

@@ -471,14 +471,14 @@ bool Thermostat::export_values_hc(uint8_t mqtt_format, JsonObject & rootThermost
has_data = true;
// if the MQTT format is 'nested' or 'ha' then create the parent object hc<n>
if ((mqtt_format == Mqtt::Format::NESTED) || (mqtt_format == Mqtt::Format::HA)) {
if (mqtt_format == Mqtt::Format::SINGLE) {
dataThermostat = rootThermostat;
} else {
char hc_name[10]; // hc{1-4}
strlcpy(hc_name, "hc", 10);
char s[3];
strlcat(hc_name, Helpers::itoa(s, hc->hc_num()), 10);
dataThermostat = rootThermostat.createNestedObject(hc_name);
} else {
dataThermostat = rootThermostat;
}
// different logic on how temperature values are stored, depending on model
@@ -615,9 +615,7 @@ bool Thermostat::export_values_hc(uint8_t mqtt_format, JsonObject & rootThermost
// the topic will have the hc number appended
if (mqtt_format == Mqtt::Format::SINGLE) {
char topic[30];
char s[3];
strlcpy(topic, "thermostat_data", 30);
strlcat(topic, Helpers::itoa(s, hc->hc_num()), 30); // append hc to topic
snprintf_P(topic, 30, PSTR("thermostat_data_hc%d"),hc->hc_num());
Mqtt::publish(topic, rootThermostat);
rootThermostat.clear(); // clear object
}