openhab/openhab — pull request #1357 by cyclingengineer (2014-08-20 21:19:02+00:00)
Title: Benq Projector Binding

I finally got around to implementing a binding that uses the TCP/IP to RS232 board. If someone has a direct serial connection then ask and we can discuss how best to contribute that.

I've attached a version of the binding that should work reasonably reliably. It currently supports the following:
Power - Read/Write
Mute - Read/Write (only when power is on)
Volume - Read/Write (only when power is on)
Input Source - Read (write coming soon!)
Lamp hours - Read
You'll need to add the following to you openhab.cfg file:

```
############################# BenqProjector Binding ########################################

# define the host and port to connect to (or in future the serial port)
benqprojector:deviceId=host:port

#current not used - but could be in the future to select between RS232 and network comms via a TCP/IP<->RS232 module
#benqprojector:mode=

# set the refrese interval (in milliseconds) - defaults to 60s if not set
#benqprojector:refresh=30000
```
Here are example bindings:

```
Switch exp_multimedia_projectorPower "Projector Power" (experimental) {benqprojector="power"}
Switch exp_multimedia_projectorMute "Projector Mute" (experimental) {benqprojector="mute"}
Number exp_multimedia_projectorVol "Projector Volume [%d]" (experimental) {benqprojector="volume"}
Number exp_multimedia_projectorSourceNum "Projector Source [%d]" (experimental) {benqprojector="source_number"}
String exp_multimedia_projectorSourceString "Projector Source [%s]" (experimental) {benqprojector="source_string"}
Number exp_multimedia_projectorLamp "Projector Lamp [%d hours]" (experimental) {benqprojector="lamp_hours"}
```

You'll notice that you can pull the source out either mapped to a number or to a string. The numbers are mapped as follows:

```
COMPUTER("RGB", 0),
COMPUTER2("RGB2", 1),
COMPONENT("ypbr", 2),
DVIA("dviA", 3),
DVID("dvid", 4),
HDMI("hdmi", 5),
HDMI2("hdmi2", 6),
COMPOSITE("vid", 7),
SVIDEO("svid", 8),
NETWORK("network", 9),
USB_DISPLAY("usbdisplay",10),
USB_READER("usbreader",11);
```
For reference the commands can be found here - ftp://ftp.benq-eu.com/projector/benq_rs232_commands.pdf

I'll add this information to a wiki page in coming days.

This binding is still under development - I'll comment on this PR when it's ready for consideration for merge.