Skip to content

Commit 94b75dd

Browse files
committed
Merge branch 'dev' of https://github.com/emsesp/EMS-ESP32 into dev
2 parents a529879 + 88c98ef commit 94b75dd

20 files changed

+92
-76
lines changed

CHANGELOG_LATEST.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## **IMPORTANT! BREAKING CHANGES**
66

77
- 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.
8-
- Since 3.5.0b11 we have added support for multiple EMS-ESPs [#759] and also renamed the HA Entity IDs. For example what was previously `sensor.boiler_actual_boiler_temperature` is now using the shortname form `sensor.boiler_boiltemp` as opposed to the English description. Unfortunately this does means any HA dashboards, automation scripts and integrations (e.g. Grafana) need to be adjusted accordingly.
8+
- 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.
99

1010
## Added
1111

interface/package-lock.json

+32-32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

interface/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@mui/material": "^5.11.0",
1212
"@table-library/react-table-library": "4.0.23",
1313
"@types/lodash": "^4.14.191",
14-
"@types/node": "^18.11.15",
14+
"@types/node": "^18.11.16",
1515
"@types/react": "^18.0.26",
1616
"@types/react-dom": "^18.0.9",
1717
"@types/react-router-dom": "^5.3.3",
@@ -27,7 +27,7 @@
2727
"react-dom": "^18.2.0",
2828
"react-dropzone": "^14.2.3",
2929
"react-icons": "^4.7.1",
30-
"react-router-dom": "^6.4.5",
30+
"react-router-dom": "^6.5.0",
3131
"react-scripts": "5.0.1",
3232
"sockette": "^2.0.6",
3333
"typesafe-i18n": "^5.17.1",

interface/src/framework/mqtt/MqttSettingsForm.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ const MqttSettingsForm: FC = () => {
245245
margin="normal"
246246
select
247247
>
248-
<MenuItem value="false">{LL.MQTT_ENTITY_FORMAT_0()}</MenuItem>
249-
<MenuItem value="true">{LL.MQTT_ENTITY_FORMAT_1()}</MenuItem>
248+
<MenuItem value={false as any}>{LL.MQTT_ENTITY_FORMAT_0()}</MenuItem>
249+
<MenuItem value={true as any}>{LL.MQTT_ENTITY_FORMAT_1()}</MenuItem>
250250
</ValidatedTextField>
251251
</Grid>
252252
</Grid>

interface/src/i18n/de/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const de: Translation = {
115115
TEMPERATURE: 'Temperatur',
116116
PHY_TYPE: 'Eth PHY Typ',
117117
DISABLED: 'deaktiviert',
118-
TX_MODE: 'Tx Mode',
118+
TX_MODE: 'Tx Modus',
119119
HARDWARE: 'Hardware',
120120
EMS_BUS: '{{BUS|EMS BUS}}',
121121
GENERAL_OPTIONS: 'Allgemeine Optionen',
@@ -249,9 +249,9 @@ const de: Translation = {
249249
MQTT_INT_HEARTBEAT: 'Heartbeat',
250250
MQTT_QUEUE: 'MQTT Queue',
251251
DEFAULT: 'Standard',
252-
MQTT_ENTITY_FORMAT: 'Entity ID format',
253-
MQTT_ENTITY_FORMAT_0: 'Single instance, long name',
254-
MQTT_ENTITY_FORMAT_1: 'Multiple instances, short name',
252+
MQTT_ENTITY_FORMAT: 'Entitäts-ID Format',
253+
MQTT_ENTITY_FORMAT_0: 'Einzelinstanz, Langname (veraltet)',
254+
MQTT_ENTITY_FORMAT_1: 'Mehrfachinstanzen, MQTT-Namen',
255255
MQTT_CLEAN_SESSION: 'Setze `Clean Session`',
256256
MQTT_RETAIN_FLAG: 'Setze `Retain flag` immer',
257257
INACTIVE: 'Inaktiv',

interface/src/i18n/en/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ const en: Translation = {
249249
MQTT_QUEUE: 'MQTT Queue',
250250
DEFAULT: 'Default',
251251
MQTT_ENTITY_FORMAT: 'Entity ID format',
252-
MQTT_ENTITY_FORMAT_0: 'Single instance, long name',
252+
MQTT_ENTITY_FORMAT_0: 'Single instance, long name (depreciated)',
253253
MQTT_ENTITY_FORMAT_1: 'Multiple instances, short name',
254254
MQTT_CLEAN_SESSION: 'Set Clean Session',
255255
MQTT_RETAIN_FLAG: 'Always set Retain flag',

interface/src/i18n/fr/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ const fr: Translation = {
249249
MQTT_QUEUE: 'Queue MQTT',
250250
DEFAULT: 'Défaut',
251251
MQTT_ENTITY_FORMAT: 'Entity ID format',
252-
MQTT_ENTITY_FORMAT_0: 'Single instance, long name',
252+
MQTT_ENTITY_FORMAT_0: 'Single instance, long name (depreciated)',
253253
MQTT_ENTITY_FORMAT_1: 'Multiple instances, short name',
254254
MQTT_CLEAN_SESSION: 'Flag Clean Session',
255255
MQTT_RETAIN_FLAG: 'Toujours activer le Retain Flag',

interface/src/i18n/nl/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ const nl: Translation = {
249249
MQTT_QUEUE: 'MQTT Queue',
250250
DEFAULT: 'Default',
251251
MQTT_ENTITY_FORMAT: 'Entity ID format',
252-
MQTT_ENTITY_FORMAT_0: 'Single instance, long name',
252+
MQTT_ENTITY_FORMAT_0: 'Single instance, long name (depreciated)',
253253
MQTT_ENTITY_FORMAT_1: 'Multiple instances, short name',
254254
MQTT_CLEAN_SESSION: 'Clean Session aan',
255255
MQTT_RETAIN_FLAG: 'Retain flag aan',

interface/src/i18n/no/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ const no: Translation = {
249249
MQTT_QUEUE: 'MQTT Queue',
250250
DEFAULT: 'Standard',
251251
MQTT_ENTITY_FORMAT: 'Entity ID format',
252-
MQTT_ENTITY_FORMAT_0: 'Single instance, long name',
252+
MQTT_ENTITY_FORMAT_0: 'Single instance, long name (depreciated)',
253253
MQTT_ENTITY_FORMAT_1: 'Multiple instances, short name',
254254
MQTT_CLEAN_SESSION: 'Benytt Clean Session',
255255
MQTT_RETAIN_FLAG: 'Alltid sett Retain flag',

interface/src/i18n/pl/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ const pl: BaseTranslation = {
249249
MQTT_QUEUE: 'Kolejka MQTT',
250250
DEFAULT: '{{Pozostałe|Domyślna|}}',
251251
MQTT_ENTITY_FORMAT: 'Entity ID format',
252-
MQTT_ENTITY_FORMAT_0: 'Single instance, long name',
252+
MQTT_ENTITY_FORMAT_0: 'Single instance, long name (depreciated)',
253253
MQTT_ENTITY_FORMAT_1: 'Multiple instances, short name',
254254
MQTT_CLEAN_SESSION: 'Ustawiaj flagę "Clean session"',
255255
MQTT_RETAIN_FLAG: 'Ustawiaj flagę "Retain"',

interface/src/i18n/se/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ const se: Translation = {
249249
MQTT_QUEUE: 'MQTT Queue',
250250
DEFAULT: 'Standard',
251251
MQTT_ENTITY_FORMAT: 'Entity ID format',
252-
MQTT_ENTITY_FORMAT_0: 'Single instance, long name',
252+
MQTT_ENTITY_FORMAT_0: 'Single instance, long name (depreciated)',
253253
MQTT_ENTITY_FORMAT_1: 'Multiple instances, short name',
254254
MQTT_CLEAN_SESSION: 'Använd "Clean Session"-flaggan',
255255
MQTT_RETAIN_FLAG: 'Använd "Always Retain"-flaggan',

lib/framework/MqttSettingsService.cpp

+7-9
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ StateUpdateResult MqttSettings::update(JsonObject & root, MqttSettings & setting
223223
changed = true;
224224
}
225225

226+
if (newSettings.multiple_instances != settings.multiple_instances) {
227+
changed = true;
228+
}
229+
226230
// if both settings are stored from older version, HA has priority
227231
if (newSettings.ha_enabled && newSettings.publish_single) {
228232
newSettings.publish_single = false;
@@ -258,44 +262,38 @@ StateUpdateResult MqttSettings::update(JsonObject & root, MqttSettings & setting
258262

259263
if (newSettings.publish_time_boiler != settings.publish_time_boiler) {
260264
emsesp::EMSESP::mqtt_.set_publish_time_boiler(newSettings.publish_time_boiler);
261-
changed = true;
262265
}
263266

264267
if (newSettings.publish_time_thermostat != settings.publish_time_thermostat) {
265268
emsesp::EMSESP::mqtt_.set_publish_time_thermostat(newSettings.publish_time_thermostat);
266-
changed = true;
267269
}
268270

269271
if (newSettings.publish_time_solar != settings.publish_time_solar) {
270272
emsesp::EMSESP::mqtt_.set_publish_time_solar(newSettings.publish_time_solar);
271-
changed = true;
272273
}
273274

274275
if (newSettings.publish_time_mixer != settings.publish_time_mixer) {
275276
emsesp::EMSESP::mqtt_.set_publish_time_mixer(newSettings.publish_time_mixer);
276-
changed = true;
277277
}
278278

279279
if (newSettings.publish_time_other != settings.publish_time_other) {
280280
emsesp::EMSESP::mqtt_.set_publish_time_other(newSettings.publish_time_other);
281-
changed = true;
282281
}
283282

284283
if (newSettings.publish_time_sensor != settings.publish_time_sensor) {
285284
emsesp::EMSESP::mqtt_.set_publish_time_sensor(newSettings.publish_time_sensor);
286-
changed = true;
287285
}
288286

289287
if (newSettings.publish_time_heartbeat != settings.publish_time_heartbeat) {
290288
emsesp::EMSESP::mqtt_.set_publish_time_heartbeat(newSettings.publish_time_heartbeat);
291-
changed = true;
292289
}
293290

291+
// save the new settings
292+
settings = newSettings;
293+
294294
if (changed) {
295295
emsesp::EMSESP::mqtt_.reset_mqtt();
296296
}
297297

298-
settings = newSettings;
299-
300298
return StateUpdateResult::CHANGED;
301299
}

src/analogsensor.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -451,14 +451,15 @@ void AnalogSensor::publish_values(const bool force) {
451451
}
452452
config["val_tpl"] = str;
453453

454+
char uniq_s[70];
454455
if (Mqtt::multiple_instances()) {
455-
snprintf(str, sizeof(str), "%s_analogsensor_%d", Mqtt::basename().c_str(), sensor.gpio());
456+
snprintf(uniq_s, sizeof(uniq_s), "%s_analogsensor_%d", Mqtt::basename().c_str(), sensor.gpio());
456457
} else {
457-
snprintf(str, sizeof(str), "analogsensor_%d", sensor.gpio());
458+
snprintf(uniq_s, sizeof(uniq_s), "analogsensor_%d", sensor.gpio());
458459
}
459460

460-
config["object_id"] = str;
461-
config["uniq_id"] = str; // same as object_id
461+
config["object_id"] = uniq_s;
462+
config["uniq_id"] = uniq_s; // same as object_id
462463

463464
snprintf(str, sizeof(str), "%s", sensor.name().c_str());
464465
config["name"] = str;

src/dallassensor.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -518,14 +518,15 @@ void DallasSensor::publish_values(const bool force) {
518518
}
519519
config["val_tpl"] = str;
520520

521+
char uniq_s[70];
521522
if (Mqtt::multiple_instances()) {
522-
snprintf(str, sizeof(str), "%s_dallassensor_%s", Mqtt::basename().c_str(), sensor.id().c_str());
523+
snprintf(uniq_s, sizeof(uniq_s), "%s_dallassensor_%s", Mqtt::basename().c_str(), sensor.id().c_str());
523524
} else {
524-
snprintf(str, sizeof(str), "dallassensor_%s", sensor.id().c_str());
525+
snprintf(uniq_s, sizeof(uniq_s), "dallassensor_%s", sensor.id().c_str());
525526
}
526527

527-
config["object_id"] = str;
528-
config["uniq_id"] = str; // same as object_id
528+
config["object_id"] = uniq_s;
529+
config["uniq_id"] = uniq_s; // same as object_id
529530

530531
snprintf(str, sizeof(str), "%s", sensor.name().c_str());
531532
config["name"] = str;

src/helpers.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,10 @@ std::string Helpers::toUpper(std::string const & s) {
678678

679679
// replace char in char string
680680
void Helpers::replace_char(char * str, char find, char replace) {
681+
if (str == nullptr) {
682+
return;
683+
}
684+
681685
int i = 0;
682686

683687
while (str[i] != '\0') {

src/locale_common.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ MAKE_PSTR(tag_boiler_data_ww_mqtt, "ww")
225225
MAKE_PSTR(tag_device_data_ww_mqtt, "")
226226

227227
// Home Assistant - this is special and has no translations
228-
MAKE_PSTR_LIST(climate, "HA climate config creation")
228+
MAKE_PSTR_LIST(climate, "")
229229

230230
// syslog
231231
MAKE_PSTR_LIST(list_syslog_level, "off", "emerg", "alert", "crit", "error", "warn", "notice", "info", "debug", "trace", "all")

0 commit comments

Comments
 (0)