Hi,
I’m on 4.1.3 Release build and I’m flabbergasted about getting a state transformed.
I’m using the MQTT binding and receiving a large float which represents a temperature value in degrees. It has a lot of decimals, so I want to trunk that into 2 decimals. What I normally do is add metadata stateDescription and set a pattern like %.2f °C
.
This however does nothing. It does not trunk it to two decimals.
When I use a label widget, the non trunked value is shown. And no value is shown when explicitly use the displayState like =items['mqtt_victron_temperature_ambient'].displayState
When I pull the item from the rest API, the non-trunked value is returned.
I’m a doing something wrong?
{
"link": "http://<url>/rest/items/mqtt_victron_temperature_ambient",
"state": "20.610000610351562 °C",
"stateDescription": {
"step": 1,
"pattern": "%.1f °C",
"readOnly": true,
"options": [
{
"value": ""
}
]
},
"unitSymbol": "°C",
"commandDescription": {
"commandOptions": [
{
"command": ""
}
]
},
"metadata": {
"unit": {
"value": "°C"
},
"stateDescription": {
"value": " ",
"config": {
"options": "",
"pattern": "%.1f °C"
}
}
},
"editable": true,
"type": "Number:Temperature",
"name": "mqtt_victron_temperature_ambient",
"label": "Victron - Temperature - Ambient",
"tags": [],
"groupNames": []
}