Hello fellow developers,
I have put some thoughts into the distribution of rules, rule templates and came across one question.
You can define composite module types. A powerful concept actually, for example it allows simple branching in a rule. Self defined composite module types are quite interesting for distribution next to rule templates, or, as I suggest with this post: Inside of rule templates.
What is a module type? Any trigger, condition, action that you can select for a rule (“Trigger on fixed time of day”, “Execute other rule”) is a module type, that is either provided by openHab core or by an addon.
A composite module type is a declarative (no programming involved!) composition of multiple (programmed) module types and defines its own configuration and inputs and outputs.
You can have a composite module type “MQTT Shelly Button” that requires a broker thing to the set as configuration and internally wraps the core.ChannelEventTrigger and core.GenericCompareCondition to output ON/OFF on a “button1” and “button2” output. No programming involved at all.
My proposal is this: Let’s add a “moduletypes” key to the rule templates structure. Those found module-types are installed when the rule template is installed and can be used in any rule from there on.
Implications: A user must be able to remove composite module-types from his system again. (The REST API needs some extensions)