From e9068e702e691e7ad7219746e6530f850bbc9634 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Wed, 5 May 2021 08:03:13 +0200 Subject: [PATCH] fix mixer HA-id nested --- src/devices/mixer.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/devices/mixer.cpp b/src/devices/mixer.cpp index ba3dee030..dc8f28068 100644 --- a/src/devices/mixer.cpp +++ b/src/devices/mixer.cpp @@ -97,7 +97,14 @@ bool Mixer::publish_ha_config() { snprintf_P(name, sizeof(name), PSTR("Mixer %02X"), device_id() - 0x20 + 1); doc["name"] = name; - doc["val_tpl"] = FJSON("{{value_json.id}}"); + char tpl[30]; + if (type_ == Type::HC) { + snprintf_P(tpl, sizeof(tpl), PSTR("{{value_json.hc%d.id}}"), device_id() - 0x20 + 1); + } else { + snprintf_P(tpl, sizeof(tpl), PSTR("{{value_json.wwc%d.id}}"), device_id() - 0x28 + 1); + } + doc["val_tpl"] = tpl; + JsonObject dev = doc.createNestedObject("dev"); dev["name"] = FJSON("EMS-ESP Mixer"); dev["sw"] = EMSESP_APP_VERSION;