Tool that auto-creates items file for a thing's channels

uhm… this goes beyond my expertise :wink: I know how to use it as an enduser (clone, create issues etc.) but I need to check how I can create my own repository. would you be willing to help? we can do it in German :wink:

Click on their icon & then the Message button to private message.
This is an English only forum.

@Bruce_Osborne relax :wink:

@Felix_Schneider give it a try: https://github.com/Stefan300381/openHAB_ItemCreator

3 Likes

looks good =)

2 Likes

btw: yesterday I fixed a bug

It looks like you are basing the Item names off the channel names. How would that work with a second Shelly? You cannot have 2 Items with the same name.

1 Like

I’ve modified the sample a bit so you can add a “leading” string to the item names. see screenshot. Taking a look at the example I think something like PLUG1_NETWORK_SSID is much better than something like: MIIO_GENERIC_0723B6D1_SSID. Do you have any other suggestion?

Btw: In regards to items names the documentation says

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.

I tested it with bla, _bla, and 1bla and all of them worked like a charm.
You need to ignore the INFO lines as I was just testing something.

perhaps that is a recent change. I remember people (within the past year) having issues when starting with a number,

1 Like

There are many parts to openHAB. “Works like a charm” does not mean it works in say, every UI or rule system. Break the rules at your peril.

The Item naming requirements have been there since OH1.

1 Like

got it, but why does OH even load such an item and doesn’t throw an error?

I know I am a little late to the party but there is a HABApp feature which allows just that.
You even can use various fields from the thing as an input for the item name, label, etc…

Additionally you can even set the configuration parameter for all things, so it’s easy to share e.g. z-wave configurations.

It’s really neat - I recently bought 3 more PIR sensors and all I had to do was give them a proper thing name.
The rest happened automatically.

1 Like

Definitely, I had an idea very similar to this, And at the very least it give people something to spring board from, even if they don’t use it exactly as you designed.

Tried it out. It’s sexy as hell.

I was planning on writing something VERY close to this in python this weekend, to let me overhaul my item config. This is sooooo close.

js is not a language I work with (yet), I am going to play around with this this weekend tho. I personally will need to also add a leading string to the Label for my use. Dunno if that is something others would want/need. If I do make that change I’ll make it optional and submit a pull request.

Great work.

1 Like

implementing the leading string for the label will be easy. give me some time :wink:

interessting. didn’t even know anything about HABapp. what are the key features you use it for?

I am assuming you mean HABApp, not the feature to create and link items automatically.

Currently I am doing all my automation for two openhab instances through HABApp.
I really like coding in python3 and for me doing it in HABApp is way quicker and less error prone than the normal jsr223 rule engine.
Also as mentioned I also use it to share z-wave configuration parameters across similar things so they all behave the same.
Additionally I use it to link mqtt to my openhab instances.

@Spaceman_Spiff check out the new version

Hi all, I’ve updated the code to support openHAB 3 authorization via API Token

2 Likes

Very Nice, I’ll be updating this tonight when I get home.

Very nice, Was wondering about this when I moved to V3. I had added it to a list of things to play with. Great work.

1 Like