What special characters (if any) are allowed in Thing Id?

When defining Things in a .things file, one must follow the syntax shown below, but can someone tell me what special characters are allowed in the <thing_id> field? – obviously white-space, and " : characters are not allowed, but are (for example) - # | / \ ¦ ~ + * ^ % $ ! ^ @ ; & etc. allowed?

Thing <binding_id>:<type_id>:<thing_id>

I have seen an error message
org.eclipse.smarthome.model.item.BindingConfigParseException: UID segment '<[robonect' contains invalid characters. Each segment of the UID must match the pattern [A-Za-z0-9_-]*.

The formal word is probably buried in smarthome docs, but I cannot find it.

it would be safe to assume the rules to Item names apply here too. basically,

  • Letters Numbers & underscores only

  • Cannot begin with number

The Item name is used to uniquely identify an Item. The name must be unique across all .items files in your openHAB configuration. 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.

It’s safe in practice but it’s not true - I’ve only just discovered you can have all numeric thing ID i.e. no leading alpha. The rules are different.

I suspect the practical reason for these limitations includes simple embedding in a url.

Ever since 3com registered their domain, domain names can begin with a number. RFC 1123 was published in late 1989.

https://tools.ietf.org/html/rfc1123#page-13

Sure. But Item names still cannot begin with a number. Most likely because it’s easier to detect them when parsing scripts. Multiple reasons driving limitations. All the brackety characters () {} <> prohibition makes it easy to parse things files etc.

I read that to imply that dashes are also allowed ( i.e. aa-12_34-zz ) – or ??

Surely the requirement is that the fully qualified name must to be unique (i.e. binding.thingclass.bridgename.thingname ) ??

The last - dash in the ‘pattern’ suggests that it would be allowed.

I think there are subtleties at work regarding the “uniqueness” of a thing id. In practice, the things of a given type within one binding seem to require unique id even if they have a different ‘parent’ bridge thing in a hierarchy.
I’m not sure how general that is.

Ok. Thanks.

I guess the real solution is to try it and see.

With care. PaperUI generally grizzles if you try to do something silly.

Xxx.things files however parse each line as it comes, meaning a “duplicate” may get treated as an edit. By that time the binding may have already set up stuff for thing1, and weirdness ensues when another different bunch of stuff is set up also for thing1.

Ok. Point taken. Thank you. In the meantime I checked and dashes seem to be Ok.