From 4dee94563236b310db9191fcfc5f0516cf94e369 Mon Sep 17 00:00:00 2001 From: proddy Date: Wed, 2 Oct 2024 10:04:38 +0200 Subject: [PATCH] fix HA warning, dont translate bool --- src/mqtt.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 0fe1e6319..d0b42dcc9 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -1115,11 +1115,12 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev // special case to handle booleans // applies to both Binary Sensor (read only) and a Switch (for a command) - // has no unit of measure or icon + // has no unit of measure or icon, and must be true/false (not on/off or 1/0) if (type == DeviceValueType::BOOL) { add_ha_bool(doc); - Helpers::render_boolean(sample_val, false); + strlcpy(sample_val, "false", sizeof(sample_val)); // default is "false" } + doc["val_tpl"] = (std::string) "{{" + val_obj + " if " + val_cond + " else " + sample_val + "}}"; // add the dev json object to the end, not for commands