[SOLVED] Rule fails on Item Name starting with a number

Hi,

I have a rule that triggers on incoming command like this:

    rule "Philips TV power command"
    when 
    	Item 55OLED754_POWER received command
    then
    	command = receivedCommand.toString()
            ....
    end

Why is it that the item 55OLED754_POWER always results in:

2019-09-30 01:00:40.797 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'powerstate.rules' has errors, therefore ignoring it: [46,2]: no viable alternative at input '55'

Is this an openhab2 bug? Cause everywhere else the item actually works. When I remove the 55 from the item name then it works but I would like to keep the 55 because removing it would break the naming scheme. Is there any quoting or special notation in the rule I could do to make it work?

Not an OpenHAB bug. Just a failure to read the documentation.

The only characters permitted in an Item name are letters, numbers and the underscore character. Names must not begin with numbers. Spaces and special characters are not permitted.

3 Likes

Honestly I did read the first part about letters, numbers and underscore but not the one about Names may not begin with numbers. Must have been blind missing that… Sorry.

2 Likes

You are also missing the val/var on your command variable.

val command = receivedCommand.toString
1 Like

wow … i was just about “damn … why i can’t creaty any rules with DSL scripts, cause everything causes a 'mismatched character” error" …
Now i know why.
Hell … 90% auf my items start with a number, cause i named everything like the location in my home beginning with the floor-number :man_facepalming:

1 Like