on ha discovery event

This commit is contained in:
Tester23
2025-11-30 20:26:22 +01:00
parent 0d8a6054c0
commit 4ced41bf4c
3 changed files with 5 additions and 0 deletions

View File

@ -232,6 +232,8 @@ int EVENT_ParseEventName(const char *s) {
return CMD_EVENT_ON_CMD;
if (!stricmp(s, "OnHTTP"))
return CMD_EVENT_ON_HTTP;
if (!stricmp(s, "OnDiscovery"))
return CMD_EVENT_ON_DISCOVERY;
if (isdigit((unsigned char)*s)) {
return atoi(s);
}

View File

@ -169,6 +169,8 @@ enum EventCode {
CMD_EVENT_ON_CMD,
CMD_EVENT_ON_DISCOVERY,
// must be lower than 256
CMD_EVENT_MAX_TYPES
};

View File

@ -1937,6 +1937,7 @@ void doHomeAssistantDiscovery(const char* topic, http_request_t* request) {
cJSON_InitHooks(&hooks);
DRV_OnHassDiscovery(topic);
EventHandlers_FireEvent(CMD_EVENT_ON_DISCOVERY, 0);
#if ENABLE_ADVANCED_CHANNELTYPES_DISCOVERY
// try to pair toggles with dimmers. This is needed only for TuyaMCU,