Retrieve item name within channel handler

Hi,

I am working again on my Raspberry pi passthru binding on openhab2. I’ve no problems to retrieve the channel parameters but I am rather blind to transform “itemName” used within openhab 1 to build my tcp/ip message.

So what method to be used to extract the corresponding item name while processing the channel command?

Thanks for your help!

Regards

Johann

I actually think that a "binding is not the correct construct for this feature. Afair, it is about connecting different instances with each other, right? Why would you want to re-implement it? I would assume that your current code should also work nicely on openHAB 2.

Hi,

thanks. The major reason is to understand openhab 2 internals. For me it is some kind of a different approach and that’s why I want to reimplement my openhab 1 solution. Whatsoever I came to the point that org.eclipse.smarthome.io.rest.core does that linkage from a the channel of a Thing to an item so there should be a way back from the linked Thing back to the item. And that’s the point I said I am blind. Until now I did not see a real solution - but I’m a newcomer to openhab 2.

So any help is welcome at this pont.

Many thanks and regards

Johann

This is actually a false impression. Many people think that “Things” are a replacement for items (maybe because it is a more catchy name), but this is not the case. You should consider Things to be only a construct for setting up the configuration.

Hi,

Fixed. As you said don’t mix the Things I’ve just moved the required parameter to the channel parameters which allows additional flexibility. Done!
I am moving forwards now.

Regards

Johann

Hi again,

the binding is nearly completed and it works nicely - better than expected. It will support openhab 1 and openhab 2 and I hope to request a pull within the next days.
Just to explain why using a binding. The trick is simply to move from a local to a remote one just changing a few parameters. And that works. No one would ever expect that the real control resides on a Raspberry using GPIO’s.

Thanks!

Johann