mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
Merge pull request #2593 from proddy/dev
minor updates and ESP32Async/AsyncTCP back to v3.4.2
This commit is contained in:
@@ -44,22 +44,22 @@
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.27.7",
|
||||
"@eslint/js": "^9.30.0",
|
||||
"@babel/core": "^7.28.0",
|
||||
"@eslint/js": "^9.30.1",
|
||||
"@preact/compat": "^18.3.1",
|
||||
"@preact/preset-vite": "^2.10.2",
|
||||
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
||||
"@types/node": "^24.0.7",
|
||||
"@types/node": "^24.0.11",
|
||||
"@types/react": "^19.1.8",
|
||||
"@types/react-dom": "^19.1.6",
|
||||
"concurrently": "^9.2.0",
|
||||
"eslint": "^9.30.0",
|
||||
"eslint": "^9.30.1",
|
||||
"eslint-config-prettier": "^10.1.5",
|
||||
"prettier": "^3.6.2",
|
||||
"rollup-plugin-visualizer": "^6.0.3",
|
||||
"terser": "^5.43.1",
|
||||
"typescript-eslint": "^8.35.0",
|
||||
"vite": "^7.0.0",
|
||||
"typescript-eslint": "^8.36.0",
|
||||
"vite": "^7.0.3",
|
||||
"vite-plugin-imagemin": "^0.6.1",
|
||||
"vite-tsconfig-paths": "^5.1.4"
|
||||
},
|
||||
|
||||
869
interface/pnpm-lock.yaml
generated
869
interface/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
90
mock-api/pnpm-lock.yaml
generated
90
mock-api/pnpm-lock.yaml
generated
@@ -30,8 +30,12 @@ packages:
|
||||
resolution: {integrity: sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@babel/generator@7.27.5':
|
||||
resolution: {integrity: sha512-ZGhA37l0e/g2s1Cnzdix0O3aLYm66eF8aufiVteOgnwxgnRP8GoyMj7VWsgWnQbVKXyge7hqrFh2K2TQM6t1Hw==}
|
||||
'@babel/generator@7.28.0':
|
||||
resolution: {integrity: sha512-lJjzvrbEeWrhB4P3QBsH7tey117PjLZnDbLiQEKjQ/fNJTjuq4HSqgFA+UNSwZT8D7dxxbnuSBMsa1lrWzKlQg==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@babel/helper-globals@7.28.0':
|
||||
resolution: {integrity: sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@babel/helper-string-parser@7.27.1':
|
||||
@@ -42,8 +46,8 @@ packages:
|
||||
resolution: {integrity: sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@babel/parser@7.27.7':
|
||||
resolution: {integrity: sha512-qnzXzDXdr/po3bOTbTIQZ7+TxNKxpkN5IifVLXS+r7qwynkZfPyjZfE7hCXbo7IoO9TNcSyibgONsf2HauUd3Q==}
|
||||
'@babel/parser@7.28.0':
|
||||
resolution: {integrity: sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
hasBin: true
|
||||
|
||||
@@ -51,26 +55,26 @@ packages:
|
||||
resolution: {integrity: sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@babel/traverse@7.27.7':
|
||||
resolution: {integrity: sha512-X6ZlfR/O/s5EQ/SnUSLzr+6kGnkg8HXGMzpgsMsrJVcfDtH1vIp6ctCN4eZ1LS5c0+te5Cb6Y514fASjMRJ1nw==}
|
||||
'@babel/traverse@7.28.0':
|
||||
resolution: {integrity: sha512-mGe7UK5wWyh0bKRfupsUchrQGqvDbZDbKJw+kcRGSmdHVYrv+ltd0pnpDTVpiTqnaBru9iEvA8pz8W46v0Amwg==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@babel/types@7.27.7':
|
||||
resolution: {integrity: sha512-8OLQgDScAOHXnAz2cV+RfzzNMipuLVBz2biuAJFMV9bfkNf393je3VM8CLkjQodW5+iWsSJdSgSWT6rsZoXHPw==}
|
||||
'@babel/types@7.28.0':
|
||||
resolution: {integrity: sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.10':
|
||||
resolution: {integrity: sha512-HM2F4B9N4cA0RH2KQiIZOHAZqtP4xGS4IZ+SFe1SIbO4dyjf9MTY2Bo3vHYnm0hglWfXqBrzUBSa+cJfl3Xvrg==}
|
||||
'@jridgewell/gen-mapping@0.3.12':
|
||||
resolution: {integrity: sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==}
|
||||
|
||||
'@jridgewell/resolve-uri@3.1.2':
|
||||
resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
|
||||
'@jridgewell/sourcemap-codec@1.5.2':
|
||||
resolution: {integrity: sha512-gKYheCylLIedI+CSZoDtGkFV9YEBxRRVcfCH7OfAqh4TyUyRjEE6WVE/aXDXX0p8BIe/QgLcaAoI0220KRRFgg==}
|
||||
'@jridgewell/sourcemap-codec@1.5.4':
|
||||
resolution: {integrity: sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw==}
|
||||
|
||||
'@jridgewell/trace-mapping@0.3.27':
|
||||
resolution: {integrity: sha512-VO95AxtSFMelbg3ouljAYnfvTEwSWVt/2YLf+U5Ejd8iT5mXE2Sa/1LGyvySMne2CGsepGLI7KpF3EzE3Aq9Mg==}
|
||||
'@jridgewell/trace-mapping@0.3.29':
|
||||
resolution: {integrity: sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ==}
|
||||
|
||||
'@msgpack/msgpack@3.1.2':
|
||||
resolution: {integrity: sha512-JEW4DEtBzfe8HvUYecLU9e6+XJnKDlUAIve8FvPzF3Kzs6Xo/KuZkZJsDH0wJXl/qEZbeeE7edxDNY3kMs39hQ==}
|
||||
@@ -118,10 +122,6 @@ packages:
|
||||
resolution: {integrity: sha512-YikH+7CUTOtP44ZTnUhR7Ic2UASBPOqmaRkRKxRbywPTe5VxF7RRCck4af9wutiZ/QKM5nME9Bie2fFaPz5Gug==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
|
||||
globals@11.12.0:
|
||||
resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==}
|
||||
engines: {node: '>=4'}
|
||||
|
||||
itty-router@5.0.18:
|
||||
resolution: {integrity: sha512-mK3ReOt4ARAGy0V0J7uHmArG2USN2x0zprZ+u+YgmeRjXTDbaowDy3kPcsmQY6tH+uHhDgpWit9Vqmv/4rTXwA==}
|
||||
|
||||
@@ -164,58 +164,60 @@ snapshots:
|
||||
js-tokens: 4.0.0
|
||||
picocolors: 1.1.1
|
||||
|
||||
'@babel/generator@7.27.5':
|
||||
'@babel/generator@7.28.0':
|
||||
dependencies:
|
||||
'@babel/parser': 7.27.7
|
||||
'@babel/types': 7.27.7
|
||||
'@jridgewell/gen-mapping': 0.3.10
|
||||
'@jridgewell/trace-mapping': 0.3.27
|
||||
'@babel/parser': 7.28.0
|
||||
'@babel/types': 7.28.0
|
||||
'@jridgewell/gen-mapping': 0.3.12
|
||||
'@jridgewell/trace-mapping': 0.3.29
|
||||
jsesc: 3.1.0
|
||||
|
||||
'@babel/helper-globals@7.28.0': {}
|
||||
|
||||
'@babel/helper-string-parser@7.27.1': {}
|
||||
|
||||
'@babel/helper-validator-identifier@7.27.1': {}
|
||||
|
||||
'@babel/parser@7.27.7':
|
||||
'@babel/parser@7.28.0':
|
||||
dependencies:
|
||||
'@babel/types': 7.27.7
|
||||
'@babel/types': 7.28.0
|
||||
|
||||
'@babel/template@7.27.2':
|
||||
dependencies:
|
||||
'@babel/code-frame': 7.27.1
|
||||
'@babel/parser': 7.27.7
|
||||
'@babel/types': 7.27.7
|
||||
'@babel/parser': 7.28.0
|
||||
'@babel/types': 7.28.0
|
||||
|
||||
'@babel/traverse@7.27.7':
|
||||
'@babel/traverse@7.28.0':
|
||||
dependencies:
|
||||
'@babel/code-frame': 7.27.1
|
||||
'@babel/generator': 7.27.5
|
||||
'@babel/parser': 7.27.7
|
||||
'@babel/generator': 7.28.0
|
||||
'@babel/helper-globals': 7.28.0
|
||||
'@babel/parser': 7.28.0
|
||||
'@babel/template': 7.27.2
|
||||
'@babel/types': 7.27.7
|
||||
'@babel/types': 7.28.0
|
||||
debug: 4.4.1
|
||||
globals: 11.12.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@babel/types@7.27.7':
|
||||
'@babel/types@7.28.0':
|
||||
dependencies:
|
||||
'@babel/helper-string-parser': 7.27.1
|
||||
'@babel/helper-validator-identifier': 7.27.1
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.10':
|
||||
'@jridgewell/gen-mapping@0.3.12':
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.5.2
|
||||
'@jridgewell/trace-mapping': 0.3.27
|
||||
'@jridgewell/sourcemap-codec': 1.5.4
|
||||
'@jridgewell/trace-mapping': 0.3.29
|
||||
|
||||
'@jridgewell/resolve-uri@3.1.2': {}
|
||||
|
||||
'@jridgewell/sourcemap-codec@1.5.2': {}
|
||||
'@jridgewell/sourcemap-codec@1.5.4': {}
|
||||
|
||||
'@jridgewell/trace-mapping@0.3.27':
|
||||
'@jridgewell/trace-mapping@0.3.29':
|
||||
dependencies:
|
||||
'@jridgewell/resolve-uri': 3.1.2
|
||||
'@jridgewell/sourcemap-codec': 1.5.2
|
||||
'@jridgewell/sourcemap-codec': 1.5.4
|
||||
|
||||
'@msgpack/msgpack@3.1.2': {}
|
||||
|
||||
@@ -227,10 +229,10 @@ snapshots:
|
||||
|
||||
'@trivago/prettier-plugin-sort-imports@5.2.2(prettier@3.6.2)':
|
||||
dependencies:
|
||||
'@babel/generator': 7.27.5
|
||||
'@babel/parser': 7.27.7
|
||||
'@babel/traverse': 7.27.7
|
||||
'@babel/types': 7.27.7
|
||||
'@babel/generator': 7.28.0
|
||||
'@babel/parser': 7.28.0
|
||||
'@babel/traverse': 7.28.0
|
||||
'@babel/types': 7.28.0
|
||||
javascript-natural-sort: 0.7.1
|
||||
lodash: 4.17.21
|
||||
prettier: 3.6.2
|
||||
@@ -254,8 +256,6 @@ snapshots:
|
||||
dezalgo: 1.0.4
|
||||
once: 1.4.0
|
||||
|
||||
globals@11.12.0: {}
|
||||
|
||||
itty-router@5.0.18: {}
|
||||
|
||||
javascript-natural-sort@0.7.1: {}
|
||||
|
||||
@@ -53,7 +53,7 @@ custom_password = admin
|
||||
; example override for lib_deps and using locally built modules
|
||||
; lib_deps =
|
||||
; bblanchon/ArduinoJson @ 7.4.2
|
||||
; ESP32Async/AsyncTCP @ 3.4.4
|
||||
; ESP32Async/AsyncTCP @ 3.4.2
|
||||
; ESP32Async/ESPAsyncWebServer @ 3.7.9
|
||||
; file://${PROJECT_DIR}/../modules/EMS-ESP-Modules
|
||||
; ; https://github.com/emsesp/EMS-ESP-Modules.git @ 1.0.8
|
||||
|
||||
@@ -101,7 +101,7 @@ build_type = release
|
||||
board_build.filesystem = littlefs
|
||||
lib_deps =
|
||||
bblanchon/ArduinoJson @ 7.4.2
|
||||
ESP32Async/AsyncTCP @ 3.4.4
|
||||
ESP32Async/AsyncTCP @ 3.4.2
|
||||
ESP32Async/ESPAsyncWebServer @ 3.7.9
|
||||
https://github.com/emsesp/EMS-ESP-Modules.git @ 1.0.8
|
||||
|
||||
|
||||
@@ -685,7 +685,7 @@ void AnalogSensor::publish_values(const bool force) {
|
||||
}
|
||||
}
|
||||
|
||||
Mqtt::add_ha_dev_section(config.as<JsonObject>(), "Analog Sensors", nullptr, nullptr, false);
|
||||
Mqtt::add_ha_dev_section(config.as<JsonObject>(), "Analog Sensors", nullptr, nullptr, nullptr, false);
|
||||
Mqtt::add_ha_avail_section(config.as<JsonObject>(), stat_t, !is_ha_device_created, val_cond);
|
||||
|
||||
sensor.ha_registered = Mqtt::queue_ha(topic, config.as<JsonObject>());
|
||||
|
||||
@@ -321,6 +321,11 @@ std::string EMSdevice::to_string() {
|
||||
+ ", Version:" + version_ + ")";
|
||||
}
|
||||
|
||||
// returns string of EMS device version and productID
|
||||
std::string EMSdevice::to_string_version() {
|
||||
return "DeviceID:" + Helpers::hextoa(device_id_) + " ProductID:" + Helpers::itoa(product_id_) + " Version:" + version_;
|
||||
}
|
||||
|
||||
// returns out brand + device name
|
||||
// translated
|
||||
std::string EMSdevice::to_string_short() {
|
||||
@@ -1221,7 +1226,7 @@ void EMSdevice::setCustomizationEntity(const std::string & entity_id) {
|
||||
if (Mqtt::ha_enabled() && (has_custom_name || ((current_mask ^ new_mask) & (DeviceValueState::DV_READONLY >> 4)))) {
|
||||
// remove ha config on change of dv_readonly flag
|
||||
dv.remove_state(DeviceValueState::DV_HA_CONFIG_CREATED);
|
||||
Mqtt::publish_ha_sensor_config_dv(dv, "", "", true); // delete topic (remove = true)
|
||||
Mqtt::publish_ha_sensor_config_dv(dv, "", "", "", true); // delete topic (remove = true)
|
||||
}
|
||||
|
||||
// always write the mask
|
||||
@@ -1886,7 +1891,7 @@ void EMSdevice::mqtt_ha_entity_config_create() {
|
||||
if (!dv.has_state(DeviceValueState::DV_HA_CONFIG_CREATED) && dv.has_state(DeviceValueState::DV_ACTIVE)
|
||||
&& !dv.has_state(DeviceValueState::DV_API_MQTT_EXCLUDE)) {
|
||||
// create_device_config is only done once for the EMS device. It can added to any entity, so we take the first
|
||||
if (Mqtt::publish_ha_sensor_config_dv(dv, name().c_str(), brand_to_char(), false, create_device_config)) {
|
||||
if (Mqtt::publish_ha_sensor_config_dv(dv, name().c_str(), brand_to_char(), to_string_version().c_str(), false, create_device_config)) {
|
||||
dv.add_state(DeviceValueState::DV_HA_CONFIG_CREATED);
|
||||
create_device_config = false; // only create the main config once
|
||||
count++;
|
||||
|
||||
@@ -62,6 +62,7 @@ class EMSdevice {
|
||||
const char * brand_to_char();
|
||||
std::string to_string();
|
||||
std::string to_string_short();
|
||||
std::string to_string_version();
|
||||
std::string name(); // returns either default or custom name of a device (if defined)
|
||||
|
||||
bool is_device_id(uint8_t device_id) const {
|
||||
|
||||
@@ -747,7 +747,12 @@ bool Mqtt::queue_ha(const char * topic, const JsonObjectConst payload) {
|
||||
// create's a ha sensor config topic from a device value object (dev)
|
||||
// adds ids, name, mf, mdl, via_device
|
||||
// and also takes a flag (create_device_config) used to also create the main HA device config. This is only needed for one entity
|
||||
bool Mqtt::publish_ha_sensor_config_dv(DeviceValue & dv, const char * model, const char * brand, const bool remove, const bool create_device_config) {
|
||||
bool Mqtt::publish_ha_sensor_config_dv(DeviceValue & dv,
|
||||
const char * model,
|
||||
const char * brand,
|
||||
const char * version,
|
||||
const bool remove,
|
||||
const bool create_device_config) {
|
||||
// calculate the min and max
|
||||
int16_t dv_set_min;
|
||||
uint32_t dv_set_max;
|
||||
@@ -774,6 +779,7 @@ bool Mqtt::publish_ha_sensor_config_dv(DeviceValue & dv, const char * model, con
|
||||
dv.numeric_operator,
|
||||
model,
|
||||
brand,
|
||||
version,
|
||||
create_device_config);
|
||||
}
|
||||
|
||||
@@ -801,6 +807,7 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
|
||||
const int8_t num_op,
|
||||
const char * const model,
|
||||
const char * const brand,
|
||||
const char * const version,
|
||||
const bool create_device_config) {
|
||||
// ignore if name (fullname) is empty
|
||||
if (!fullname || !en_name) {
|
||||
@@ -1096,9 +1103,9 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
|
||||
|
||||
// add dev section
|
||||
if (device_type == EMSdevice::DeviceType::SYSTEM) {
|
||||
add_ha_dev_section(doc.as<JsonObject>(), nullptr, nullptr, nullptr, false);
|
||||
add_ha_dev_section(doc.as<JsonObject>(), nullptr, nullptr, nullptr, nullptr, false);
|
||||
} else {
|
||||
add_ha_dev_section(doc.as<JsonObject>(), EMSdevice::device_type_2_device_name(device_type), model, brand, create_device_config);
|
||||
add_ha_dev_section(doc.as<JsonObject>(), EMSdevice::device_type_2_device_name(device_type), model, brand, version, create_device_config);
|
||||
}
|
||||
|
||||
return queue_ha(topic, doc.as<JsonObject>());
|
||||
@@ -1334,7 +1341,7 @@ bool Mqtt::publish_ha_climate_config(const int8_t tag, const bool has_roomtemp,
|
||||
modes.add("heat");
|
||||
modes.add("off");
|
||||
|
||||
add_ha_dev_section(doc.as<JsonObject>(), "thermostat", nullptr, nullptr, false); // add dev section
|
||||
add_ha_dev_section(doc.as<JsonObject>(), "thermostat", nullptr, nullptr, nullptr, false); // add dev section
|
||||
add_ha_avail_section(doc.as<JsonObject>(), topic_t, false, seltemp_cond, has_roomtemp ? currtemp_cond : nullptr, hc_mode_cond); // add availability section
|
||||
|
||||
return queue_ha(topic, doc.as<JsonObject>()); // publish the config payload with retain flag
|
||||
@@ -1362,7 +1369,7 @@ std::string Mqtt::tag_to_topic(uint8_t device_type, int8_t tag) {
|
||||
// add devs section to an existing doc, only for HA
|
||||
// under devs node it will create ids and name and optional mf, mdl, via_device
|
||||
// name could be EMSdevice::device_type_2_device_name(dv.device_type));
|
||||
void Mqtt::add_ha_dev_section(JsonObject doc, const char * name, const char * model, const char * brand, const bool create_model) {
|
||||
void Mqtt::add_ha_dev_section(JsonObject doc, const char * name, const char * model, const char * brand, const char * version, const bool create_model) {
|
||||
// only works for HA
|
||||
if (discovery_type() != discoveryType::HOMEASSISTANT) {
|
||||
return;
|
||||
@@ -1394,6 +1401,9 @@ void Mqtt::add_ha_dev_section(JsonObject doc, const char * name, const char * mo
|
||||
if (model != nullptr) {
|
||||
dev_json["mdl"] = model;
|
||||
}
|
||||
if (version != nullptr) {
|
||||
dev_json["sw"] = version;
|
||||
}
|
||||
dev_json["via_device"] = Mqtt::basename();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,13 @@ class Mqtt {
|
||||
static bool queue_ha(const char * topic, const JsonObjectConst payload);
|
||||
static bool queue_remove_topic(const char * topic);
|
||||
|
||||
static bool publish_ha_sensor_config_dv(DeviceValue & dv, const char * model, const char * brand, const bool remove, const bool create_device_config = false);
|
||||
static bool publish_ha_sensor_config_dv(DeviceValue & dv,
|
||||
const char * model,
|
||||
const char * brand,
|
||||
const char * version,
|
||||
const bool remove,
|
||||
const bool create_device_config = false);
|
||||
|
||||
static bool publish_ha_sensor_config(uint8_t type,
|
||||
int8_t tag,
|
||||
const char * const fullname,
|
||||
@@ -102,6 +108,7 @@ class Mqtt {
|
||||
const int8_t num_op,
|
||||
const char * const model = nullptr,
|
||||
const char * const brand = nullptr,
|
||||
const char * const version = nullptr,
|
||||
const bool create_device_config = false);
|
||||
|
||||
static bool publish_system_ha_sensor_config(uint8_t type, const char * name, const char * entity, const uint8_t uom);
|
||||
@@ -247,7 +254,7 @@ class Mqtt {
|
||||
|
||||
static void
|
||||
add_ha_classes(JsonObject doc, const uint8_t device_type, const uint8_t type, const uint8_t uom, const char * entity = nullptr, bool is_discovery = true);
|
||||
static void add_ha_dev_section(JsonObject doc, const char * name, const char * model, const char * brand, const bool create_model);
|
||||
static void add_ha_dev_section(JsonObject doc, const char * name, const char * model, const char * brand, const char * version, const bool create_model);
|
||||
static void add_ha_avail_section(JsonObject doc,
|
||||
const char * state_t,
|
||||
const bool is_first,
|
||||
|
||||
@@ -212,7 +212,7 @@ void Shower::create_ha_discovery() {
|
||||
doc["stat_t"] = stat_t;
|
||||
|
||||
Mqtt::add_ha_bool(doc.as<JsonObject>());
|
||||
Mqtt::add_ha_dev_section(doc.as<JsonObject>(), "Shower Sensor", nullptr, nullptr, false);
|
||||
Mqtt::add_ha_dev_section(doc.as<JsonObject>(), "Shower Sensor", nullptr, nullptr, nullptr, false);
|
||||
Mqtt::add_ha_avail_section(doc.as<JsonObject>(), stat_t, true); // no conditions
|
||||
|
||||
snprintf(topic, sizeof(topic), "binary_sensor/%s/shower_active/config", Mqtt::basename().c_str());
|
||||
@@ -243,7 +243,7 @@ void Shower::create_ha_discovery() {
|
||||
doc["dev_cla"] = "duration";
|
||||
// doc["ent_cat"] = "diagnostic";
|
||||
|
||||
Mqtt::add_ha_dev_section(doc.as<JsonObject>(), "Shower Sensor", nullptr, nullptr, false);
|
||||
Mqtt::add_ha_dev_section(doc.as<JsonObject>(), "Shower Sensor", nullptr, nullptr, nullptr, false);
|
||||
Mqtt::add_ha_avail_section(doc.as<JsonObject>(), stat_t, false, "value_json.duration is defined");
|
||||
|
||||
snprintf(topic, sizeof(topic), "sensor/%s/shower_duration/config", Mqtt::basename().c_str());
|
||||
|
||||
@@ -520,7 +520,7 @@ void TemperatureSensor::publish_values(const bool force) {
|
||||
}
|
||||
}
|
||||
|
||||
Mqtt::add_ha_dev_section(config.as<JsonObject>(), "Temperature Sensors", nullptr, nullptr, false);
|
||||
Mqtt::add_ha_dev_section(config.as<JsonObject>(), "Temperature Sensors", nullptr, nullptr, nullptr, false);
|
||||
Mqtt::add_ha_avail_section(config.as<JsonObject>(), stat_t, !is_ha_device_created, val_cond);
|
||||
|
||||
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
|
||||
|
||||
@@ -452,7 +452,7 @@ void WebCustomEntityService::publish(const bool force) {
|
||||
}
|
||||
|
||||
Mqtt::add_ha_classes(config.as<JsonObject>(), EMSdevice::DeviceType::SYSTEM, entityItem.value_type, entityItem.uom);
|
||||
Mqtt::add_ha_dev_section(config.as<JsonObject>(), "Custom Entities", nullptr, nullptr, false);
|
||||
Mqtt::add_ha_dev_section(config.as<JsonObject>(), "Custom Entities", nullptr, nullptr, nullptr, false);
|
||||
Mqtt::add_ha_avail_section(config.as<JsonObject>(), stat_t, !ha_created, val_cond);
|
||||
|
||||
ha_created |= Mqtt::queue_ha(topic, config.as<JsonObject>());
|
||||
|
||||
@@ -288,7 +288,7 @@ void WebSchedulerService::publish(const bool force) {
|
||||
config["cmd_t"] = command_topic;
|
||||
|
||||
Mqtt::add_ha_bool(config.as<JsonObject>());
|
||||
Mqtt::add_ha_dev_section(config.as<JsonObject>(), F_(scheduler), nullptr, nullptr, false);
|
||||
Mqtt::add_ha_dev_section(config.as<JsonObject>(), F_(scheduler), nullptr, nullptr, nullptr, false);
|
||||
Mqtt::add_ha_avail_section(config.as<JsonObject>(), stat_t, !ha_created, val_cond);
|
||||
|
||||
ha_created |= Mqtt::queue_ha(topic, config.as<JsonObject>());
|
||||
|
||||
Reference in New Issue
Block a user