openhab/openhab — pull request #1563 by engineergreen (2014-10-18 12:11:41+00:00)
Title: RFXCOM Binding: LIGHTING protocols - Fix support for Contact Items

This commit adds support for Contact Items to the RFXCom Lighting protocols.

While there is existing code to support Contact Items for eaching of the Lighting1, 2, 5 & 6 rfxcom protocols it appears to be unreachable. The existing Code required the openhab Item to be a "Contact" Item; and for the rfxcom ValueSelector to be "Command". However, the code RFXComValueSelector only permits an openhab "Switch" to be used with the rfxcom "Command" value selector.

I have resolved this by adding support for the existing "Contact" valueselector. This means a contact item can be used as in the following example:

Contact Sensor_Hall_FrontDoor (Room_Hall) { rfxcom="<93056.10:Contact" }

I have also inverted the ON/OFF -> OPEN/CLOSED mapping as in my hardware ON is sent when the contact is OPEN (which is logical as the intended use-case for these is to turn on a light when you open a door). I figured this wouldn't break backwards compatibility for anyone as the existing code was unreachable.