Fix Tasmota crash: auto-defer callbacks

This commit is contained in:
Edward Brown 2023-09-05 14:49:00 +01:00
parent 5ea9c99b15
commit 0ace60baad
2 changed files with 5 additions and 4 deletions

View file

@ -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

View file

@ -5,6 +5,8 @@ def autoexec(metadata)
haco.daemon=haco.Daemon()
#haco.daemon.registry_daemon.remove_all()
end
var mod = module("haco_autoexec")