Why am I getting the following error when trying to run a script to get the status of a thing in Openhab 3?
[ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘f362a052bb’ failed: ReferenceError: “getThingStatusInfo” is not defined in at line number 1
The rule is an example right out the OH Documentation site:
var thingStatusInfo = getThingStatusInfo("mqtt:topic:TasmotaColdStorage")
if ((thingStatusInfo !== null) && (thingStatusInfo.getStatus().toString() == "ONLINE")) {
logInfo("ThingStatus", "The thing is online.")
} else {
logError("ThingStatus", "The thing is offline or doesn't exist.")
}
Does it mean that one cannot use getThingStatusInfo() in a script?
I do not see any mention of this in the documentation - it is listed under actions and the top of the page says “Actions are predefined methods that are called from openHAB rules and scripts.”
(I came here because I also tried to use the function in a script.)