mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 13:46:36 +00:00
Allow publishing MQTT message even with action tag
This commit is contained in:
parent
d0d2bc1940
commit
d77428db54
@ -52,13 +52,14 @@ static bool script_event_handler(const char* eventname, const char* action, cons
|
||||
StaticJsonDocument<64> filter;
|
||||
|
||||
filter[eventname] = true;
|
||||
filter["pub"] = true;
|
||||
DeserializationError jsonError = deserializeJson(doc, action, DeserializationOption::Filter(filter));
|
||||
|
||||
if(!jsonError) {
|
||||
JsonVariant json = doc[eventname].as<JsonVariant>();
|
||||
if(json.isNull()) {
|
||||
LOG_DEBUG(TAG_EVENT, F("Skipping event: name=%s, data=%s"), eventname, data);
|
||||
return true;
|
||||
goto end;
|
||||
} else {
|
||||
LOG_DEBUG(TAG_EVENT, F("Handling event: name=%s, data=%s"), eventname, data);
|
||||
}
|
||||
@ -82,6 +83,9 @@ static bool script_event_handler(const char* eventname, const char* action, cons
|
||||
} else {
|
||||
dispatch_json_error(TAG_EVENT, jsonError);
|
||||
}
|
||||
|
||||
end:
|
||||
if(doc["pub"].is<bool>()) return !doc["pub"].as<bool>();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user