openhab / openhab-js

openHAB JavaScript Library for JavaScript Scripting Automation
https://www.openhab.org/addons/automation/jsscripting/
Eclipse Public License 2.0
38 stars 31 forks source link

[items] Extend `metadata` & `itemchannellink` APIs #220

Closed proggprod closed 1 year ago

proggprod commented 1 year ago

See https://github.com/openhab/openhab-js/pull/212

I've been working with creating, updating , and deleting items with procedural scripts, and it would be much more powerful if sometimes I didn't have to specify item names or the precise metadata values etc. Sometimes I would like to delete all channel links from all items, or a selection of items, or a single item. Sometimes I would like to delete all invalid channel links.

florian-h05 commented 1 year ago

What can be added is:

For metadata:

For ItemChannelLinks:

Doing such operations on all Items is possible by doing:

items.getItems().forEach((item) => item.someOperation);