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] rules.SwitchableJSRule - tags #127

Closed JacekKac closed 3 months ago

JacekKac commented 2 years ago

Proxy rule and proxy item imho should have the same TAGS as it parent rule.

  1. consider copying the tags from parent rule
  2. consider putting "DYNAMIC" tag by default in rules and JSRules
  3. consider proxyitem creation with tag "DYNAMIC" in addition to parent tags

it will be easier to manage items/rules created from js scripts

florian-h05 commented 2 years ago

I agree with 1, but I think 2 was already discussed here and it was decided against this. To talk about 3: The proxy item already has the tag GENERATED_RULE_ITEM, which let the user differ Items created by SwitchableJSRule and replaceItem.

@digitaldan Wdyt?

jpg0 commented 2 years ago

It may also be worth reconsidering SwitchableJSRule entirely.

I included this back in openHAB 2.x (when the new UI was not available) so that rules could be switchable from a sitemap. I believe that it's now possible to enable/disable rules directly with the new UI, not requiring a corresponding item.

florian-h05 commented 2 years ago

I believe that it's now possible to enable/disable rules directly with the new UI, not requiring a corresponding item.

Yes, this is now possible from the new UI, but only for logged in administrators. I really like SwitchableJSRule because I love the option to enable oder disable a rule from a Sitemap, e.g. for a time triggered rule. Of course we could change the implementation, but I think that we should have something like SwitchableJSRule. When we are about changing the implementation, what I really miss is, that you cannot influence the created Item‘s name or label.

florian-h05 commented 3 months ago

Closing as #325 allows specifying the name of the Switch Item, which therefore makes it possible to manually create the Switch Item, define tags and channel links etc. and then use this Item for SwitchableJSRule. Please follow this approach if you want to set tags for the Switch Item.