From 0ace60baad52a99e925dfdf07e91566e79818593 Mon Sep 17 00:00:00 2001 From: Edward Brown Date: Tue, 5 Sep 2023 14:49:00 +0100 Subject: [PATCH] Fix Tasmota crash: auto-defer callbacks --- berry/haco.be | 7 +++---- berry/haco_autoexec.be | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/berry/haco.be b/berry/haco.be index 40caab3..6310045 100644 --- a/berry/haco.be +++ b/berry/haco.be @@ -263,7 +263,7 @@ class Daemon if self.config_id==nil var rule_control=tools.callbacks.MqttSubscription( self.TOPIC_CONTROL, - /value,data->self.handle_control_message(value,data) + /value,data->tasmota.set_timer(0,/->self.handle_control_message(value,data)) ) self.registry_daemon.add(rule_control) end @@ -312,11 +312,10 @@ class Daemon function=tools.compile.evaluate(data['function']) else logger.error(string.format('Using default function for %s',trigger)) - function=/value data->{'value':value,'data':data} + function=/value,data->{'value':value,'data':data} end - - return callback_type(trigger,/value data->self.publish_output(function,value,data,topic)) + return callback_type(trigger,/value,data->tasmota.set_timer(0,/->self.publish_output(function,value,data,topic))) end diff --git a/berry/haco_autoexec.be b/berry/haco_autoexec.be index bdcb1fe..4d0f0ad 100644 --- a/berry/haco_autoexec.be +++ b/berry/haco_autoexec.be @@ -5,6 +5,8 @@ def autoexec(metadata) haco.daemon=haco.Daemon() + #haco.daemon.registry_daemon.remove_all() + end var mod = module("haco_autoexec")