Current travel time on favorit route

Hello,

I am not sure if I am in correct sub categorie.
Do you know if there is a chance to display current travel time for a predefined route in google maps?
Personally I have no idea how to do this. Maybe it is a good feature idea?!

1 Like

Thanks so much.
But due to pay account etc from google I tried to set it up with here maps.

But I am running in a error when trying to do a very similar request. Maybe someone can help me with the JSONPATH part?
items:

String	HereDauerohneTraffic	"Dauer [%s]"		(gHereMaps)	{ http="<[https://route.cit.api.here.com/routing/7.2/calculateroute.json?app_id=EXEwkIGLEDsJzu6Fe4AH&app_code=wBN40ckKmF5yTHsfFOcWuQ&waypoint0=geo!47.314908,10.563676&waypoint1=geo!47.198477,10.568174&mode=fastest;car;traffic:disabled:300000:JSONPATH($.response.summary.trafficTime)]" }

Sure,
Post the json

{"response":{"metaInfo":{"timestamp":"2018-06-29T12:07:58Z","mapVersion":"8.30.84.157","moduleVersion":"7.2.201825-29488","interfaceVersion":"2.6.34","availableMapVersion":["8.30.84.157"]},"route":[{"waypoint":[{"linkId":"-1157762178","mappedPosition":{"latitude":47.3149415,"longitude":10.5631416},"originalPosition":{"latitude":47.3149079,"longitude":10.563676},"type":"stopOver","spot":0.4941176,"sideOfStreet":"left","mappedRoadName":"Bruckmeierstra√üe","label":"Bruckmeierstra√üe","shapeIndex":0},{"linkId":"+586895771","mappedPosition":{"latitude":47.1985021,"longitude":10.5681422},"originalPosition":{"latitude":47.1984769,"longitude":10.5681739},"type":"stopOver","spot":1.0,"sideOfStreet":"right","mappedRoadName":"","label":"","shapeIndex":209}],"mode":{"type":"fastest","transportModes":["car"],"trafficMode":"disabled","feature":[]},"leg":[{"start":{"linkId":"-1157762178","mappedPosition":{"latitude":48.3149415,"longitude":11.5631416},"originalPosition":{"latitude":48.3149079,"longitude":11.563676},"type":"stopOver","spot":0.4941176,"sideOfStreet":"left","mappedRoadName":"Bruckmeierstra√üe","label":"Bruckmeierstra√üe","shapeIndex":0},"end":{"linkId":"+586895771","mappedPosition":{"latitude":48.1985021,"longitude":11.5681422},"originalPosition":{"latitude":47.1984769,"longitude":10.5681739},"type":"stopOver","spot":1.0,"sideOfStreet":"right","mappedRoadName":"","label":"","shapeIndex":209},"length":17362,"travelTime":1345,"maneuver":[{"position":{"latitude":48.3149415,"longitude":11.5631416},"instruction":"Head toward <span class=\"toward_street\">Graf-Buttler-Stra√üe</span> on <span class=\"street\">Bruckmeierstra√üe</span>. <span class=\"distance-description\">Go for <span class=\"length\">42 m</span>.</span>","travelTime":11,"length":42,"id":"M1","_type":"PrivateTransportManeuverType"},{"position":{"latitude":48.3145666,"longitude":11.5630889},"instruction":"Turn <span class=\"direction\">right</span> onto <span class=\"next-street\">Graf-Buttler-Stra√üe</span>. <span class=\"distance-description\">Go for <span class=\"length\">99 m</span>.</span>","travelTime":32,"length":99,"id":"M2","_type":"PrivateTransportManeuverType"},{"position":{"latitude":47.3146632,"longitude":10.5617478},"instruction":"Turn <span class=\"direction\">left</span> onto <span class=\"next-street\">Grundfeld</span>. <span class=\"distance-description\">Go for <span class=\"length\">317 m</span>.</span>","travelTime":69,"length":317,"id":"M3","_type":"PrivateTransportManeuverType"},{"position":{"latitude":47.3119702,"longitude":10.5609646},"instruction":"Turn <span class=\"direction\">left</span> onto <span class=\"next-street\">Grundfeld</span>. <span class=\"distance-description\">Go for <span class=\"length\">74 m</span>.</span>","travelTime":16,"length":74,"id":"M4","_type":"PrivateTransportManeuverType"},{"position":{"latitude":47.311305,"longitude":10.5608358},"instruction":"Turn <span class=\"direction\">right</span> onto <span class=\"next-street\">Grundfeld</span>. <span class=\"distance-description\">Go for <span class=\"length\">78 m</span>.</span>","travelTime":24,"length":78,"id":"M5","_type":"PrivateTransportManeuverType"},{"position":{"latitude":48.3111548,"longitude":11.5598166},"instruction":"Turn <span class=\"direction\">left</span> onto <span class=\"next-street\">M√ľnchner Stra√üe</span>. <span class=\"distance-description\">Go for <span class=\"length\">73 m</span>.</span>","travelTime":18,"length":73,"id":"M6","_type":"PrivateTransportManeuverType"},{"position":{"latitude":48.3105004,"longitude":11.5598595},"instruction":"Take the <span class=\"exit\">2nd exit</span> from roundabout onto <span class=\"number\">St2339</span>. <span class=\"distance-description\">Go for <span class=\"length\">1.2 km</span>.</span>","travelTime":80,"length":1165,"id":"M7","_type":"PrivateTransportManeuverType"},{"position":{"latitude":47.3046746,"longitude":10.5718436},"instruction":"Turn <span class=\"direction\">right</span> onto <span class=\"next-street\">Maisteig</span> <span class=\"number\">(B13)</span>. <span class=\"distance-description\">Go for <span class=\"length\">9.9 km</span>.</span>","travelTime":528,"length":9908,"id":"M8","_type":"PrivateTransportManeuverType"},{"position":{"latitude":47.2270193,"longitude":10.5868425},"instruction":"Turn <span class=\"direction\">left</span> onto <span class=\"next-street\">Ingolst√§dter Stra√üe</span> <span class=\"number\">(B13)</span> toward <span class=\"sign\"><span lang=\"de\">M√ľnchen</span></span>. <span class=\"distance-description\">Go for <span class=\"length\">1.9 km</span>.</span>","travelTime":139,"length":1865,"id":"M9","_type":"PrivateTransportManeuverType"},{"position":{"latitude":47.2103896,"longitude":10.5870678},"instruction":"Turn <span class=\"direction\">right</span> onto <span class=\"next-street\">Neuherbergstra√üe</span>. <span class=\"distance-description\">Go for <span class=\"length\">1.5 km</span>.</span>","travelTime":136,"length":1490,"id":"M10","_type":"PrivateTransportManeuverType"},{"position":{"latitude":47.2092309,"longitude":10.5674663},"instruction":"Continue on <span class=\"next-street\">Neuherbergstra√üe</span>. <span class=\"distance-description\">Go for <span class=\"length\">315 m</span>.</span>","travelTime":35,"length":315,"id":"M11","_type":"PrivateTransportManeuverType"},{"position":{"latitude":47.208791,"longitude":10.5632713},"instruction":"Turn <span class=\"direction\">left</span> onto <span class=\"next-street\">Schlei√üheimer Stra√üe</span>. <span class=\"distance-description\">Go for <span class=\"length\">1.2 km</span>.</span>","travelTime":126,"length":1208,"id":"M12","_type":"PrivateTransportManeuverType"},{"position":{"latitude":47.1980944,"longitude":10.5646446},"instruction":"Turn <span class=\"direction\">right</span> onto <span class=\"next-street\">Schlei√üheimer Stra√üe</span>. <span class=\"distance-description\">Go for <span class=\"length\">250 m</span>.</span>","travelTime":47,"length":250,"id":"M13","_type":"PrivateTransportManeuverType"},{"position":{"latitude":47.1980193,"longitude":10.5619946},"instruction":"Turn <span class=\"direction\">slightly right</span>. <span class=\"distance-description\">Go for <span class=\"length\">336 m</span>.</span>","travelTime":56,"length":336,"id":"M14","_type":"PrivateTransportManeuverType"},{"position":{"latitude":47.1983197,"longitude":10.5664899},"instruction":"Take the <span class=\"exit\">2nd exit</span> from roundabout. <span class=\"distance-description\">Go for <span class=\"length\">142 m</span>.</span>","travelTime":28,"length":142,"id":"M15","_type":"PrivateTransportManeuverType"},{"position":{"latitude":47.1985021,"longitude":10.5681422},"instruction":"Arrive at your destination on the right.","travelTime":0,"length":0,"id":"M16","_type":"PrivateTransportManeuverType"}]}],"summary":{"distance":17362,"trafficTime":1495,"baseTime":1345,"flags":["noThroughRoad","builtUpArea"],"text":"The trip takes <span class=\"length\">17.4 km</span> and <span class=\"time\">22 mins</span>.","travelTime":1345,"_type":"RouteSummaryType"}}],"language":"en-us"}}

