-
-
Notifications
You must be signed in to change notification settings - Fork 266
Open
Labels
Description
When I want to “Create rule” and have not set label, I get an error message:

- 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.