Support capital letters in item description when processing command openhab.command.things.addItems

Dear Community,

VS Code with OpenHAB extension supports REST API and on this basis it is possible to execute the command openhab.command.things.addItems for automatically generating an item from a corresponding channel in a things file. This works in principle. However, I realized that the item description is changed to lowercase even if there are upper case characters in the corresponding channel description:

Type number : APPEG_Bad_Temperatur "APPEG Bad Temperatur" [ ga="9.001:<13/6/180" ]

The automatically created item is:

Number APPEG_Bad_Temperatur "Appeg bad temperatur" {channel="knx:device:APPEG_IP:APPEG_RTF02:APPEG_Bad_Temperatur"}

However, I would have expected to receive:

Number APPEG_Bad_Temperatur "APPEG Bad Temperatur" {channel="knx:device:APPEG_IP:APPEG_RTF02:APPEG_Bad_Temperatur"}

Is this a configuration issue oder a bug?

Best regards,
Peter

There is no specific reason for this.
We have a toLowerCase() function, which processes the channel Name during the item generation.

I could simply remove that or we could introduce a setting for this to choose between “original” name or “humanized” name.

Dear Jerome,

Thank you very much for providing this useful tool for generating items out of channel definitions from things. This saves a lot of time and hazzle which I already had before because of item / channel mismatches…

I understand that providing clean item labels is a good idea. May I suggest a solution to handle the creation of item labels which I would assume as intuitive:

If a channel has no label, then create the item label from the channel name, but replace the camel or snake style of the channel name by corresponding text portions with spaces, e.g.:

channel name: GroundFloorBathLight => item label: “Ground floor bath light”
channel name: Ground_floor_Bath_light => item label: "Ground floor Bath light

Depending on the language, one might prefer to keep the capital letters at the beginning of each word when using camel style channel names:
channel name: GroundFloorBathLight => item label: “Ground Floor Bath Light”

Lower/upper case manipulations should only be relevant for camel style names, as the user can properly select lower/upper case characters in snake style.

On the other side, if the channel name has a channel label, just copy the channel label as it is and make it the item label, as the provided channel label is already a string text which can be assumed to be properly formatted.

If you believe this approach to be resonable I would be happy if you could consider it!

Best regards,
Peter

I have added [RFC]Refactor item from channel creation · Issue #251 · openhab/openhab-vscode · GitHub to track this.
Not sure what is possible here currently.

Those extension parts were not introduced by me and i will need to have look first for bigger changes.
(Usually i also use changes like this to refactor the existing codebase.)