remove obsolete create_device_config and icons

This commit is contained in:
proddy
2022-02-20 13:39:36 +01:00
parent 493238e696
commit 35fec3150b
2 changed files with 22 additions and 26 deletions

View File

@@ -892,19 +892,8 @@ void Mqtt::process_queue() {
mqtt_messages_.pop_front(); // remove the message from the queue mqtt_messages_.pop_front(); // remove the message from the queue
} }
// publish HA sensor for System using the heartbeat tag
void Mqtt::publish_system_ha_sensor_config(uint8_t type, const __FlashStringHelper * name, const __FlashStringHelper * entity, const uint8_t uom) {
StaticJsonDocument<EMSESP_JSON_SIZE_HA_CONFIG> doc;
JsonObject dev_json = doc.createNestedObject("dev");
JsonArray ids = dev_json.createNestedArray("ids");
ids.add("ems-esp");
publish_ha_sensor_config(type, DeviceValueTAG::TAG_HEARTBEAT, name, EMSdevice::DeviceType::SYSTEM, entity, uom, false, false, false, nullptr, 0, 0, 0, dev_json);
}
// create's a ha sensor config topic from a device value object // create's a ha sensor config topic from a device value object
// and also takes a flag to see whether it will also create the main HA device config // and also takes a flag (create_device_config) used to also create the main HA device config. This is only needed for one entity
void Mqtt::publish_ha_sensor_config(DeviceValue & dv, const std::string & model, const std::string & brand, const bool remove, const bool create_device_config) { void Mqtt::publish_ha_sensor_config(DeviceValue & dv, const std::string & model, const std::string & brand, const bool remove, const bool create_device_config) {
StaticJsonDocument<EMSESP_JSON_SIZE_HA_CONFIG> dev_json; StaticJsonDocument<EMSESP_JSON_SIZE_HA_CONFIG> dev_json;
@@ -934,7 +923,6 @@ void Mqtt::publish_ha_sensor_config(DeviceValue & dv, const std::string & model,
dv.short_name, dv.short_name,
dv.uom, dv.uom,
remove, remove,
create_device_config,
dv.has_cmd, dv.has_cmd,
dv.options, dv.options,
dv.options_size, dv.options_size,
@@ -943,6 +931,17 @@ void Mqtt::publish_ha_sensor_config(DeviceValue & dv, const std::string & model,
dev_json.as<JsonObject>()); dev_json.as<JsonObject>());
} }
// publish HA sensor for System using the heartbeat tag
void Mqtt::publish_system_ha_sensor_config(uint8_t type, const __FlashStringHelper * name, const __FlashStringHelper * entity, const uint8_t uom) {
StaticJsonDocument<EMSESP_JSON_SIZE_HA_CONFIG> doc;
JsonObject dev_json = doc.createNestedObject("dev");
JsonArray ids = dev_json.createNestedArray("ids");
ids.add("ems-esp");
publish_ha_sensor_config(type, DeviceValueTAG::TAG_HEARTBEAT, name, EMSdevice::DeviceType::SYSTEM, entity, uom, false, false, nullptr, 0, 0, 0, dev_json);
}
// MQTT discovery configs // MQTT discovery configs
// entity must match the key/value pair in the *_data topic // entity must match the key/value pair in the *_data topic
// note: some extra string copying done here, it looks messy but does help with heap fragmentation issues // note: some extra string copying done here, it looks messy but does help with heap fragmentation issues
@@ -953,7 +952,6 @@ void Mqtt::publish_ha_sensor_config(uint8_t type,
const __FlashStringHelper * entity, // shortname const __FlashStringHelper * entity, // shortname
const uint8_t uom, // EMSdevice::DeviceValueUOM (0=NONE) const uint8_t uom, // EMSdevice::DeviceValueUOM (0=NONE)
const bool remove, // true if we want to remove this topic const bool remove, // true if we want to remove this topic
const bool create_device_config, // true if need to create main device config
const bool has_cmd, const bool has_cmd,
const __FlashStringHelper * const * options, const __FlashStringHelper * const * options,
uint8_t options_size, uint8_t options_size,

View File

@@ -92,7 +92,6 @@ class Mqtt {
static void static void
publish_ha_sensor_config(DeviceValue & dv, const std::string & model, const std::string & brand, const bool remove, const bool create_device_config = false); publish_ha_sensor_config(DeviceValue & dv, const std::string & model, const std::string & brand, const bool remove, const bool create_device_config = false);
static void publish_ha_sensor_config(uint8_t type, static void publish_ha_sensor_config(uint8_t type,
uint8_t tag, uint8_t tag,
const __FlashStringHelper * name, const __FlashStringHelper * name,
@@ -100,7 +99,6 @@ class Mqtt {
const __FlashStringHelper * entity, const __FlashStringHelper * entity,
const uint8_t uom, const uint8_t uom,
const bool remove, const bool remove,
const bool create_device_config,
const bool has_cmd, const bool has_cmd,
const __FlashStringHelper * const * options, const __FlashStringHelper * const * options,
uint8_t options_size, uint8_t options_size,