Extra parameter at the binding in the items configuration

Hello!
I want to develop a binding to get variables from a PLC. After two days hard work I got a running development IDE. So I created a new binding with the script and edit the xml files to parameterize the the thing via PaperUI. Now I want to add my items to a *.items file, but here I have some troubles.
The test item is working.

Switch Light_FF_Bath_Test        "Test"       (FF_Bath, Lights) { channel = beckhoff:TcAdsWebService:e866efc5:test"}

For my application/binding I need some extra parameters in the items declaration.
I need the variable name from the PLC (e.g. MAIN.fbLightKitchen.HMI.switch) and the datatype (e.g. BOOL)
So I tried this:

Switch Light_FF_Bath_Test        "Test"       (FF_Bath, Lights) { channel = beckhoff:TcAdsWebService:e866efc5:MAIN.fbLightKitchen.HMI.switch "}

…, the variable name as channel-id but the core can obviously nothing to do with the points between the words.
I can’t find a solution approach and need your help?

Greetings, Matthias

You need to look at the configuration APIs. Take a look at the ESH documentation on the base thing handler. This contains a lot of information about getting configuration, and receiving notifications about configuration updates etc…

It sounds like you are trying to put all confuration needed for your thing into a single channel. That doesn’t work (It might work by creation of a custom DataType, but …).
I’d create a separate channel for each value you want the read/write to/from the thing.
Or are you referring more to real config parameters, they would be handled as configuration values (set only once) and not as channel, however they would be set separately as well.

I want to create a separate channel-id for each variable like this example:

Switch Light_FF_Bath_Test        "Test"       (FF_Bath, Lights) { channel = "beckhoff:TcAdsWebService:e866efc5:MAIN.fbLightKitchen.HMI.switch "}
Switch Light_FF_Bath_Test1        "Test1"       (FF_Bath, Lights) { channel = "beckhoff:TcAdsWebService:e866efc5:MAIN.fbLightBathroom.HMI.switch "}
Switch Light_FF_Bath_Test2        "Test2"       (FF_Bath, Lights) { channel = "beckhoff:TcAdsWebService:e866efc5:MAIN.fbLight2.HMI.switch "}
Switch Light_FF_Bath_Test3        "Test3"       (FF_Bath, Lights) { channel = "beckhoff:TcAdsWebService:e866efc5:MAIN.fbLight3.HMI.switch "}

But a channel-id like this “MAIN.fbLight3.HMI.switch” dosn’t work. I need exact these string with the points in my handle command and I’m looking also for a way to put a second information to my handler.

I guess you do need that syntax in order to interface with your plc, however the needed syntax for the OH binding is different. But it is up to you to write code that converts from the OH syntax to your PLC.
It depends on the actual usage if such code would be in a handleCommand routine or in a scheduled job.

I understand, there are no options in OH2 to submit some user properties via a thing to the binding. I see i should develop a OH1 legacy binding - it makes easier. :wink:

Thanks for your answers!

You can add what you need (as a channel, like your initial “test”), however you need to add a channel for each and every different property.
The example to posted has four switch channels, that would just be a channel for the different instances of a thing ( fbLightKitchen, fbLightBathroom, fbLight2 and fbLight3).
I guess you need to look a bit deeper into the Thing and Item documents!

If you are really talking about “properties” or configuration as you said initially…

… then I would suggest that you should use configuration parameters as I linked above. If these are really parameters, that are configured ‘once’ for an item (or channel), and don’t require the user to change the configuration regularly, then this is exactly what configuration parameters are for. You shouldn’t try and use channels for this sort of thing.

Configuration parameters are available either on the thing, or for each channel. Maybe I just don’t understand what you’re trying to do…

Sorry I’m a beginner at OpenHAB, maybe I understand something wrong. I’ve been testing these OH1 binding to a Siemens PLC - it works great. At this OH1 binding I put all information to get a variable from the PLC into the .items file. So I want try a simular way on a OH2 binding (I know OH2 is different). I have been the linking information between the curved brackets { channel=“xxx” } - it’s clear and I have two information, my variable name (e.g. MAIN.fbLightKitchen.HMI.switch) and the datatype (e.g. BOOL, INTEGER, REAL, …) and I can’t found a easy way (like the Siemens binding) to consign tihs information to my handle command.

Maybe I don’t understand the context. I know the documentation and I know a litte about the source code, …

I need a small solution approach, …

Has nobody a idea? I need only a way to handle my userparameters like above. It must work easy over the PaperUI or a config file, …