How to use Trigger-Channels in openHAB2?

Hi!

tl;dr:
I need to model buttons for a thing and according to the documentation the best way to do this is trigger channels. I cant find any good examples for triggers, so could someone provide some code and xml as sample? I already added some xml and in the Thing description the channel is shown but I cant link anything to it nor is it rendered in the control section in paper ui.

Background:
I’m developing a binding for my personal use: I recently build myselfe a home entertainment system with many devices. I use lirc and a raspi to control them via ir commands. I could use the lirc server and connect it to openhab via a http binding, but that doesnt fit all my needs, same goes for the exec binding: I want to model each of this devices as things. The usual items like SwitchItems and StringItems fit for most porpuses, but I also need to be able to use something just like buttons, which I can directly map to the ir remote command.
Therefor I want to use trigger channels. Bonus question: Can I create my own Items by extending GenericItem and using a own ItemFactory? Would these items be rendered correctly in paper ui out of the box?

1 Like

Since you’ve mentioned LIRC, you may be interesting in trying my LIRC binding.

JAR of the current version is here: https://drive.google.com/file/d/0By8uaRmIJMCFeUZWWXJIQ2tiZ3M/view?usp=sharing21

Just drop it in the addons folder and it should work.

Instructions on how to use it are available on github: https://github.com/kabili207/smarthome/blob/lirc/extensions/binding/org.eclipse.smarthome.binding.lirc/README.md29

1 Like