jcallaghan / home-assistant-config

My Home Assistant configuration & documentation.
https://www.jcallaghan.com/
MIT License
173 stars 8 forks source link

Dynamic fuel price ⛽🚗📉 #210

Open jcallaghan opened 3 years ago

jcallaghan commented 3 years ago

Use location data from person.james to check for local fuel prices. Consider leveraging and extending the Here travel time integration. They have a fuel prices API which accepts location data and returns

Example

Request

https://fuel-v2.cit.cc.api.here.com/fuel/stations.json
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&prox=52.53087,13.44176,5000
&fueltype=35

Response


{
   "hasMore":true,
   "fuelStations":{
    "fuelStation":[
     {
      "brand":"TOTAL",
      "brandIcon":"http://origin.stg.cld.vcdn.data.here.com/p/d/autox_stg/dt/icons/2015-05-06/total.png",
      "fuelPrice":[
         {
          "price":1.389,
          "deltaPrice":0.26,
          "indexScore":98,
          "fuelType":"1",
          "unit":"l",
          "currency":"EUR",
          "lastUpdateTimestamp":"2015-03-12T10:17:45.000Z"
         }
      ],
      "open24x7":true,
      "stationDetails":{
         "openingHours":{
          "regularOpeningHours":[
           {
            "daymask":127,
            "period":[
               {
                "from":"00:00:00",
                "to":"24:00:00"
               }
            ]
           }
          ]
         }
      },
      "address":{
         "city":"Berlin",
         "country":"DEU",
         "region":"Berlin",
         "street":"Margarete-Sommer-Stra�e",
         "streetNumber":"2",
         "postalCode":"10407"
      },
      "contacts":{
         "phone":[
          {
           "value":"+493042852514",
           "label":"PHONE"
          }
         ]
      },
      "distance":0,
      "position":{
         "latitude":52.53087,
         "longitude":13.44176
      },
      "name":"TOTAL",
      "id":"276u33dc-d1d2783a63404a6789f281438f32375f",
      "pvId":"50664433",
      "lastUpdateTimestamp":"2014-12-14T11:01:41.609Z",
      "timeZone":"Europe/Berlin"
     }
    ]
   }
}

Fuel types are available here.

Related: #79

dhruvkej9 commented 1 year ago

@jcallaghan what is 5000 in prox. Can you please provide the documentation of the API i am not able to find the documentation to see how to use this API