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

[rules] `SwitchableJSRule`: Add option to specify name of Switch Item #325

Closed florian-h05 closed 3 months ago

florian-h05 commented 3 months ago

This adds an option to the rule config for SwitchableJSRule to specify the name of the Switch Item, which enables and disables the rule. If no switchItemName is provided, the Item name will be generated as before. If the switchItemName is specified but no Item with the specified name exists, an Item with that name is created, else the existing Item with this name is used.

BREAKING CHANGE: It also changes Item.type to not include the Item suffix, i.e. SwitchItem now is just Switch.