I have the same problem with Items (defined in the UI) where the binding provides state options and I have a MAP-transformation with different values. When querying the Item through the API explorer I get this:
{
"link": "https://openhab.alfredsson.info/rest/items/SMHI_Hour0_Wsymb",
"state": "3",
"transformedState": "Växlande molnighet",
"stateDescription": {
"pattern": "MAP(smhi_wsymb2.map):%s",
"readOnly": true,
"options": [
{
"value": "1",
"label": "Clear sky"
},
{
"value": "2",
"label": "Nearly clear sky"
},
{
"value": "3",
"label": "Variable cloudiness"
},
{
"value": "4",
"label": "Halfclear sky"
},
{
"value": "5",
"label": "Cloudy sky"
},
{
"value": "6",
"label": "Overcast"
},
{
"value": "7",
"label": "Fog"
},
{
"value": "8",
"label": "Light rain showers"
},
{
"value": "9",
"label": "Moderate rain showers"
},
{
"value": "10",
"label": "Heavy rain showers"
},
{
"value": "11",
"label": "Thunderstorm"
},
{
"value": "12",
"label": "Light sleet showers"
},
{
"value": "13",
"label": "Moderate sleet showers"
},
{
"value": "14",
"label": "Heavy sleet showers"
},
{
"value": "15",
"label": "Light snow showers"
},
{
"value": "16",
"label": "Moderate snow showers"
},
{
"value": "17",
"label": "Heavy snow showers"
},
{
"value": "18",
"label": "Light rain"
},
{
"value": "19",
"label": "Moderate rain"
},
{
"value": "20",
"label": "Heavy rain"
},
{
"value": "21",
"label": "Thunder"
},
{
"value": "22",
"label": "Light sleet"
},
{
"value": "23",
"label": "Moderate sleet"
},
{
"value": "24",
"label": "Heavy sleet"
},
{
"value": "25",
"label": "Light snowfall"
},
{
"value": "26",
"label": "Moderate snowfall"
},
{
"value": "27",
"label": "Heavy snowfall"
}
]
},
"commandDescription": {
"commandOptions": [
{
"command": "1",
"label": "Clear sky"
},
{
"command": "2",
"label": "Nearly clear sky"
},
{
"command": "3",
"label": "Variable cloudiness"
},
{
"command": "4",
"label": "Halfclear sky"
},
{
"command": "5",
"label": "Cloudy sky"
},
{
"command": "6",
"label": "Overcast"
},
{
"command": "7",
"label": "Fog"
},
{
"command": "8",
"label": "Light rain showers"
},
{
"command": "9",
"label": "Moderate rain showers"
},
{
"command": "10",
"label": "Heavy rain showers"
},
{
"command": "11",
"label": "Thunderstorm"
},
{
"command": "12",
"label": "Light sleet showers"
},
{
"command": "13",
"label": "Moderate sleet showers"
},
{
"command": "14",
"label": "Heavy sleet showers"
},
{
"command": "15",
"label": "Light snow showers"
},
{
"command": "16",
"label": "Moderate snow showers"
},
{
"command": "17",
"label": "Heavy snow showers"
},
{
"command": "18",
"label": "Light rain"
},
{
"command": "19",
"label": "Moderate rain"
},
{
"command": "20",
"label": "Heavy rain"
},
{
"command": "21",
"label": "Thunder"
},
{
"command": "22",
"label": "Light sleet"
},
{
"command": "23",
"label": "Moderate sleet"
},
{
"command": "24",
"label": "Heavy sleet"
},
{
"command": "25",
"label": "Light snowfall"
},
{
"command": "26",
"label": "Moderate snowfall"
},
{
"command": "27",
"label": "Heavy snowfall"
}
]
},
"editable": true,
"type": "Number",
"name": "SMHI_Hour0_Wsymb",
"label": "Väder",
"category": "weather_day",
"tags": [],
"groupNames": [
"Smhi"
]
}
But main UI doesn’t seem to use the transformedState
value, it uses the options
instead (which come from the binding). When you edit the stateDescription
metadata in the UI there is an Options field where you can input key-value pairs like in the .map-files, and this seems to override the binding provided values, but this needs to be set on each item individually which isn’t scalable if you have many Items that use the same transformation.