Hello everyone,
I am currently looking into integrating an ETA for my daily commute on my main UI overview page.
The information is retrieved from the HERE routes API using the new HTTP binding and a JSONPATH.
Thing http:url:hereLocation "HERE Location" [ baseURL="https://router.hereapi.com/v8/routes?apiKey=YOURAPIKEY&transportMode=car&origin=51.0,6.0&destination=51.1,7.0&return=summary,mlDuration", refresh=30] {
Channels:
Type number : Duration "Duration" [ stateTransformation="JSONPATH:$.routes[:1].sections[:1].summary.mlDuration" ]
}
The duration is returned in seconds. So I have created an item for the duration channel with Time as Unit of Measurement and declared also seconds within the label.
Number:Time LocationDuration "Location Duration [%d s]" {channel="http:url:hereLocation:Duration"}
The step I am missing now is how I can change the displayed unit in my main UI. For previous version of OpenHAB where a sitemap file was used, the label could just be adapted to “Location Duration [%d min]” which then did the conversion. In the new main UI, I am looking to getting this duration displayed within a list using the oh-label-item
component. There is no attribute that would allow me to change how the item is displayed though. Or am I missing something?
Thanks in advance!
Felix