Hi,
I am migrating all my rules from DSL format into JS233/JavaScript format (running openHAB 3.1.0.M3).
I do use VS Code to write and edit the *.js files (which are located in /etc/openhab/automation/jsr223/javascript/personal). The rules all have the “new” coding style like:
'use strict';
var OPENHAB_CONF = Java.type("java.lang.System").getProperty("openhab.conf");
var JS_PATH = OPENHAB_CONF + "/automation/lib/javascript";
load(JS_PATH + "/core/rules.js");
load(JS_PATH + "/core/triggers.js");
load(JS_PATH + "/core/metadata.js");
load(JS_PATH + "/core/log.js");
load(JS_PATH + "/personal/myfunctions.js");
var LOG = getLogger(LOG_PREFIX + ".test");
var Message;
function test(event) {
LOG.info("Log something")
events.sendCommand("Test_Switch", OFF)
}
when("Item Test_Switch changed")(test);
rule(
" Test",
"No desc"
)(test);
Everything actually works well except of the reloading (or better said autoupdating) of the rules. That said, if I am modify let’s say an *.item file which contains items which are used in JavaScript rules the JS rule is not getting updated with the information from the ItemRegistry like it is used in DSL rules.
Also when I do changes in a bib which is imported via the "load(“path/to/bib.js”) function the changes are not visible in the main rules.
I do have either restart OH3 all the time or reloading the *.js files by modifying them (add one empty space and save them again).
How can I solve this?
Thanks!