The function things.getThing("xrobonect:mower:automower", true); should return null or a valid Thing.
Current Behavior
The created Thing ha no rawThing as it doesn't exist in the Things Registry.
Possible Solution
Enhance the Thing Constructor to filter such invalid input parameters.
class Thing {
/**
* Create a Thing, wrapping a native Java openHAB Thing. Don't use this constructor, instead call {@link getThing}.
* @param {HostThing} rawThing Java Thing from Host
* @hideconstructor
*/
constructor (rawThing) {
if (!rawThing || typeof rawThing === 'undefined') {
//if (typeof rawThing === 'undefined') {
throw Error('Supplied Thing is undefined');
}
Steps to Reproduce (for Bugs)
This code prints "Check1" but fails with "Check2" as the Thing wrapper doesn't contains a valid rawThing
let myThing;
utils.dumpObject(myThing);
myThing = things.getThing("xrobonect:mower:automower", true);
utils.dumpObject(myThing);
if (myThing) {
console.warn("Check1 - Found Thing!");
}
if (myThing?.rawThing) {
console.warn("Check2 - Raw Thing existing!");
}
console.log(`My status ${myThing.status}`);
Expected Behavior
The function
things.getThing("xrobonect:mower:automower", true);
should returnnull
or a valid Thing.Current Behavior
The created Thing ha no
rawThing
as it doesn't exist in the Things Registry.Possible Solution
Enhance the Thing Constructor to filter such invalid input parameters.
Steps to Reproduce (for Bugs)
This code prints "Check1" but fails with "Check2" as the Thing wrapper doesn't contains a valid rawThing
Context
Your Environment