From c82cb3670cc45142aba3bb78508cf6ad27b930e7 Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Sat, 6 Sep 2025 17:14:15 +0200 Subject: [PATCH] add map for command->id to offer support for web server --- src/ha.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ha.h b/src/ha.h index 1580459..4732bee 100644 --- a/src/ha.h +++ b/src/ha.h @@ -137,10 +137,12 @@ namespace Ha { struct Command : Config { bool retain = false; inline static unordered_map mapCommandTopics; + inline static unordered_map mapCommandIds; Command(Component* cmp, onMessage f) : f(f), cmp(cmp) { snprintf(commandTopic, sizeof(commandTopic), BASE_TOPIC"/set", cmp->type, MAIN_DEVICE_ID, cmp->id); mapCommandTopics.insert({ string(commandTopic), this }); + mapCommandIds.insert({ string(cmp->id), this }); } virtual void onCommand(const char* msg) {