Hi @JustinG,
Just wanted to say thank you for all of this (tons) of work on the Bayesian Sensors setup you have. I’ve been wanting to implement it for some time, but have just gotten through enough prep and have a little time to start.
I believe there may be an error in the Activation Rule, however. I set an observation with a neq test, and OH threw an error:
[ERROR] [.handler.AbstractScriptModuleHandler] - Script execution of rule with UID 'bayesian_sensors' failed: org.graalvm.polyglot.PolyglotException: ReferenceError: "it" is not defined
Separately, it threw an error around sL in the same object definition when I changed “it” to “sItem” (just guessing there was a change from an earlier rule version. The object defined is:
var sensorTest = {
'gt': (sItem, test) => { return items[sItem].numericState > test[sItem].testState },
'lt': (sItem, test) => { return items[sItem].numericState < test[sItem].testState },
'bt': (sItem, test) => { return (test[sItem].testState[0] > items[sItem].numericState) && (items[sItem].numericState > test[sItem].testState[1]) },
'neq': (sItem, test) => { return items[it].state != sL[it].testState },
'list': (sItem, test) => { return test[sItem].testState.contains(items[sItem].state) },
'eq': (sItem, test) => { return items[sItem].state == test[sItem].testState }
}
Should the neq test be:
'neq': (sItem, test) => { return items[sItem].state != test[sItem].testState },
instead, as in the inverse ‘eq’ definition? I figure it’s just a typo, but in case I’m missing something (which I well could be!).
Again, thanks for all of the work on this. I’m still getting my feet wet with it, but I believe it’s going to be a really big improvement to my system (which is becoming unwieldy in it’s current state).