And I am only interested in Summary Values …

$.response.route.[0].summary.distance
$.response.route.[0].summary.trafficTime
$.response.route.[0].summary.baseTime
$.response.route.[0].summary.travelTime

use jasonpath.com

1 Like

Great hint with jsonpath.com!

Just another question. Maybe due to my first trial in rules I am running in issues. I simply want to display items value (given in seconds) in minutes.
This is my trial:

rule
 
"Here Umrechnung - ich"

when
Item HereIchDauermitTraffic received update
then
var minutes1 = HereIchDauermitTraffic.state
var Integer minutes1 = new Integer("365")
    var Integer m1 = minutes1 % 60
HereIch.sendUpdate(m1)

end

HereIch is defined in ttems as String

Item

Number:Time HereIchDauermitTraffic "Time is seconds [%d s]" { your binding if any }

Sitemap

Text item=HereIchDauermitTraffic label="Time in minutes [%.1f min]"

My first though was: ‚Äúcan it be so simple‚ÄĚ ‚Ķ

But it is not working. basicUI is not showing values
just ‚Äú- min‚ÄĚ

Is there really a Number:Time ? I did not find it in manual pages …??
Thanks for your help

Hello @Homer-Sim,
Yes there is I am in the process of updating the docs, see:

Can you post you items and the sitemaps, please
It should work

