Sending custom commands to switch using RFXcom binding

I have a LIGHTING4 switch from Everflourish that takes somewhat peculiar commands. On is OFF_12, off is OFF_4. I found that out by listening to the remote.

How can I combine these commands into one item without using rules? I tried the following

items:
String EF282965 (switches) { rfxcom=">282965:LIGHTING4.PT2262:Command" } String EF283733 (switches) { rfxcom=">283733:LIGHTING4.PT2262:Command" } String EF283925 (switches) { rfxcom=">283925:LIGHTING4.PT2262:Command" }

sitemap:
Selection item=EF282965 label="Green switch 1" mappings=[OFF_4="OFF", OFF_12="ON"] Selection item=EF283733 label="Green switch 2" mappings=[OFF_4="OFF", OFF_12="ON"] Selection item=EF283925 label="Green switch 3" mappings=[OFF_4="OFF", OFF_12="ON"]

But I get the following errors:

2016-01-28 23:41:11.587 [ERROR] [o.u.i.items.ItemUIRegistryImpl] - Cannot retrieve item EF283733 for widget org.openhab.model.sitemap.Selection
2016-01-28 23:41:11.591 [ERROR] [o.u.i.items.ItemUIRegistryImpl] - Cannot retrieve item EF283733 for widget org.openhab.model.sitemap.Selection
2016-01-28 23:41:11.593 [ERROR] [o.u.i.items.ItemUIRegistryImpl] - Cannot retrieve item EF283733 for widget org.openhab.model.sitemap.Selection
2016-01-28 23:41:11.595 [ERROR] [o.u.i.items.ItemUIRegistryImpl] - Cannot retrieve item EF283733 for widget org.openhab.model.sitemap.Selection
2016-01-28 23:41:11.598 [ERROR] [o.u.i.items.ItemUIRegistryImpl] - Cannot retrieve item EF283925 for widget org.openhab.model.sitemap.Selection
2016-01-28 23:41:11.600 [ERROR] [o.u.i.items.ItemUIRegistryImpl] - Cannot retrieve item EF283925 for widget org.openhab.model.sitemap.Selection
2016-01-28 23:41:11.602 [ERROR] [o.u.i.items.ItemUIRegistryImpl] - Cannot retrieve item EF283925 for widget org.openhab.model.sitemap.Selection
2016-01-28 23:41:11.604 [ERROR] [o.u.i.items.ItemUIRegistryImpl] - Cannot retrieve item EF283925 for widget org.openhab.model.sitemap.Selection
2016-01-28 23:41:17.041 [WARN ] [.w.internal.servlet.CmdServlet] - Received command 'OFF_12' for item 'EF283733', but the item does not exist in the registry

Am I taking the wrong approach?

I’m going to guess there is a syntax error in your first Item which is preventing the Item’s file reader from loading anything after that. It does not complain about EF282965, only EF283733 and EF283925.

As it is written above I don’t see anything obviously wrong. Have you loaded it into Designer to see if it highlights anything I don’t see?

Also, I’m not 100% certain that the mappings on the sitemap will do what you need here. As your Items are written you appear to want to send commands to these switches but I think the mappings on the Selection only changes what gets displayed, not what gets sent. And since the rfxcom binding does not support mappings directly I don’t think you can achieve what you are after without rules.

Thanks. The syntax seems fine, also in designer. I just found out that both commands mean the same to openHAB. Both OFF_12 and OFF_4 mean OFF. The solution is changing the code in the RFXcom binding so that it interprets the commands correctly, see https://github.com/openhab/openhab/issues/3858#issuecomment-176473766