mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 01:09:51 +03:00
Merge branch 'dev' of https://github.com/proddy/EMS-ESP32 into dev
This commit is contained in:
@@ -932,6 +932,7 @@ void Mqtt::publish_ha_sensor_config(DeviceValue & dv, const std::string & model,
|
||||
publish_ha_sensor_config(dv.type,
|
||||
dv.tag,
|
||||
dv.get_fullname().c_str(),
|
||||
(dv.fullname ? dv.fullname[0] : nullptr), // EN name
|
||||
dv.device_type,
|
||||
dv.short_name,
|
||||
dv.uom,
|
||||
@@ -952,7 +953,7 @@ void Mqtt::publish_system_ha_sensor_config(uint8_t type, const char * name, cons
|
||||
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);
|
||||
publish_ha_sensor_config(type, DeviceValueTAG::TAG_HEARTBEAT, name, name, EMSdevice::DeviceType::SYSTEM, entity, uom, false, false, nullptr, 0, 0, 0, dev_json);
|
||||
}
|
||||
|
||||
// MQTT discovery configs
|
||||
@@ -961,6 +962,7 @@ void Mqtt::publish_system_ha_sensor_config(uint8_t type, const char * name, cons
|
||||
void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice::DeviceValueType
|
||||
uint8_t tag, // EMSdevice::DeviceValueTAG
|
||||
const char * const fullname, // fullname, already translated
|
||||
const char * const en_name, // original name
|
||||
const uint8_t device_type, // EMSdevice::DeviceType
|
||||
const char * const entity, // same as shortname
|
||||
const uint8_t uom, // EMSdevice::DeviceValueUOM (0=NONE)
|
||||
@@ -990,10 +992,11 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
|
||||
// build unique identifier which will be used in the topic, also used as object_id
|
||||
char uniq_id[70];
|
||||
if (Mqtt::multiple_instances()) {
|
||||
// prefix base name to each uniq_id
|
||||
// prefix base name to each uniq_id and use the shortname
|
||||
snprintf(uniq_id, sizeof(uniq_id), "%s_%s_%s", mqtt_basename_.c_str(), device_name, entity_with_tag);
|
||||
} else {
|
||||
snprintf(uniq_id, sizeof(uniq_id), "%s_%s", device_name, entity_with_tag);
|
||||
// old v3.4 style
|
||||
snprintf(uniq_id, sizeof(uniq_id), "%s_%s", device_name, en_name);
|
||||
}
|
||||
|
||||
// build a config topic that will be prefix onto a HA type (e.g. number, switch)
|
||||
|
||||
@@ -95,6 +95,7 @@ class Mqtt {
|
||||
static void publish_ha_sensor_config(uint8_t type,
|
||||
uint8_t tag,
|
||||
const char * const fullname,
|
||||
const char * const en_name,
|
||||
const uint8_t device_type,
|
||||
const char * const entity,
|
||||
const uint8_t uom,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#define EMSESP_APP_VERSION "3.5.0b11"
|
||||
#define EMSESP_APP_VERSION "3.5.0b12"
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32C3
|
||||
#define EMSESP_PLATFORM "ESP32-C3";
|
||||
|
||||
Reference in New Issue
Block a user