What version of OH are you using?

items:

Number:Time     HereKateDauermitTraffic     "VerkehrKate [%d s]"          <owntravel>     (gHereMaps)   {}

sitemap:

Text item=HereKateDauermitTraffic   label="Fahrzeit Kate: [%.1f min]"

version: openHAB 2.2.0 Release Build

just to avoid confusion without :time it is working withshowing secods (1405)

This a 2.3 feature. You should upgrade

1 Like

Running like a charm!

OK … maybe to quick response.

This is now running but nearly all my groups, charts and mqtt driven figures are giving errors …
is there a major change tutorial?

No, it should work.

Try clear the cache:

Don’t for get to stop OH
follow the steps

OK, I did that. BTW I am running OH2 in a docker container.

It is a little curious.
Even normal groups and sub groups are not shown correctly but the astro items and the new arrivaltime is working.
MQTT is receiving values. No change on conf files from my side but charts and single values are not displayed.

I have nearly no idea how to search for solutions …

Also quite curious error log:

2018-07-04 13:35:19.924 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Chart_Zeitraum_D_W_M_Y' for widget or$
2018-07-04 13:35:19.925 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model$
2018-07-04 13:35:19.926 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Chart_Zeitraum_D_W_M_Y' for widget or$
2018-07-04 13:35:19.926 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Chart_Zeitraum_D_W_M_Y' for widget or$
2018-07-04 13:35:19.927 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Chart_Zeitraum_D_W_M_Y' for widget or$
2018-07-04 13:35:19.928 [WARN ] [.basic.internal.render.ChartRenderer] - Chart cannot be rendered as item 'gHelligkeit_Alle' does no$
2018-07-04 13:35:19.928 [WARN ] [.basic.internal.render.ChartRenderer] - Chart cannot be rendered as item 'gHelligkeit_Alle' does no$
2018-07-04 13:35:19.929 [WARN ] [.basic.internal.render.ChartRenderer] - Chart cannot be rendered as item 'gHelligkeit_Alle' does no$
2018-07-04 13:35:19.930 [WARN ] [.basic.internal.render.ChartRenderer] - Chart cannot be rendered as item 'gHelligkeit_Alle' does no$
2018-07-04 13:35:25.978 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Dynamic group with label 'Erdgeschoss' will be ignored, bec$
2018-07-04 13:35:25.981 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model$
2018-07-04 13:35:25.984 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Dynamic group with label 'Erdgeschoss' will be ignored, bec$
2018-07-04 13:35:27.402 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model$
2018-07-04 13:35:27.403 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'HumidityAussen' for widget org.eclips$
2018-07-04 13:35:27.404 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'HumidityAussen' for widget org.eclips$
2018-07-04 13:35:27.405 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'HumidityAussen' for widget org.eclips$
2018-07-04 13:35:27.406 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model$
2018-07-04 13:35:27.407 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'PressureAussen' for widget org.eclips$
2018-07-04 13:35:27.409 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'PressureAussen' for widget org.eclips$
2018-07-04 13:35:27.410 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'PressureAussen' for widget org.eclips$
2018-07-04 13:35:27.411 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model$
2018-07-04 13:35:27.412 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'BrightnessAussen' for widget org.ecli$
2018-07-04 13:35:27.413 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'BrightnessAussen' for widget org.ecli$
2018-07-04 13:35:27.414 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'BrightnessAussen' for widget org.ecli$
2018-07-04 13:35:27.421 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model$
2018-07-04 13:35:27.422 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'gEG' for widget org.eclipse.smarthome$
2018-07-04 13:35:27.423 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'gEG' for widget org.eclipse.smarthome$
2018-07-04 13:35:27.423 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'gEG' for widget org.eclipse.smarthome$
2018-07-04 13:35:27.424 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model$
2018-07-04 13:35:27.425 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'gOG' for widget org.eclipse.smarthome$
2018-07-04 13:35:27.426 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'gOG' for widget org.eclipse.smarthome$
2018-07-04 13:35:27.427 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'gOG' for widget org.eclipse.smarthome$

