Skip to content

If the **label** is not set when creating a rule, the error message insists on setting a **name** #3379

@dilyanpalauzov

Description

@dilyanpalauzov

When I want to “Create rule” and have not set label, I get an error message:

Image
  • Either the field “Label” should be renamed to “Name”, or the error message must be “Set label to the rule”. Here label and name mean the same thing, but are different words, and this is confusing.

Besides, I think the name should not be mandatory, openHAB can work with rules without names and the user can later set the name. So it can be left up to the user, if the user wants to set or not a rule name.

I tried to see what happens, when file-based automation creates rules, if the rules have no names set. The Groovy program below creates rules, without setting names. In the UI some of the rules are shown having a number as name and some have no names.

import org.openhab.core.automation.module.script.rulesupport.shared.simple.SimpleRule
import org.openhab.core.config.core.Configuration
import org.openhab.core.automation.*
import org.openhab.core.automation.util.TriggerBuilder;
scriptExtension.importPreset("RuleSupport")

def void addR() {
  automationManager.addRule(new SimpleRule() {
    { // name = "The name could be set here, but is not"
      triggers = [
        TriggerBuilder.create().withId("trig1").withTypeUID("core.ItemStateChangeTrigger")
        .withConfiguration(new Configuration([itemName: "r"])).build()
      ]
    }
    @Override Object execute(Action module, Map<String, ?> inputs) {}
  })
}

for (int i = 0; i < 3; i++) addR() // these rules have name not set

for (int i = 0; i < 5; i++)
  automationManager.addRule(new SimpleRule() {
    {   // these rules have name "2"
      triggers = [
        TriggerBuilder.create().withId("trig1").withTypeUID("core.ItemStateChangeTrigger")
        .withConfiguration(new Configuration([itemName: "r"])).build()
      ]
    }
    @Override Object execute(Action module, Map<String, ?> inputs) {}
  })

automationManager.addRule(new SimpleRule() {
    { // this rule has name "3"
      triggers = [
        TriggerBuilder.create().withId("trig1").withTypeUID("core.ItemStateChangeTrigger")
        .withConfiguration(new Configuration([itemName: "r"])).build()
      ]
    }
    @Override Object execute(Action module, Map<String, ?> inputs) {}
})

addR() //rule has no name

with openHAB 5.1.0 Build 4849.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmain uiMain UI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions