I am retrieving data through the gpstracker binding. Unfortunately that binding does not support to provide the “speed” of the object. Anyway I figured I can just just use one of the available fields like “accuracy” (which I don’t need) and put the speed into that field.
This has been working so far.
It turns out though that even though within the Android app speed is measured in km/h, the item actually retrieves the values in m/s.
I then figured I would use a profile + Javascript to transform the value.
So i added this to my item definition:
Number Andreas_Handy_Speed "Andreas Handy Geschwindigkeit" <speed> {channel="gpstracker:tracker:XY:gpsAccuracy" [profile="transform:JS", function="speed.js"]}
My understanding was that by using such a profile I would actually change the underlying “raw” value instead of changing how to display this item. The reason I wanted to do that is that I also want to display a chart and charts don’t care about displayStates.
In the logfile I see the values without transformation.
In the API explorer, I see that a transformation is applied:
{
"link": "https://192.168.178.140:8443/rest/items/Andreas_Handy_Speed",
"state": "2",
"transformedState": "7.2",
"stateDescription": {
"pattern": "JS(speed.js):%s",
"readOnly": true,
"options": []
},
"editable": false,
"type": "Number",
"name": "Andreas_Handy_Speed",
"label": "Andreas Handy Geschwindigkeit",
"category": "speed",
"tags": [],
"groupNames": []
}
But the chart in the BasicUI sitemap does not seem to pick up on this transformation. It still shows the non-transformed “raw” values.
I read in another thread that using profiles would actually do that, but not sure if that still applies in OH3.
So my question is how can I change the raw values of my item? Or maybe how can I make charts to consider the transformedState instead of the rawState?
OH 3.4
Thanks a lot!