I’ve been migrating to openHAB 3 and rewriting all rules using the Main UI (in JavaScript).
I read the load
keyword can be used to specify a file system path to a script that should be included in a rule. However I cannot find any information on how to include a script defined in the Main UI (so it is stored in JSON DB, not as a standalone file).
I was able to use the Main UI to add an additional “run script” step when running the rule. That caused the script to execute before the rule, but there doesn’t appear to be any mechanism to declare functions in the script and then access those functions in the rule.
Even using ctx.put
in the script does not appear to allow arbitrary data (eg string keys to string values) to be shared between a script and a rule defined in the Main UI.
Does anyone know how to reference a Main UI defined script using the load
keyword (or some equivalent approach)? I would prefer to not need to use the file system at all for this installation given everything else is working perfectly via Main UI and I find it easier and more convenient to manage access to HTTPS endpoints than file systems.