if i put .itemReplace in a loop to create 50 items it works ok. Then i do :
var cleanup_items = true;
if (cleanup_items) {
var item_list = items.getItemsByTag('_DYNAMIC_');
item_list.forEach((item) => {
items.removeItem(item.name)
console.log('Usuwam:' + item.name)
})
}
and it does remove some items but few of them, and gives
Error during evaluation of script 'file:/etc/openhab/automation/js/rulesCreator.js': org.openhab.core.items.ItemNotFoundException: Item 'gRoom1' could not be found in the item registry...
item gRoom1 was properly deleted. When i run the script again it works for a few items, then it give the same error for another item.
Ofcourse the items are created properly and exist in items registry, and they are included in items.getItemsByTag.
when i run the script many times it sucesfully remove all of them.
if i put .itemReplace in a loop to create 50 items it works ok. Then i do :
and it does remove some items but few of them, and gives
item gRoom1 was properly deleted. When i run the script again it works for a few items, then it give the same error for another item. Ofcourse the items are created properly and exist in items registry, and they are included in items.getItemsByTag.
when i run the script many times it sucesfully remove all of them.