dashticz - time to work Topic is solved

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
abaratian
Posts: 22
Joined: Thursday 12 July 2018 20:19
Target OS: Windows
Domoticz version: 2021.1
Contact:

dashticz - time to work

Post by abaratian »

Hi,
I'm new to dashticz I wanna add a block that shows my transit time to work or other places.
I am using a local service. In the documentation it says i should send a GET request:

Code: Select all

GET:
	https://api.neshan.org/v2/direction?parameters
Headers:
	Api-Key: YOUR_API_KEY
the parameters are origin and destination as: latitude,longitude.

then the result would be

Code: Select all

{
  "routes": [
    {
      "legs": [
        {
          "summary": "آزادی - ولیعصر",
          "distance": {
            "value": 8998,
            "text": "۹ کیلومتر"
          },
          "duration": {
            "value": 2012,
            "text": "۳۴ دقیقه"
          },
          "steps": [
            {
              "name": "عضدی جنوبی",
              "instruction": "در جهت شرق در عضدی جنوبی قرار بگیرید",
              "distance": {
                "value": 46,
                "text": "۴۶ متر"
              },
              "duration": {
                "value": 11,
                "text": "کمتر از ۱ دقیقه"
              },
              "polyline": "qxu|EkpcjJb@{@Tc@b...",
              "maneuver": "depart",
              "start_location": [
                51.344035,
                35.695452
              ]
            }
          ]
        }
      ],
      "overview_polyline": {
        "points": "qwzxEgckxHBeAWEDq ..."
      }
    }
  ]
}
from this list i want to display "summary" and duration "value" which is in seconds converted to hours:minutes on my dashboard like this:
It will take you HH:MM to work using THE_NAME_OF_THE_ROAD.

My js knowledge is pretty basic (zero to be honest) and can't figure out how to do this.
can any one help?
abaratian
Posts: 22
Joined: Thursday 12 July 2018 20:19
Target OS: Windows
Domoticz version: 2021.1
Contact:

Re: dashticz - time to work

Post by abaratian »

Hi,
I did in domoticz using dzvents with a dummy text device.

CLOSED
Post Reply

Who is online

Users browsing this forum: floris74 and 1 guest