minor cleanup and testing

This commit is contained in:
Proddy
2022-12-17 11:05:20 +01:00
parent 147be12583
commit 4b7bbb3d50
4 changed files with 43 additions and 50 deletions

View File

@@ -5,7 +5,7 @@
## **IMPORTANT! BREAKING CHANGES** ## **IMPORTANT! BREAKING CHANGES**
- When upgrading to v3.5 for the first time from v3.4 on a BBQKees Gateway board you will need to use the [EMS-EPS Flasher](https://github.com/emsesp/EMS-ESP-Flasher/releases) to correctly re-partition the flash. Make sure you backup the settings and customizations from the WebUI (System->Upload/Download) and restore after the upgrade. - When upgrading to v3.5 for the first time from v3.4 on a BBQKees Gateway board you will need to use the [EMS-EPS Flasher](https://github.com/emsesp/EMS-ESP-Flasher/releases) to correctly re-partition the flash. Make sure you backup the settings and customizations from the WebUI (System->Upload/Download) and restore after the upgrade.
- Since 3.5.0b11 we have added support for multiple EMS-ESPs [#759] as an optional setting in MQTT. When this is enabled, which is now the default, all MQTT Discovery Entity IDs will include the base name and the shortname of the EMS-ESP device entity. For example what was previously `sensor.boiler_actual_boiler_temperature` will become `sensor.ems-esp_boiler_boiltemp`. If you still want to use the old format and retain the history and script compatibility in Home Assistant then set this back to the old format. - Support for multiple EMS-ESPs [#759] has been added as an optional setting for MQTT. When enabled, which is now the default, all MQTT Discovery Entity IDs will include the MQTT base name and the shortname of the EMS-ESP device entity. For example what was previously `sensor.boiler_actual_boiler_temperature` will now become `sensor.ems_esp_boiler_boiltemp`. If you still want to use the old format and retain the history and script compatibility in Home Assistant then set this back to the old format.
## Added ## Added

View File

@@ -15,7 +15,7 @@
"@mui/material": "^5.11.0", "@mui/material": "^5.11.0",
"@table-library/react-table-library": "4.0.23", "@table-library/react-table-library": "4.0.23",
"@types/lodash": "^4.14.191", "@types/lodash": "^4.14.191",
"@types/node": "^18.11.15", "@types/node": "^18.11.16",
"@types/react": "^18.0.26", "@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9", "@types/react-dom": "^18.0.9",
"@types/react-router-dom": "^5.3.3", "@types/react-router-dom": "^5.3.3",
@@ -31,7 +31,7 @@
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-dropzone": "^14.2.3", "react-dropzone": "^14.2.3",
"react-icons": "^4.7.1", "react-icons": "^4.7.1",
"react-router-dom": "^6.4.5", "react-router-dom": "^6.5.0",
"react-scripts": "5.0.1", "react-scripts": "5.0.1",
"sockette": "^2.0.6", "sockette": "^2.0.6",
"typesafe-i18n": "^5.17.1", "typesafe-i18n": "^5.17.1",
@@ -3458,9 +3458,9 @@
} }
}, },
"node_modules/@remix-run/router": { "node_modules/@remix-run/router": {
"version": "1.0.5", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.0.5.tgz", "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.1.0.tgz",
"integrity": "sha512-my0Mycd+jruq/1lQuO5LBB6WTlL/e8DTCYWp44DfMTDcXz8DcTlgF0ISaLsGewt+ctHN+yA8xMq3q/N7uWJPug==", "integrity": "sha512-rGl+jH/7x1KBCQScz9p54p0dtPLNeKGb3e0wD2H5/oZj41bwQUnXdzbj2TbUAFhvD7cp9EyEQA4dEgpUFa1O7Q==",
"engines": { "engines": {
"node": ">=14" "node": ">=14"
} }
@@ -4017,9 +4017,9 @@
"integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==" "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA=="
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "18.11.15", "version": "18.11.16",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.15.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.16.tgz",
"integrity": "sha512-VkhBbVo2+2oozlkdHXLrb3zjsRkpdnaU2bXmX8Wgle3PUi569eLRaHGlgETQHR7lLL1w7GiG3h9SnePhxNDecw==" "integrity": "sha512-6T7P5bDkRhqRxrQtwj7vru+bWTpelgtcETAZEUSdq0YISKz8WKdoBukQLYQQ6DFHvU9JRsbFq0JH5C51X2ZdnA=="
}, },
"node_modules/@types/parse-json": { "node_modules/@types/parse-json": {
"version": "4.0.0", "version": "4.0.0",
@@ -14561,11 +14561,11 @@
} }
}, },
"node_modules/react-router": { "node_modules/react-router": {
"version": "6.4.5", "version": "6.5.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.4.5.tgz", "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.5.0.tgz",
"integrity": "sha512-1RQJ8bM70YEumHIlNUYc6mFfUDoWa5EgPDenK/fq0bxD8DYpQUi/S6Zoft+9DBrh2xmtg92N5HMAJgGWDhKJ5Q==", "integrity": "sha512-fqqUSU0NC0tSX0sZbyuxzuAzvGqbjiZItBQnyicWlOUmzhAU8YuLgRbaCL2hf3sJdtRy4LP/WBrWtARkMvdGPQ==",
"dependencies": { "dependencies": {
"@remix-run/router": "1.0.5" "@remix-run/router": "1.1.0"
}, },
"engines": { "engines": {
"node": ">=14" "node": ">=14"
@@ -14575,12 +14575,12 @@
} }
}, },
"node_modules/react-router-dom": { "node_modules/react-router-dom": {
"version": "6.4.5", "version": "6.5.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.4.5.tgz", "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.5.0.tgz",
"integrity": "sha512-a7HsgikBR0wNfroBHcZUCd9+mLRqZS8R5U1Z1mzLWxFXEkUT3vR1XXmSIVoVpxVX8Bar0nQYYYc9Yipq8dWwAA==", "integrity": "sha512-/XzRc5fq80gW1ctiIGilyKFZC/j4kfe75uivMsTChFbkvrK4ZrF3P3cGIc1f/SSkQ4JiJozPrf+AwUHHWVehVg==",
"dependencies": { "dependencies": {
"@remix-run/router": "1.0.5", "@remix-run/router": "1.1.0",
"react-router": "6.4.5" "react-router": "6.5.0"
}, },
"engines": { "engines": {
"node": ">=14" "node": ">=14"
@@ -19818,9 +19818,9 @@
"integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==" "integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw=="
}, },
"@remix-run/router": { "@remix-run/router": {
"version": "1.0.5", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.0.5.tgz", "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.1.0.tgz",
"integrity": "sha512-my0Mycd+jruq/1lQuO5LBB6WTlL/e8DTCYWp44DfMTDcXz8DcTlgF0ISaLsGewt+ctHN+yA8xMq3q/N7uWJPug==" "integrity": "sha512-rGl+jH/7x1KBCQScz9p54p0dtPLNeKGb3e0wD2H5/oZj41bwQUnXdzbj2TbUAFhvD7cp9EyEQA4dEgpUFa1O7Q=="
}, },
"@rollup/plugin-babel": { "@rollup/plugin-babel": {
"version": "5.3.1", "version": "5.3.1",
@@ -20232,9 +20232,9 @@
"integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==" "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA=="
}, },
"@types/node": { "@types/node": {
"version": "18.11.15", "version": "18.11.16",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.15.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.16.tgz",
"integrity": "sha512-VkhBbVo2+2oozlkdHXLrb3zjsRkpdnaU2bXmX8Wgle3PUi569eLRaHGlgETQHR7lLL1w7GiG3h9SnePhxNDecw==" "integrity": "sha512-6T7P5bDkRhqRxrQtwj7vru+bWTpelgtcETAZEUSdq0YISKz8WKdoBukQLYQQ6DFHvU9JRsbFq0JH5C51X2ZdnA=="
}, },
"@types/parse-json": { "@types/parse-json": {
"version": "4.0.0", "version": "4.0.0",
@@ -27723,20 +27723,20 @@
"integrity": "sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==" "integrity": "sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A=="
}, },
"react-router": { "react-router": {
"version": "6.4.5", "version": "6.5.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.4.5.tgz", "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.5.0.tgz",
"integrity": "sha512-1RQJ8bM70YEumHIlNUYc6mFfUDoWa5EgPDenK/fq0bxD8DYpQUi/S6Zoft+9DBrh2xmtg92N5HMAJgGWDhKJ5Q==", "integrity": "sha512-fqqUSU0NC0tSX0sZbyuxzuAzvGqbjiZItBQnyicWlOUmzhAU8YuLgRbaCL2hf3sJdtRy4LP/WBrWtARkMvdGPQ==",
"requires": { "requires": {
"@remix-run/router": "1.0.5" "@remix-run/router": "1.1.0"
} }
}, },
"react-router-dom": { "react-router-dom": {
"version": "6.4.5", "version": "6.5.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.4.5.tgz", "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.5.0.tgz",
"integrity": "sha512-a7HsgikBR0wNfroBHcZUCd9+mLRqZS8R5U1Z1mzLWxFXEkUT3vR1XXmSIVoVpxVX8Bar0nQYYYc9Yipq8dWwAA==", "integrity": "sha512-/XzRc5fq80gW1ctiIGilyKFZC/j4kfe75uivMsTChFbkvrK4ZrF3P3cGIc1f/SSkQ4JiJozPrf+AwUHHWVehVg==",
"requires": { "requires": {
"@remix-run/router": "1.0.5", "@remix-run/router": "1.1.0",
"react-router": "6.4.5" "react-router": "6.5.0"
} }
}, },
"react-scripts": { "react-scripts": {

View File

@@ -11,7 +11,7 @@
"@mui/material": "^5.11.0", "@mui/material": "^5.11.0",
"@table-library/react-table-library": "4.0.23", "@table-library/react-table-library": "4.0.23",
"@types/lodash": "^4.14.191", "@types/lodash": "^4.14.191",
"@types/node": "^18.11.15", "@types/node": "^18.11.16",
"@types/react": "^18.0.26", "@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9", "@types/react-dom": "^18.0.9",
"@types/react-router-dom": "^5.3.3", "@types/react-router-dom": "^5.3.3",
@@ -27,7 +27,7 @@
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-dropzone": "^14.2.3", "react-dropzone": "^14.2.3",
"react-icons": "^4.7.1", "react-icons": "^4.7.1",
"react-router-dom": "^6.4.5", "react-router-dom": "^6.5.0",
"react-scripts": "5.0.1", "react-scripts": "5.0.1",
"sockette": "^2.0.6", "sockette": "^2.0.6",
"typesafe-i18n": "^5.17.1", "typesafe-i18n": "^5.17.1",

View File

@@ -989,28 +989,21 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
snprintf(entity_with_tag, sizeof(entity_with_tag), "%s", entity); snprintf(entity_with_tag, sizeof(entity_with_tag), "%s", entity);
} }
// build unique identifier which will be used in the topic, also used as object_id // build unique identifier also used as object_id and becomes the Entity ID in HA
// and becomes the Entity ID in HA
char uniq_id[70]; char uniq_id[70];
if (Mqtt::multiple_instances()) { if (Mqtt::multiple_instances()) {
// prefix base name to each uniq_id and use the shortname // 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); snprintf(uniq_id, sizeof(uniq_id), "%s_%s_%s", mqtt_basename_.c_str(), device_name, entity_with_tag);
} else { } else {
// old v3.4 style // old v3.4 style
// if there is no en_name take the shortname // take en_name and replace all spaces and lowercase it
if (en_name == nullptr || strlen(en_name) == 0) { char uniq_s[40];
strlcpy(uniq_id, entity, sizeof(uniq_id)); strlcpy(uniq_s, en_name, sizeof(uniq_s));
Helpers::replace_char(uniq_s, ' ', '_');
if (EMSdevice::tag_to_string(tag).empty()) {
snprintf(uniq_id, sizeof(uniq_id), "%s_%s", device_name, Helpers::toLower(uniq_s).c_str());
} else { } else {
// old v3.4 style snprintf(uniq_id, sizeof(uniq_id), "%s_%s_%s", device_name, EMSdevice::tag_to_string(tag).c_str(), Helpers::toLower(uniq_s).c_str());
// take en_name and replace all spaces and lowercase it
char uniq_s[40];
strlcpy(uniq_s, en_name, sizeof(uniq_s));
Helpers::replace_char(uniq_s, ' ', '_');
if (EMSdevice::tag_to_string(tag).empty()) {
snprintf(uniq_id, sizeof(uniq_id), "%s_%s", device_name, Helpers::toLower(uniq_s).c_str());
} else {
snprintf(uniq_id, sizeof(uniq_id), "%s_%s_%s", device_name, EMSdevice::tag_to_string(tag).c_str(), Helpers::toLower(uniq_s).c_str());
}
} }
} }