I’m currently developing a binding for the ZMote IR transmitter and need some input from experienced OpenHAB2 users regarding the way such a device should be configured.
Basically I see three main uses cases:
-
Have some kind of button type item where you can press the button and it simply transmits an IR code once. Maybe support some way to distinguish between short and long button presses, which would affect how often the IR code is repeated.
-
Have some kind of switch type item where toggling the switch sends either the ON IR code or the OFF IR code and the current state of the switch is determined by some other binding which is able to query if the device is currently online.
-
Support the sendCommand() method so IR codes can be sent from within rules easily.
How should this configuration (mostly 1 and 2) look in OpenHAB2, so it fits properly into the new OpenHAB2 concepts?
Right now I started to implement the auto-discovery of the thing which let’s me test if the IR transmitter itself is currently online. Once that is finished I have my first “online” channel which is represented by a read-only switch.
Next I will obviously need some kind of channel which accepts a button name, triggering the transmitter to send the appropriate IR code. But which data type should this channel have, to fit into the final configuration and how would the configuration look like, to support the above use cases? How would I connect a switch with different items where one item provides the state of the switch and the other item is used to execute toggle commands (= send IR codes)?
I just started using OpenHAB2 so the configuration concepts are still new to me. Any advice would be very welcome. How would you like to see an IR transmitter being configured in OpenHAB2? What would be your preferred way of configuring it, so it fits into your use cases?