Can anyone clarify on the HABApp Rule object life cycle?
So far I have created scripts defining Rule derived classes and instantiated an object of this class afterwards. Without looking into the complete source code, I assume the Rule class takes care to register the rule object somewhere and to schedule it for triggering.
Question 1: in case I reload the script during development, is this rule object properly removed so it doesn’t conflict with the next script version’s rule object?
Question 2: in case I create a rule dynamically from another rule… What is the proper way to do this? Just instantiate a rule object when handling a trigger callback? Will this rule object be registered like a “global” object (see Question 1) and do I need to take care it is cleaned up manually when the script is replaced by a new version?
I asked ChatGPT (like so many things during a day of work) and it mentioned two functions
from HABApp.core.wrapper import load_rule, unload_rule
to use. These functions however seem to have changed since the point in time ChatGPT has been trained. At least I can’t find them…
Thanks for your insights.