but in items are all these registered:

a short part of item file

/* Gruppen */


group All

Group gKE               // Gruppe Keller
Group gGA               // Gruppe Garage-Aussen
Group gEG               // Gruppe Erdgeschoss
Group gOG               // Gruppe Obergeschoss

Group gEG_Flur          "Flur"          <ownwardrobe>           (gEG)
Group gEG_GaesteBad     "Gästebad"      <ownshower>             (gEG)
Group gEG_Esszimmer     "Esszimmer"     <owndining>             (gEG)
Group gEG_Kueche        "K√ľche"         <ownkitchen>            (gEG)
Group gEG_Speise        "Speise"        <ownpantry>             (gEG)
Group gEG_Buero         "B√ľro"          <ownoffice>             (gEG)
Group gEG_Wohnzimmer    "Wohnzimmer"    <ownlivingroom>         (gEG)


Group gOG_Schlafzimmer  "Schlafzimmer"  <ownsleeping>           (gOG)
Group gOG_Bad           "Bad"           <ownbath>               (gOG)
Group gOG_KindMax       "Maximilian"    <ownmax>                (gOG)
Group gOG_KindEmmi      "Emelie"        <ownemmi>               (gOG)

Group gKE_Werkstatt     "Werkstatt"      <owntoolshop>          (gKE)
Group gKE_Naehen        "Nähzimmer"      <ownkate>              (gKE)

Group gGA_Garage        "Garage"      <owngarage>               (gGA)
Group gGA_Aussen        "Aussen"      <ownshower>               (gGA)


all other items with errors are also in …???

The first line of your file is wrong
Group with a capital G

1 Like

OMG
I am sorry but sometimes you do not see the trees in the forrest.
Funny 2.2.0 version was not so ‚Äúpicky‚ÄĚ

Another bet practice question. DO you have separated items files or one big one?

I have separate items files depending on functions. weather.items, doorwindows.items…

1 Like