I have a dynamic code written in a file-based rule based on JavaScript Scripting (ECMAScript 2022+).
I only want to do the sendCommand on the item if it really exist?
How can it test this in the if clause?
if (items.getItem("HT_" + raum + "_Fensterzustand") !== null) {
items.getItem("HT_" + raum + "_Fensterzustand").sendCommand("OPEN");
}
This doesn’t work and gives the following error:
org.openhab.core.items.ItemNotFoundException: Item 'HT_Testdiele_Fensterzustand' could not be found in the item registry
Thank you so much!