diff --git a/src/console.cpp b/src/console.cpp index 035dca5bf..cce97625c 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -121,12 +121,17 @@ void EMSESPShell::add_console_commands() { commands->add_command(ShellContext::MAIN, CommandFlags::ADMIN, flash_string_vector{F_(publish)}, - [&](Shell & shell, const std::vector & arguments __attribute__((unused))) { - shell.printfln(F("Publishing all data to MQTT")); - EMSESP::publish_all(); + flash_string_vector{F_(ha_optional)}, + [&](Shell & shell, const std::vector & arguments) { + if (arguments.empty()) { + EMSESP::publish_all(); + shell.printfln(F("Published all data to MQTT")); + } else { + EMSESP::publish_all(true); + shell.printfln(F("Published all data to MQTT, including HA configs")); + } }); - commands->add_command(ShellContext::MAIN, CommandFlags::USER, flash_string_vector{F_(show)}, diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 22244fbdb..2b56645f5 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -80,9 +80,13 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const // create the config topics for Home Assistant MQTT Discovery // for each of the main elements -bool Boiler::register_mqtt_ha_config() { +void Boiler::register_mqtt_ha_config(bool force) { + if ((mqtt_ha_config_ && !force)) { + return; + } + if (!Mqtt::connected()) { - return false; + return; } // Create the Master device @@ -169,7 +173,7 @@ bool Boiler::register_mqtt_ha_config() { Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_ww), F_(wWStarts), this->device_type(), "wWStarts", nullptr, nullptr); Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_ww), F_(wWWorkM), this->device_type(), "wWWorkM", nullptr, nullptr); - return true; + mqtt_ha_config_ = true; // done } // send stuff to the Web UI @@ -611,10 +615,10 @@ bool Boiler::export_values_main(JsonObject & output) { } // publish values via MQTT -void Boiler::publish_values(JsonObject & data) { +void Boiler::publish_values(JsonObject & data, bool force) { // handle HA first - if ((Mqtt::mqtt_format() == Mqtt::Format::HA) && (!mqtt_ha_config_)) { - mqtt_ha_config_ = register_mqtt_ha_config(); + if (Mqtt::mqtt_format() == Mqtt::Format::HA) { + register_mqtt_ha_config(force); } DynamicJsonDocument doc_main(EMSESP_MAX_JSON_SIZE_LARGE); diff --git a/src/devices/boiler.h b/src/devices/boiler.h index e3a317ba3..a76396c6d 100644 --- a/src/devices/boiler.h +++ b/src/devices/boiler.h @@ -39,14 +39,14 @@ class Boiler : public EMSdevice { Boiler(uint8_t device_type, int8_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 & data); + virtual void publish_values(JsonObject & data, bool force); virtual void device_info_web(JsonArray & root); virtual bool updated_values(); private: static uuid::log::Logger logger_; - bool register_mqtt_ha_config(); + void register_mqtt_ha_config(bool force); void check_active(); bool export_values_main(JsonObject & doc); bool export_values_ww(JsonObject & doc); diff --git a/src/devices/connect.cpp b/src/devices/connect.cpp index 5a4d6cd0a..9a10cef4f 100644 --- a/src/devices/connect.cpp +++ b/src/devices/connect.cpp @@ -37,7 +37,7 @@ void Connect::show_values(uuid::console::Shell & shell) { } // publish values via MQTT -void Connect::publish_values(JsonObject & data) { +void Connect::publish_values(JsonObject & data, bool force) { } // check to see if values have been updated diff --git a/src/devices/connect.h b/src/devices/connect.h index 0655afb84..7d9009309 100644 --- a/src/devices/connect.h +++ b/src/devices/connect.h @@ -36,7 +36,7 @@ class Connect : public EMSdevice { Connect(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 & data); + virtual void publish_values(JsonObject & data, bool force); virtual void device_info_web(JsonArray & root); virtual bool updated_values(); diff --git a/src/devices/controller.cpp b/src/devices/controller.cpp index 24acd033c..a855e0861 100644 --- a/src/devices/controller.cpp +++ b/src/devices/controller.cpp @@ -37,7 +37,7 @@ void Controller::show_values(uuid::console::Shell & shell) { } // publish values via MQTT -void Controller::publish_values(JsonObject & data) { +void Controller::publish_values(JsonObject & data, bool force) { } // check to see if values have been updated diff --git a/src/devices/controller.h b/src/devices/controller.h index 800a634c7..65d37cdfc 100644 --- a/src/devices/controller.h +++ b/src/devices/controller.h @@ -36,7 +36,7 @@ class Controller : public EMSdevice { Controller(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 & data); + virtual void publish_values(JsonObject & data, bool force); virtual void device_info_web(JsonArray & root); virtual bool updated_values(); diff --git a/src/devices/gateway.cpp b/src/devices/gateway.cpp index 80a27e49d..0551b7b91 100644 --- a/src/devices/gateway.cpp +++ b/src/devices/gateway.cpp @@ -37,7 +37,7 @@ void Gateway::show_values(uuid::console::Shell & shell) { } // publish values via MQTT -void Gateway::publish_values(JsonObject & data) { +void Gateway::publish_values(JsonObject & data, bool force) { } // check to see if values have been updated diff --git a/src/devices/gateway.h b/src/devices/gateway.h index ce205c2d9..51f38ffcd 100644 --- a/src/devices/gateway.h +++ b/src/devices/gateway.h @@ -36,7 +36,7 @@ class Gateway : public EMSdevice { Gateway(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 & data); + virtual void publish_values(JsonObject & data, bool force); virtual void device_info_web(JsonArray & root); virtual bool updated_values(); diff --git a/src/devices/generic.cpp b/src/devices/generic.cpp index 18c608d7e..5ab85aa63 100644 --- a/src/devices/generic.cpp +++ b/src/devices/generic.cpp @@ -37,7 +37,7 @@ void Generic::show_values(uuid::console::Shell & shell) { } // publish values via MQTT -void Generic::publish_values(JsonObject & data) { +void Generic::publish_values(JsonObject & data, bool force) { } // check to see if values have been updated diff --git a/src/devices/generic.h b/src/devices/generic.h index 4ee9fc113..643419dfb 100644 --- a/src/devices/generic.h +++ b/src/devices/generic.h @@ -36,7 +36,7 @@ class Generic : public EMSdevice { Generic(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 & data); + virtual void publish_values(JsonObject & data, bool force); virtual void device_info_web(JsonArray & root); virtual bool updated_values(); diff --git a/src/devices/heatpump.cpp b/src/devices/heatpump.cpp index 08f949173..d7222e624 100644 --- a/src/devices/heatpump.cpp +++ b/src/devices/heatpump.cpp @@ -42,7 +42,7 @@ void Heatpump::show_values(uuid::console::Shell & shell) { } // publish values via MQTT -void Heatpump::publish_values(JsonObject & data) { +void Heatpump::publish_values(JsonObject & data, bool force) { } // check to see if values have been updated diff --git a/src/devices/heatpump.h b/src/devices/heatpump.h index 7b004f045..c2e0e1ec5 100644 --- a/src/devices/heatpump.h +++ b/src/devices/heatpump.h @@ -36,7 +36,7 @@ class Heatpump : public EMSdevice { Heatpump(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 & data); + virtual void publish_values(JsonObject & data, bool force); virtual void device_info_web(JsonArray & root); virtual bool updated_values(); diff --git a/src/devices/mixing.cpp b/src/devices/mixing.cpp index ca3b23a13..bb8276b73 100644 --- a/src/devices/mixing.cpp +++ b/src/devices/mixing.cpp @@ -138,7 +138,12 @@ bool Mixing::command_info(const char * value, const int8_t id, JsonObject & outp // publish values via MQTT // topic is mixing_data -void Mixing::publish_values(JsonObject & data) { +void Mixing::publish_values(JsonObject & data, bool force) { + // handle HA first + if (Mqtt::mqtt_format() == Mqtt::Format::HA) { + register_mqtt_ha_config(force); + } + if (Mqtt::mqtt_format() == Mqtt::Format::SINGLE) { StaticJsonDocument doc; JsonObject output = doc.to(); @@ -150,18 +155,21 @@ void Mixing::publish_values(JsonObject & data) { Mqtt::publish(topic, doc.as()); } } else { - if (export_values(Mqtt::mqtt_format(), data)) { - // if we're using Home Assistant and haven't created the MQTT Discovery topics, do it now - if ((Mqtt::mqtt_format() == Mqtt::Format::HA) && (!mqtt_ha_config_)) { - register_mqtt_ha_config(); - mqtt_ha_config_ = true; - } - } + // format is HA or Nested. This is bundled together and sent in emsesp.cpp + (void)export_values(Mqtt::mqtt_format(), data); } } // publish config topic for HA MQTT Discovery -void Mixing::register_mqtt_ha_config() { +void Mixing::register_mqtt_ha_config(bool force) { + if ((mqtt_ha_config_ && !force)) { + return; + } + + if (!Mqtt::connected()) { + return; + } + // Create the Master device StaticJsonDocument doc; @@ -208,6 +216,8 @@ void Mixing::register_mqtt_ha_config() { Mqtt::register_mqtt_ha_sensor(wwc_name, nullptr, F_(pumpStatus), this->device_type(), "pumpStatus", nullptr, nullptr); Mqtt::register_mqtt_ha_sensor(wwc_name, nullptr, F_(tempStatus), this->device_type(), "tempStatus", nullptr, nullptr); } + + mqtt_ha_config_ = true; // done } // creates JSON doc from values diff --git a/src/devices/mixing.h b/src/devices/mixing.h index d9b5a7674..12f236c95 100644 --- a/src/devices/mixing.h +++ b/src/devices/mixing.h @@ -37,7 +37,7 @@ class Mixing : public EMSdevice { 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); virtual void show_values(uuid::console::Shell & shell); - virtual void publish_values(JsonObject & data); + virtual void publish_values(JsonObject & data, bool force); virtual void device_info_web(JsonArray & root); virtual bool updated_values(); @@ -45,7 +45,7 @@ class Mixing : public EMSdevice { static uuid::log::Logger logger_; bool export_values(uint8_t mqtt_format, JsonObject & doc); - void register_mqtt_ha_config(); + void register_mqtt_ha_config(bool force); bool command_info(const char * value, const int8_t id, JsonObject & output); void process_MMPLUSStatusMessage_HC(std::shared_ptr telegram); diff --git a/src/devices/solar.cpp b/src/devices/solar.cpp index 8647bcd7f..7b9992021 100644 --- a/src/devices/solar.cpp +++ b/src/devices/solar.cpp @@ -130,7 +130,12 @@ void Solar::show_values(uuid::console::Shell & shell) { } // publish values via MQTT -void Solar::publish_values(JsonObject & data) { +void Solar::publish_values(JsonObject & data, bool force) { + // handle HA first + if (Mqtt::mqtt_format() == Mqtt::Format::HA) { + register_mqtt_ha_config(force); + } + StaticJsonDocument doc; JsonObject output = doc.to(); if (export_values(output)) { @@ -138,17 +143,20 @@ void Solar::publish_values(JsonObject & data) { Mqtt::publish(F("ww_data"), doc.as()); } else { Mqtt::publish(F("solar_data"), doc.as()); - // if we're using Home Assistant and haven't created the MQTT Discovery topics, do it now - if ((Mqtt::mqtt_format() == Mqtt::Format::HA) && (!mqtt_ha_config_)) { - register_mqtt_ha_config(); - mqtt_ha_config_ = true; - } } } } // publish config topic for HA MQTT Discovery -void Solar::register_mqtt_ha_config() { +void Solar::register_mqtt_ha_config(bool force) { + if ((mqtt_ha_config_ && !force)) { + return; + } + + if (!Mqtt::connected()) { + return; + } + // Create the Master device StaticJsonDocument doc; doc["name"] = F("EMS-ESP"); @@ -183,6 +191,9 @@ void Solar::register_mqtt_ha_config() { Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(valveStatus), this->device_type(), "valveStatus", nullptr, nullptr); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(tankHeated), this->device_type(), "tankHeated", nullptr, nullptr); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(collectorShutdown), this->device_type(), "collectorShutdown", nullptr, nullptr); + + mqtt_ha_config_ = true; // done + } // creates JSON doc from values diff --git a/src/devices/solar.h b/src/devices/solar.h index 422e78b69..54eaa39a1 100644 --- a/src/devices/solar.h +++ b/src/devices/solar.h @@ -37,7 +37,7 @@ class Solar : public EMSdevice { Solar(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 & data); + virtual void publish_values(JsonObject & data, bool force); virtual void device_info_web(JsonArray & root); virtual bool updated_values(); @@ -46,7 +46,7 @@ class Solar : public EMSdevice { bool export_values(JsonObject & doc); bool command_info(const char * value, const int8_t id, JsonObject & output); - void register_mqtt_ha_config(); + void register_mqtt_ha_config(bool force); int16_t collectorTemp_ = EMS_VALUE_SHORT_NOTSET; // TS1: Temperature sensor for collector array 1 int16_t tankBottomTemp_ = EMS_VALUE_SHORT_NOTSET; // TS2: Temperature sensor 1 cylinder, bottom (solar thermal system) diff --git a/src/devices/switch.cpp b/src/devices/switch.cpp index c069fa00d..050c66564 100644 --- a/src/devices/switch.cpp +++ b/src/devices/switch.cpp @@ -37,7 +37,7 @@ void Switch::show_values(uuid::console::Shell & shell) { } // publish values via MQTT -void Switch::publish_values(JsonObject & data) { +void Switch::publish_values(JsonObject & data, bool force) { } // check to see if values have been updated diff --git a/src/devices/switch.h b/src/devices/switch.h index 565b7a739..2795aea7c 100644 --- a/src/devices/switch.h +++ b/src/devices/switch.h @@ -36,7 +36,7 @@ class Switch : public EMSdevice { Switch(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 & data); + virtual void publish_values(JsonObject & data, bool force); virtual void device_info_web(JsonArray & root); virtual bool updated_values(); diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index e48ad7c2c..d5a5cb23f 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -315,10 +315,11 @@ void Thermostat::show_values(uuid::console::Shell & shell) { } // publish values via MQTT -void Thermostat::publish_values(JsonObject & data) { +void Thermostat::publish_values(JsonObject & data, bool force) { if (EMSESP::actual_master_thermostat() != this->device_id()) { return; } + StaticJsonDocument doc; JsonObject output = doc.to(); bool has_data = false; @@ -336,6 +337,10 @@ void Thermostat::publish_values(JsonObject & data) { // if we're in HA or CUSTOM, send out the complete topic with all the data if (Mqtt::mqtt_format() != Mqtt::Format::SINGLE && has_data) { + // see if we have already registered this with HA MQTT Discovery, if not send the config + if (Mqtt::mqtt_format() == Mqtt::Format::HA) { + ha_config(force); + } Mqtt::publish(F("thermostat_data"), output); } } @@ -452,13 +457,6 @@ bool Thermostat::export_values_main(JsonObject & rootThermostat) { rootThermostat["wwcircmode"] = Helpers::render_enum(s, {"off", "on", "auto"}, wwCircMode_); } - if ((Mqtt::mqtt_format() == Mqtt::Format::HA) && (!ha_registered())) { - // see if we have already registered this with HA MQTT Discovery, if not send the config - if (register_mqtt_ha_config()) { - ha_registered(true); - } - } - return (rootThermostat.size()); } @@ -625,11 +623,6 @@ bool Thermostat::export_values_hc(uint8_t mqtt_format, JsonObject & rootThermost strlcat(topic, Helpers::itoa(s, hc->hc_num()), 30); // append hc to topic Mqtt::publish(topic, rootThermostat); rootThermostat.clear(); // clear object - } else if ((mqtt_format == Mqtt::Format::HA) && (!hc->ha_registered())) { - // see if we have already registered this with HA MQTT Discovery, if not send the config - if (register_mqtt_ha_config(hc->hc_num())) { - hc->ha_registered(true); - } } } } @@ -637,6 +630,26 @@ bool Thermostat::export_values_hc(uint8_t mqtt_format, JsonObject & rootThermost return (has_data); } +// set up HA MQTT Discovery +void Thermostat::ha_config(bool force) { + if (!Mqtt::connected()) { + return; + } + + if (force || !ha_registered()) { + register_mqtt_ha_config(); + ha_registered(true); + } + + // check to see which heating circuits need publishing + for (const auto & hc : heating_circuits_) { + if (force || (hc->is_active() && !hc->ha_registered())) { + register_mqtt_ha_config(hc->hc_num()); + hc->ha_registered(true); + } + } +} + // returns the heating circuit object based on the hc number // of nullptr if it doesn't exist yet std::shared_ptr Thermostat::heating_circuit(const uint8_t hc_num) { @@ -739,11 +752,7 @@ std::shared_ptr Thermostat::heating_circuit(std::sha // publish config topic for HA MQTT Discovery // homeassistant/climate/ems-esp/thermostat/config -bool Thermostat::register_mqtt_ha_config() { - if (!Mqtt::connected()) { - return false; - } - +void Thermostat::register_mqtt_ha_config() { StaticJsonDocument doc; doc["uniq_id"] = F("thermostat"); doc["ic"] = F("mdi:home-thermometer-outline"); @@ -783,17 +792,11 @@ bool Thermostat::register_mqtt_ha_config() { Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(wwtemplow), this->device_type(), "wwtemplow", F_(degrees), F_(icontemperature)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(wwcircmode), this->device_type(), "wwcircmode", nullptr, nullptr); } - - return true; } // publish config topic for HA MQTT Discovery // e.g. homeassistant/climate/ems-esp/thermostat_hc1/config -bool Thermostat::register_mqtt_ha_config(uint8_t hc_num) { - if (!Mqtt::connected()) { - return false; - } - +void Thermostat::register_mqtt_ha_config(uint8_t hc_num) { StaticJsonDocument doc; char str1[40]; @@ -919,8 +922,6 @@ bool Thermostat::register_mqtt_ha_config(uint8_t hc_num) { default: break; } - - return true; } // for HA specifically when receiving over MQTT in the thermostat topic diff --git a/src/devices/thermostat.h b/src/devices/thermostat.h index a8af5bc09..04a2e1ed3 100644 --- a/src/devices/thermostat.h +++ b/src/devices/thermostat.h @@ -100,7 +100,7 @@ class Thermostat : public EMSdevice { static std::string mode_tostring(uint8_t mode); virtual void show_values(uuid::console::Shell & shell); - virtual void publish_values(JsonObject & data); + virtual void publish_values(JsonObject & data, bool force); virtual void device_info_web(JsonArray & root); virtual bool updated_values(); @@ -237,8 +237,9 @@ class Thermostat : public EMSdevice { std::shared_ptr heating_circuit(std::shared_ptr telegram); std::shared_ptr heating_circuit(const uint8_t hc_num); - bool register_mqtt_ha_config(); - bool register_mqtt_ha_config(uint8_t hc_num); + void register_mqtt_ha_config(); + void register_mqtt_ha_config(uint8_t hc_num); + void ha_config(bool force = false); bool thermostat_ha_cmd(const char * message, uint8_t hc_num); bool command_info(const char * value, const int8_t id, JsonObject & output); diff --git a/src/emsdevice.h b/src/emsdevice.h index b5bc52a8a..7ae779c46 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -140,10 +140,10 @@ class EMSdevice { void register_mqtt_cmd(const __FlashStringHelper * cmd, cmdfunction_p f); // virtual functions overrules by derived classes - virtual void show_values(uuid::console::Shell & shell) = 0; - virtual void publish_values(JsonObject & data) = 0; - virtual bool updated_values() = 0; - virtual void device_info_web(JsonArray & root) = 0; + virtual void show_values(uuid::console::Shell & shell) = 0; + virtual void publish_values(JsonObject & data, bool force = false) = 0; + virtual bool updated_values() = 0; + virtual void device_info_web(JsonArray & root) = 0; std::string telegram_type_name(std::shared_ptr telegram); diff --git a/src/emsesp.cpp b/src/emsesp.cpp index d0b709b67..30c7e7961 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -288,12 +288,12 @@ void EMSESP::show_sensor_values(uuid::console::Shell & shell) { } // MQTT publish everything, immediately -void EMSESP::publish_all() { +void EMSESP::publish_all(bool force) { if (Mqtt::connected()) { - publish_device_values(EMSdevice::DeviceType::BOILER); - publish_device_values(EMSdevice::DeviceType::THERMOSTAT); - publish_device_values(EMSdevice::DeviceType::SOLAR); - publish_device_values(EMSdevice::DeviceType::MIXING); + 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_other_values(); publish_sensor_values(true); system_.send_heartbeat(); @@ -302,13 +302,13 @@ void EMSESP::publish_all() { // 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 -void EMSESP::publish_device_values(uint8_t device_type) { +void EMSESP::publish_device_values(uint8_t device_type, bool force) { if (device_type == EMSdevice::DeviceType::MIXING && Mqtt::mqtt_format() != Mqtt::Format::SINGLE) { DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE); JsonObject output = doc.to(); for (const auto & emsdevice : emsdevices) { if (emsdevice && (emsdevice->device_type() == device_type)) { - emsdevice->publish_values(output); + emsdevice->publish_values(output, force); } } doc.shrinkToFit(); @@ -319,7 +319,7 @@ void EMSESP::publish_device_values(uint8_t device_type) { for (const auto & emsdevice : emsdevices) { if (emsdevice && (emsdevice->device_type() == device_type)) { JsonObject dummy; - emsdevice->publish_values(dummy); + emsdevice->publish_values(dummy, force); } } } diff --git a/src/emsesp.h b/src/emsesp.h index 7ba337d16..b249b1ba3 100644 --- a/src/emsesp.h +++ b/src/emsesp.h @@ -61,10 +61,10 @@ class EMSESP { static void start(); static void loop(); - static void publish_device_values(uint8_t device_type); + static void publish_device_values(uint8_t device_type, bool force = false); static void publish_other_values(); static void publish_sensor_values(const bool force = false); - static void publish_all(); + static void publish_all(bool force = false); #ifdef EMSESP_STANDALONE static void run_test(uuid::console::Shell & shell, const std::string & command); // only for testing diff --git a/src/locale_EN.h b/src/locale_EN.h index 16d0eeda4..eddf1e89c 100644 --- a/src/locale_EN.h +++ b/src/locale_EN.h @@ -107,6 +107,7 @@ MAKE_PSTR(wifi_ssid_fmt, "WiFi SSID = %s") MAKE_PSTR(wifi_password_fmt, "WiFi Password = %S") MAKE_PSTR(mqtt_heartbeat_fmt, "MQTT Heartbeat is %s") MAKE_PSTR(cmd_optional, "[cmd]") +MAKE_PSTR(ha_optional, "[ha]") MAKE_PSTR(deep_optional, "[deep]") MAKE_PSTR(tx_mode_fmt, "Tx mode = %d") MAKE_PSTR(bus_id_fmt, "Bus ID = %02X") diff --git a/src/version.h b/src/version.h index 410ae2d5e..98b89d15e 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "2.1.0b9" +#define EMSESP_APP_VERSION "2.1.0b10"