diff --git a/interface/src/mqtt/MqttSettingsForm.tsx b/interface/src/mqtt/MqttSettingsForm.tsx index 80958ad0c..21ab9192c 100644 --- a/interface/src/mqtt/MqttSettingsForm.tsx +++ b/interface/src/mqtt/MqttSettingsForm.tsx @@ -124,9 +124,9 @@ class MqttSettingsForm extends React.Component { variant="outlined" onChange={handleValueChange('mqtt_qos')} margin="normal"> - 0 - 1 - 2 + 0 - At most once + 1 - At least once + 2 - Exactly once { - Devices + EMS Devices

{!this.noDevices() && ( @@ -180,7 +180,7 @@ class EMSESPDevicesForm extends Component<

- Sensors + Dallas Sensors {!this.noSensors() && ( diff --git a/lib/framework/MqttSettingsService.cpp b/lib/framework/MqttSettingsService.cpp index 7fa65deac..16f2c8790 100644 --- a/lib/framework/MqttSettingsService.cpp +++ b/lib/framework/MqttSettingsService.cpp @@ -187,7 +187,7 @@ void MqttSettings::read(MqttSettings & settings, JsonObject & root) { root["publish_time_boiler"] = settings.publish_time_boiler; root["publish_time_thermostat"] = settings.publish_time_thermostat; root["publish_time_solar"] = settings.publish_time_solar; - root["publish_time_mixing"] = settings.publish_time_mixing; + root["publish_time_mixer"] = settings.publish_time_mixer; root["publish_time_other"] = settings.publish_time_other; root["publish_time_sensor"] = settings.publish_time_sensor; root["mqtt_format"] = settings.mqtt_format; @@ -211,7 +211,7 @@ StateUpdateResult MqttSettings::update(JsonObject & root, MqttSettings & setting newSettings.publish_time_boiler = root["publish_time_boiler"] | EMSESP_DEFAULT_PUBLISH_TIME; newSettings.publish_time_thermostat = root["publish_time_thermostat"] | EMSESP_DEFAULT_PUBLISH_TIME; newSettings.publish_time_solar = root["publish_time_solar"] | EMSESP_DEFAULT_PUBLISH_TIME; - newSettings.publish_time_mixing = root["publish_time_mixing"] | EMSESP_DEFAULT_PUBLISH_TIME; + newSettings.publish_time_mixer = root["publish_time_mixer"] | EMSESP_DEFAULT_PUBLISH_TIME; newSettings.publish_time_other = root["publish_time_other"] | EMSESP_DEFAULT_PUBLISH_TIME; newSettings.publish_time_sensor = root["publish_time_sensor"] | EMSESP_DEFAULT_PUBLISH_TIME; newSettings.mqtt_format = root["mqtt_format"] | EMSESP_DEFAULT_MQTT_FORMAT; @@ -239,8 +239,8 @@ StateUpdateResult MqttSettings::update(JsonObject & root, MqttSettings & setting if (newSettings.publish_time_solar != settings.publish_time_solar) { emsesp::EMSESP::mqtt_.set_publish_time_solar(newSettings.publish_time_solar); } - if (newSettings.publish_time_mixing != settings.publish_time_mixing) { - emsesp::EMSESP::mqtt_.set_publish_time_mixing(newSettings.publish_time_mixing); + if (newSettings.publish_time_mixer != settings.publish_time_mixer) { + emsesp::EMSESP::mqtt_.set_publish_time_mixer(newSettings.publish_time_mixer); } if (newSettings.publish_time_other != settings.publish_time_other) { emsesp::EMSESP::mqtt_.set_publish_time_other(newSettings.publish_time_other); diff --git a/lib/framework/MqttSettingsService.h b/lib/framework/MqttSettingsService.h index 9b88452e3..25368176a 100644 --- a/lib/framework/MqttSettingsService.h +++ b/lib/framework/MqttSettingsService.h @@ -88,7 +88,7 @@ class MqttSettings { uint16_t publish_time_boiler; uint16_t publish_time_thermostat; uint16_t publish_time_solar; - uint16_t publish_time_mixing; + uint16_t publish_time_mixer; uint16_t publish_time_other; uint16_t publish_time_sensor; uint8_t mqtt_format; // 1=single, 2=nested, 3=ha, 4=custom diff --git a/src/console.cpp b/src/console.cpp index 7dfd37bce..df83619bd 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -233,12 +233,12 @@ void EMSESPShell::add_console_commands() { 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(0x22); // Mixing Devices - 0x22 - Device_Ids.push_back(0x23); // Mixing Devices - 0x23 - Device_Ids.push_back(0x28); // Mixing Devices WW- 0x28 - Device_Ids.push_back(0x29); // Mixing Devices WW- 0x29 + Device_Ids.push_back(0x20); // Mixer Devices - 0x20 + Device_Ids.push_back(0x21); // Mixer Devices - 0x21 + Device_Ids.push_back(0x22); // Mixer Devices - 0x22 + Device_Ids.push_back(0x23); // Mixer Devices - 0x23 + Device_Ids.push_back(0x28); // Mixer Devices WW- 0x28 + Device_Ids.push_back(0x29); // Mixer Devices WW- 0x29 Device_Ids.push_back(0x10); // Thermostats - 0x10 Device_Ids.push_back(0x17); // Thermostats - 0x17 Device_Ids.push_back(0x18); // Thermostat remote - 0x18 diff --git a/src/device_library.h b/src/device_library.h index 6bad2229f..badf46047 100644 --- a/src/device_library.h +++ b/src/device_library.h @@ -98,12 +98,12 @@ {163, DeviceType::SOLAR, F("SM100/MS100"), DeviceFlags::EMS_DEVICE_FLAG_SM100}, {164, DeviceType::SOLAR, F("SM200/MS200"), DeviceFlags::EMS_DEVICE_FLAG_SM100}, -// Mixing Modules - 0x20-0x27 for HC, 0x28-0x29 for WWC -{ 69, DeviceType::MIXING, F("MM10"), DeviceFlags::EMS_DEVICE_FLAG_MM10}, -{102, DeviceType::MIXING, F("IPM"), DeviceFlags::EMS_DEVICE_FLAG_IPM}, -{159, DeviceType::MIXING, F("MM50"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, -{160, DeviceType::MIXING, F("MM100"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, -{161, DeviceType::MIXING, F("MM200"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, +// Mixer Modules - 0x20-0x27 for HC, 0x28-0x29 for WWC +{ 69, DeviceType::MIXER, F("MM10"), DeviceFlags::EMS_DEVICE_FLAG_MM10}, +{102, DeviceType::MIXER, F("IPM"), DeviceFlags::EMS_DEVICE_FLAG_IPM}, +{159, DeviceType::MIXER, F("MM50"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, +{160, DeviceType::MIXER, F("MM100"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, +{161, DeviceType::MIXER, F("MM200"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, // Heat Pumps - 0x38 {200, DeviceType::HEATPUMP, F("HP Module"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index a9b6a22bc..c7438c60b 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -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(); if (export_values_main(json_main)) { - Mqtt::publish(F("boiler_data_main"), doc_main.as()); + Mqtt::publish(F("boiler_data"), doc_main.as()); } 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 diff --git a/src/devices/mixing.cpp b/src/devices/mixer.cpp similarity index 84% rename from src/devices/mixing.cpp rename to src/devices/mixer.cpp index a3e58c966..69dd9dc39 100644 --- a/src/devices/mixing.cpp +++ b/src/devices/mixer.cpp @@ -16,17 +16,17 @@ * along with this program. If not, see . */ -#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 -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(); 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()); } } 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 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(), 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(), 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 telegram) { +void Mixer::process_MMPLUSStatusMessage_HC(std::shared_ptr 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 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 telegram) { +void Mixer::process_MMPLUSStatusMessage_WWC(std::shared_ptr 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 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 telegram) { +void Mixer::process_IPMStatusMessage(std::shared_ptr telegram) { type(Type::HC); hc_ = device_id() - 0x20 + 1; @@ -329,10 +331,10 @@ void Mixing::process_IPMStatusMessage(std::shared_ptr 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 telegram) { +void Mixer::process_MMStatusMessage(std::shared_ptr 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 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 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 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 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 telegram) { hc_ = device_id() - 0x20 + 1; // pos 0: flowtemp setpoint 1E = 30°C // pos 1: position in % diff --git a/src/devices/mixing.h b/src/devices/mixer.h similarity index 91% rename from src/devices/mixing.h rename to src/devices/mixer.h index 26efe936e..757da33c5 100644 --- a/src/devices/mixing.h +++ b/src/devices/mixer.h @@ -16,8 +16,8 @@ * along with this program. If not, see . */ -#ifndef EMSESP_MIXING_H -#define EMSESP_MIXING_H +#ifndef EMSESP_MIXER_H +#define EMSESP_MIXER_H #include #include @@ -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); diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index e3b246921..8cf56e29e 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -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 - 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 } diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index 107fa3457..03f32a904 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -73,8 +73,8 @@ std::string EMSdevice::device_type_2_device_name(const uint8_t device_type) { return read_flash_string(F_(solar)); break; - case DeviceType::MIXING: - return read_flash_string(F_(mixing)); + case DeviceType::MIXER: + return read_flash_string(F_(mixer)); break; case DeviceType::DALLASSENSOR: @@ -117,11 +117,11 @@ uint8_t EMSdevice::device_name_2_device_type(const char * topic) { return DeviceType::SOLAR; } - if (!strcmp_P(topic, reinterpret_cast(F_(mixing)))) { - return DeviceType::MIXING; + if (!strcmp_P(topic, reinterpret_cast(F_(mixer)))) { + return DeviceType::MIXER; } - if (!strcmp_P(topic, reinterpret_cast(F_(dallassensor)))) { + if (!strcmp_P(topic, reinterpret_cast(F_(sensor)))) { return DeviceType::DALLASSENSOR; } @@ -143,27 +143,27 @@ std::string EMSdevice::device_type_name() const { break; case DeviceType::SOLAR: - return read_flash_string(F("Solar Module")); + return read_flash_string(F("Solar")); break; case DeviceType::CONNECT: - return read_flash_string(F("Connect Module")); + return read_flash_string(F("Connect")); break; case DeviceType::CONTROLLER: return read_flash_string(F("Controller")); break; - case DeviceType::MIXING: - return read_flash_string(F("Mixing Module")); + case DeviceType::MIXER: + return read_flash_string(F("Mixer")); break; case DeviceType::SWITCH: - return read_flash_string(F("Switching Module")); + return read_flash_string(F("Switch")); break; case DeviceType::GATEWAY: - return read_flash_string(F("Gateway Module")); + return read_flash_string(F("Gateway")); break; default: diff --git a/src/emsdevice.h b/src/emsdevice.h index 9c9faf7ed..056a22378 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -223,7 +223,7 @@ class EMSdevice { DALLASSENSOR, // for internal dallas sensors BOILER, THERMOSTAT, - MIXING, + MIXER, SOLAR, HEATPUMP, GATEWAY, @@ -250,7 +250,7 @@ class EMSdevice { static constexpr uint8_t EMS_DEVICE_FLAG_SM100 = 2; static constexpr uint8_t EMS_DEVICE_FLAG_ISM = 3; - // Mixing Module + // Mixer Module static constexpr uint8_t EMS_DEVICE_FLAG_MMPLUS = 1; static constexpr uint8_t EMS_DEVICE_FLAG_MM10 = 2; static constexpr uint8_t EMS_DEVICE_FLAG_IPM = 3; diff --git a/src/emsesp.cpp b/src/emsesp.cpp index e0288f156..096c793b6 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -277,12 +277,11 @@ void EMSESP::show_sensor_values(uuid::console::Shell & shell) { return; } - char valuestr[8] = {0}; // for formatting temp shell.printfln(F("Dallas temperature sensors:")); uint8_t i = 1; + char s[7]; for (const auto & device : sensor_devices()) { - shell.printfln(F(" Sensor %d, ID: %s, Temperature: %s °C"), i, device.to_string().c_str(), Helpers::render_value(valuestr, device.temperature_c, 10)); - i++; + shell.printfln(F(" Sensor %d, ID: %s, Temperature: %s °C"), i++, device.to_string().c_str(), Helpers::render_value(s, device.temperature_c, 10)); } shell.println(); } @@ -293,7 +292,7 @@ void EMSESP::publish_all(bool force) { publish_device_values(EMSdevice::DeviceType::BOILER, force); publish_device_values(EMSdevice::DeviceType::THERMOSTAT, force); publish_device_values(EMSdevice::DeviceType::SOLAR, force); - publish_device_values(EMSdevice::DeviceType::MIXING, force); + publish_device_values(EMSdevice::DeviceType::MIXER, force); publish_other_values(); publish_sensor_values(true); system_.send_heartbeat(); @@ -301,9 +300,9 @@ void EMSESP::publish_all(bool force) { } // create json doc for the devices values and add to MQTT publish queue -// special case for Mixing units, since we want to bundle all devices together into one payload +// special case for Mixer units, since we want to bundle all devices together into one payload void EMSESP::publish_device_values(uint8_t device_type, bool force) { - if (device_type == EMSdevice::DeviceType::MIXING && Mqtt::mqtt_format() != Mqtt::Format::SINGLE) { + if (device_type == EMSdevice::DeviceType::MIXER && Mqtt::mqtt_format() != Mqtt::Format::SINGLE) { DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE); JsonObject json = doc.to(); for (const auto & emsdevice : emsdevices) { @@ -312,7 +311,7 @@ void EMSESP::publish_device_values(uint8_t device_type, bool force) { } } doc.shrinkToFit(); - Mqtt::publish(F("mixing_data"), doc.as()); + Mqtt::publish("mixer_data", doc.as()); return; } @@ -327,7 +326,7 @@ void EMSESP::publish_device_values(uint8_t device_type, bool force) { void EMSESP::publish_other_values() { for (const auto & emsdevice : emsdevices) { if (emsdevice && (emsdevice->device_type() != EMSdevice::DeviceType::BOILER) && (emsdevice->device_type() != EMSdevice::DeviceType::THERMOSTAT) - && (emsdevice->device_type() != EMSdevice::DeviceType::SOLAR) && (emsdevice->device_type() != EMSdevice::DeviceType::MIXING)) { + && (emsdevice->device_type() != EMSdevice::DeviceType::SOLAR) && (emsdevice->device_type() != EMSdevice::DeviceType::MIXER)) { JsonObject dummy; emsdevice->publish_values(dummy); } @@ -480,7 +479,7 @@ void EMSESP::process_UBADevices(std::shared_ptr telegram) { // when the version info is received, it will automagically add the device // always skip modem device 0x0D, it does not reply to version request // see https://github.com/proddy/EMS-ESP/issues/460#issuecomment-709553012 - if ((device_id != EMSbus::ems_bus_id()) && !(EMSESP::device_exists(device_id)) && (device_id != 0x0D)) { + if ((device_id != EMSbus::ems_bus_id()) && !(EMSESP::device_exists(device_id)) && (device_id != 0x0D) && (device_id != 0x0C)) { LOG_DEBUG(F("New EMS device detected with ID 0x%02X. Requesting version information."), device_id); send_read_request(EMSdevice::EMS_TYPE_VERSION, device_id); } @@ -630,7 +629,7 @@ void EMSESP::show_devices(uuid::console::Shell & shell) { shell.printfln(F("These EMS devices are currently active:")); shell.println(); - // for all device objects from emsdevice.h (UNKNOWN, SYSTEM, BOILER, THERMOSTAT, MIXING, SOLAR, HEATPUMP, GATEWAY, SWITCH, CONTROLLER, CONNECT) + // for all device objects from emsdevice.h (UNKNOWN, SYSTEM, BOILER, THERMOSTAT, MIXER, SOLAR, HEATPUMP, GATEWAY, SWITCH, CONTROLLER, CONNECT) // so we keep a consistent order for (const auto & device_class : EMSFactory::device_handlers()) { // shell.printf(F("[factory ID: %d] "), device_class.first); @@ -721,9 +720,9 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, std:: return command_info(EMSdevice::DeviceType::BOILER, json); }); break; - case EMSdevice::DeviceType::MIXING: + case EMSdevice::DeviceType::MIXER: Command::add_with_json(device_p->device_type, F_(info), [&](const char * value, const int8_t id, JsonObject & json) { - return command_info(EMSdevice::DeviceType::MIXING, json); + return command_info(EMSdevice::DeviceType::MIXER, json); }); break; case EMSdevice::DeviceType::SOLAR: diff --git a/src/locale_EN.h b/src/locale_EN.h index ca575497b..86b268414 100644 --- a/src/locale_EN.h +++ b/src/locale_EN.h @@ -87,13 +87,14 @@ MAKE_PSTR_WORD(boiler) MAKE_PSTR_WORD(thermostat) MAKE_PSTR_WORD(switch) MAKE_PSTR_WORD(solar) -MAKE_PSTR_WORD(mixing) +MAKE_PSTR_WORD(mixer) MAKE_PSTR_WORD(gateway) MAKE_PSTR_WORD(controller) MAKE_PSTR_WORD(connect) MAKE_PSTR_WORD(heatpump) MAKE_PSTR_WORD(generic) MAKE_PSTR_WORD(dallassensor) +MAKE_PSTR_WORD(sensor) MAKE_PSTR(1space, " ") MAKE_PSTR(2spaces, " ") @@ -160,7 +161,7 @@ MAKE_PSTR(wWCurTemp2, "Warm water current temperature (extern)") MAKE_PSTR(wWCurFlow, "Warm water current tap water flow") MAKE_PSTR(curFlowTemp, "Current flow temperature") MAKE_PSTR(retTemp, "Return temperature") -MAKE_PSTR(switchTemp, "Mixing switch temperature") +MAKE_PSTR(switchTemp, "Mixer switch temperature") MAKE_PSTR(sysPress, "System pressure") MAKE_PSTR(boilTemp, "Max temperature") MAKE_PSTR(wwStorageTemp1, "Warm water storage temperature (intern)") @@ -193,10 +194,12 @@ MAKE_PSTR(setFlowTemp, "Set flow temperature") MAKE_PSTR(wWSetPumpPower, "Warm water pump set power") MAKE_PSTR(wwMixTemperature, "Warm water mix temperature") MAKE_PSTR(wwBufferTemperature, "Warm water buffer temperature") -MAKE_PSTR(wWStarts, "Warm water # starts") +MAKE_PSTR(wWStarts, "Warm water starts") MAKE_PSTR(wWWorkM, "Warm water active time") MAKE_PSTR(setBurnPow, "Burner set power") -MAKE_PSTR(burnStarts, "# starts") +MAKE_PSTR(burnStarts, "Burner starts") +MAKE_PSTR(burnWorkMin, "Burner active time") +MAKE_PSTR(heatWorkMin, "Heating active time") // solar MAKE_PSTR(collectorTemp, "Collector temperature (TS1)") @@ -214,7 +217,7 @@ MAKE_PSTR(valveStatus, "Valve status") MAKE_PSTR(tankHeated, "Tank heated") MAKE_PSTR(collectorShutdown, "Collector shutdown") -// mixing +// mixer MAKE_PSTR(ww_hc, " Warm water circuit %d:") MAKE_PSTR(wwTemp, "Current warm water temperature") MAKE_PSTR(pumpStatus, "Current pump status") @@ -281,5 +284,5 @@ MAKE_PSTR(iconthermostat, "mdi:home-thermometer-outline") MAKE_PSTR(iconheatpump, "mdi:water-pump") // MQTT topic suffix -MAKE_PSTR(mqtt_suffix_main, "_main") +// MAKE_PSTR(mqtt_suffix_main, "_main") MAKE_PSTR(mqtt_suffix_ww, "_ww") diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 364ee415e..252dc255f 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -31,7 +31,7 @@ bool Mqtt::mqtt_retain_; uint32_t Mqtt::publish_time_boiler_; uint32_t Mqtt::publish_time_thermostat_; uint32_t Mqtt::publish_time_solar_; -uint32_t Mqtt::publish_time_mixing_; +uint32_t Mqtt::publish_time_mixer_; uint32_t Mqtt::publish_time_other_; uint32_t Mqtt::publish_time_sensor_; uint8_t Mqtt::mqtt_format_; @@ -138,9 +138,9 @@ void Mqtt::loop() { EMSESP::publish_device_values(EMSdevice::DeviceType::SOLAR); } - if (publish_time_mixing_ && (currentMillis - last_publish_mixing_ > publish_time_mixing_)) { - last_publish_mixing_ = currentMillis; - EMSESP::publish_device_values(EMSdevice::DeviceType::MIXING); + if (publish_time_mixer_ && (currentMillis - last_publish_mixer_ > publish_time_mixer_)) { + last_publish_mixer_ = currentMillis; + EMSESP::publish_device_values(EMSdevice::DeviceType::MIXER); } if (publish_time_other_ && (currentMillis - last_publish_other_ > publish_time_other_)) { @@ -349,7 +349,7 @@ void Mqtt::start() { publish_time_boiler_ = mqttSettings.publish_time_boiler * 1000; // convert to milliseconds publish_time_thermostat_ = mqttSettings.publish_time_thermostat * 1000; publish_time_solar_ = mqttSettings.publish_time_solar * 1000; - publish_time_mixing_ = mqttSettings.publish_time_mixing * 1000; + publish_time_mixer_ = mqttSettings.publish_time_mixer * 1000; publish_time_other_ = mqttSettings.publish_time_other * 1000; publish_time_sensor_ = mqttSettings.publish_time_sensor * 1000; mqtt_qos_ = mqttSettings.mqtt_qos; @@ -411,8 +411,8 @@ void Mqtt::set_publish_time_solar(uint16_t publish_time) { publish_time_solar_ = publish_time * 1000; // convert to milliseconds } -void Mqtt::set_publish_time_mixing(uint16_t publish_time) { - publish_time_mixing_ = publish_time * 1000; // convert to milliseconds +void Mqtt::set_publish_time_mixer(uint16_t publish_time) { + publish_time_mixer_ = publish_time * 1000; // convert to milliseconds } void Mqtt::set_publish_time_other(uint16_t publish_time) { @@ -436,8 +436,8 @@ bool Mqtt::get_publish_onchange(uint8_t device_type) { if (!publish_time_solar_) { return true; } - } else if (device_type == EMSdevice::DeviceType::MIXING) { - if (!publish_time_mixing_) { + } else if (device_type == EMSdevice::DeviceType::MIXER) { + if (!publish_time_mixer_) { return true; } } else if (!publish_time_other_) { diff --git a/src/mqtt.h b/src/mqtt.h index b50d9d077..8a93b82f4 100644 --- a/src/mqtt.h +++ b/src/mqtt.h @@ -70,7 +70,7 @@ class Mqtt { void set_publish_time_boiler(uint16_t publish_time); void set_publish_time_thermostat(uint16_t publish_time); void set_publish_time_solar(uint16_t publish_time); - void set_publish_time_mixing(uint16_t publish_time); + void set_publish_time_mixer(uint16_t publish_time); void set_publish_time_other(uint16_t publish_time); void set_publish_time_sensor(uint16_t publish_time); void set_qos(uint8_t mqtt_qos); @@ -210,7 +210,7 @@ class Mqtt { uint32_t last_publish_boiler_ = 0; uint32_t last_publish_thermostat_ = 0; uint32_t last_publish_solar_ = 0; - uint32_t last_publish_mixing_ = 0; + uint32_t last_publish_mixer_ = 0; uint32_t last_publish_other_ = 0; uint32_t last_publish_sensor_ = 0; @@ -222,7 +222,7 @@ class Mqtt { static uint32_t publish_time_boiler_; static uint32_t publish_time_thermostat_; static uint32_t publish_time_solar_; - static uint32_t publish_time_mixing_; + static uint32_t publish_time_mixer_; static uint32_t publish_time_other_; static uint32_t publish_time_sensor_; static uint8_t mqtt_format_; diff --git a/src/system.cpp b/src/system.cpp index 7cf198e3d..a32a48d0e 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -888,7 +888,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & json node["publish_time_boiler"] = settings.publish_time_boiler; node["publish_time_thermostat"] = settings.publish_time_thermostat; node["publish_time_solar"] = settings.publish_time_solar; - node["publish_time_mixing"] = settings.publish_time_mixing; + node["publish_time_mixer"] = settings.publish_time_mixer; node["publish_time_other"] = settings.publish_time_other; node["publish_time_sensor"] = settings.publish_time_sensor; node["mqtt_format"] = settings.mqtt_format; @@ -959,7 +959,7 @@ bool System::command_report(const char * value, const int8_t id, JsonObject & js node["publish_time_boiler"] = settings.publish_time_boiler; node["publish_time_thermostat"] = settings.publish_time_thermostat; node["publish_time_solar"] = settings.publish_time_solar; - node["publish_time_mixing"] = settings.publish_time_mixing; + node["publish_time_mixer"] = settings.publish_time_mixer; node["publish_time_other"] = settings.publish_time_other; node["publish_time_sensor"] = settings.publish_time_sensor; node["mqtt_format"] = settings.mqtt_format; diff --git a/src/test/test.cpp b/src/test/test.cpp index b9777a35b..b37c58d6f 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -808,8 +808,8 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) { EMSESP::txservice_.read_request(0x18, 0x08, 27); // no offset } - if (command == "mixing") { - shell.printfln(F("Testing Mixing...")); + if (command == "mixer") { + shell.printfln(F("Testing Mixer...")); // change MQTT format EMSESP::esp8266React.getMqttSettingsService()->updateWithoutPropagation([&](MqttSettings & mqttSettings) {