I’ve seen many request for something similar, but often just for visual purposes in the sitemaps as opposed to actual operation of an item. Is there a way to specify a manual mapping for an item inside the item configuration? I believe there are options to do so using a .map file in the Transform directory, but I’m looking to reduce moving parts and just put the mapping in the item declaration itself.
The scenario is that I have a Garage Door Opener, that takes numbers as the input/output of the current state. Specifically 255 and 0 are the Open/Closed numbers. I’d like to simply create a switch, and manually map 255=Open/0=Closed (or On/Off) so that I don’t need to create a map file, an items file, and then rules to trigger the changes needed to make the garage actually work. So if I would be able to create a single item (switch) and manually map the ON/OFF values in the items declaration, I could have a one line resolution.
My end goal would be something similar to: Switch garage_door "Garage Door" [MAP:ON=255,OFF=0] {zwave:device:node:22xyxyxyxyxyx etc}
While AFAIK this is not possible within the items file, you can assign the values that get sent upon Button press in the sitemap file. Here an example for a Switch that mutes a TV:
In the mappings section, you can “tell” the button to send allmost everything, so your values of 255 and 0 are not a problem. IMHO this has the added benefit that you can use one switch and assign a gazillion values to it. For example, i use one switch to select many Radio stations. As these would not fit into one line, i just reuse the same switch in the sitemap several times, but with different mappings, like so:
Thanks @Oli - that’s what I was aware of as an option. And I do like this flexibility (used this many times before in previous 1.x deployment of OH). For this instance though, I’m really looking to remap the values for the switch item. One reason I described obviously is reduction of moving parts. But optimally, I need this for 2 other main reasons.
1 - The SO of the house hold, doesn’t like all these different apps, and we are an iOS family - so HomeKit integration is my plan for making everything available in a single app, and allow use of things like Siri for controlling items. Garage may not likely be as often used in this scenario, but I’d like to make it all available.
2 - Automation via voice. I have this all rigged up with HomeKit (Siri), as well as Hue Emulation (Alexa). If I can’t map the values directly in an item, I’ll have to resort to automation that follows/tracks a button state instead. Sitemaps won’t give me the ability to make the item recognizable by HomeKit or Hue Emulation.
It sounds like I may have to just go the long route of creating automation that tracks a button and then performs the actions. Or setup a mapping instead for an item, and put the values there instead.