Open jboeddeker opened 6 years ago
Forgive me when I'm on the wrong track, but it isn't possible to use
Switch item=KUKodi_pvropentv "[MAP(tvchannels.map):%S]" for this?
Of course, this is for display only. Is your approach another?
@cubistico, this issue is about the mappings keyword not the display transformations.
The mappings keyword defines the options which are available as switches or selection items.
Currently the mappings need to be hardcoded in the sitemap for each instance.
@jboeddeker, thanks for the clarification. So then I second this improvement request.
The mappings keyword allows to add a list of key/value pairs to a Switch or a Selection.
It would be great if something reusable could be added to this. Currently every switch or selection needs its own list. I use such lists in several places, it is an ugly copying within the sitemaps.
Examples:
a list of basic colors (https://community.openhab.org/t/set-color-item-to-a-basic-color-in-sitemap/50731/3?u=job)
a list of scripts to call for buttons/keys (https://community.openhab.org/t/configurable-buttons-switches-another-good-use-of-scripts/50810)
a list of playlists for each squeezebox (i use 7 instances) (
Selection item=SB_SetM3U mappings=["PL1"="Playlist1","PL2"="Playlist2", ..., "PLn"="Playlistn"]
)a list of tv channels for each Kodi (i use 4 instances) (
Switch item=KUKodi_pvropentv mappings=["Das Erste"="ARD","ZDF HD"="ZDF","RTL SD"="RTL","Sat.1 SD"="Sat1","ProSieben SD"="Pro7"]
)a list of standard volume levels (
Selection item=KUKodi_volume mappings=[10=" 10",20=" 20",30=" 30",40=" 40",50=" 50",60=" 60",70=" 70",80=" 80",90=" 90",100="100"]
)a list of of standard lighting levels (
Switch item=HTSL_DIMM label="" mappings=[10="10",25="25",50="50",75="75",100="100"]
)Reusing a map transformation would be a good thing:
Switch item=KUKodi_pvropentv mappings=[MAP(tvchannels.map)]
Selection item=KUKodi_volume mappings=[MAP(volumelevels.map)]
Switch item=HTSL_DIMM label="" mappings=[MAP(lightinglevels.map)]
Selection item=WZL_COLOR label="" mappings=[MAP(colors.map)]
Selection item=SB_SetM3U mappings=[MAP(playlists.map)]
Thanks