-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
I have the folowing (simplyfied) pyscript code:
def state_trigger_factory(sensor_name):
@state_trigger(sensor_name)
def func_trig(value=None, var_name=None):
log.info(f"func_trig: {var_name} is changed: {value}")
return func_trig
f2 = state_trigger_factory("sensor.time")
which is giving the nice output;
2025-11-24 19:04:00.008 INFO (MainThread) [custom_components.pyscript.file.test_closure.func_trig] func_trig: sensor.time is changed: 19:04
2025-11-24 19:05:00.003 INFO (MainThread) [custom_components.pyscript.file.test_closure.func_trig] func_trig: sensor.time is changed: 19:05
2025-11-24 19:06:00.007 INFO (MainThread) [custom_components.pyscript.file.test_closure.func_trig] func_trig: sensor.time is changed: 19:06
2025-11-24 19:07:00.006 INFO (MainThread) [custom_components.pyscript.file.test_closure.func_trig] func_trig: sensor.time is changed: 19:07
2025-11-24 19:08:00.008 INFO (MainThread) [custom_components.pyscript.file.test_closure.func_trig] func_trig: sensor.time is changed: 19:08
2025-11-24 19:09:00.006 INFO (MainThread) [custom_components.pyscript.file.test_closure.func_trig] func_trig: sensor.time is changed: 19:09
But when pyscript is stopped and started with:
and
... the closure does not give any logs anymore .... ( no triggers)
After a HA restart it is working again:
2025-11-24 19:20:00.004 INFO (MainThread) [custom_components.pyscript.file.test_closure.func_trig] func_trig: sensor.time is changed: 19:20
2025-11-24 19:21:00.007 INFO (MainThread) [custom_components.pyscript.file.test_closure.func_trig] func_trig: sensor.time is changed: 19:21
In a bigger project I have some issues with this behavior.
Metadata
Metadata
Assignees
Labels
No labels