Add Berry mqtt publish rule processing

This commit is contained in:
Theo Arends 2025-06-05 14:04:03 +02:00
parent 4be87d41ef
commit 26613aacb2
4 changed files with 7 additions and 2 deletions

View File

@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file.
- Berry `webserver.remove_route` to revert `webserver.on` (#23452) - Berry `webserver.remove_route` to revert `webserver.on` (#23452)
- Berry `compile` and `tasmota.compile` option to compile in local context (#23457) - Berry `compile` and `tasmota.compile` option to compile in local context (#23457)
- Support for AP33772S USB PD Sink Controller as used in CentyLab RotoPD - Support for AP33772S USB PD Sink Controller as used in CentyLab RotoPD
- Berry mqtt publish rule processing
### Breaking Changed ### Breaking Changed

View File

@ -127,6 +127,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- WebUI heap status [#23356](https://github.com/arendst/Tasmota/issues/23356) - WebUI heap status [#23356](https://github.com/arendst/Tasmota/issues/23356)
- Optional Wifi strength indicator in WebUI status line [#23352](https://github.com/arendst/Tasmota/issues/23352) - Optional Wifi strength indicator in WebUI status line [#23352](https://github.com/arendst/Tasmota/issues/23352)
- Wireguard VPN [#23347](https://github.com/arendst/Tasmota/issues/23347) - Wireguard VPN [#23347](https://github.com/arendst/Tasmota/issues/23347)
- Berry mqtt publish rule processing
- Berry support for `sortedmap` [#23441](https://github.com/arendst/Tasmota/issues/23441) - Berry support for `sortedmap` [#23441](https://github.com/arendst/Tasmota/issues/23441)
- Berry `introspect.module` option to not cache module entry [#23451](https://github.com/arendst/Tasmota/issues/23451) - Berry `introspect.module` option to not cache module entry [#23451](https://github.com/arendst/Tasmota/issues/23451)
- Berry `webserver.remove_route` to revert `webserver.on` [#23452](https://github.com/arendst/Tasmota/issues/23452) - Berry `webserver.remove_route` to revert `webserver.on` [#23452](https://github.com/arendst/Tasmota/issues/23452)

View File

@ -869,14 +869,14 @@ String RuleLoadFile(const char* fname) {
/*******************************************************************************************/ /*******************************************************************************************/
bool RulesProcessEvent(const char *json_event) bool RulesProcessEvent(const char *json_event) {
{
#ifdef USE_BERRY #ifdef USE_BERRY
// events are passed to Berry before Rules engine // events are passed to Berry before Rules engine
callBerryRule(json_event, Rules.teleperiod); callBerryRule(json_event, Rules.teleperiod);
#endif // USE_BERRY #endif // USE_BERRY
if (Rules.busy) { return false; } if (Rules.busy) { return false; }
if (!strlen(json_event)) { return true; }
Rules.busy = true; Rules.busy = true;
bool serviced = false; bool serviced = false;

View File

@ -63,6 +63,9 @@ extern "C" {
be_pop(vm, be_top(vm)); // clear stack to avoid any indirect warning message in subsequent calls to Berry be_pop(vm, be_top(vm)); // clear stack to avoid any indirect warning message in subsequent calls to Berry
MqttPublishPayload(topic, payload, is_binary ? len : 0 /*if string don't send length*/, retain); MqttPublishPayload(topic, payload, is_binary ? len : 0 /*if string don't send length*/, retain);
if (!is_binary) {
XdrvRulesProcess(0, payload); // Process rules on berry publish
}
be_return_nil(vm); // Return be_return_nil(vm); // Return
} }