HowTo: Node Red – Show gas station prices in the area on the dashboard

With NodeRed or the appropriate nodes, you can very easily retrieve data from the Internet and display it in a processed form.

A practical application for this is, for example, calling up gas station prices from the area and automatically displaying them in a table. The web service Tankerkoenig.de is kind enough to offer its data free of charge via its API.

With the NodeRed code below and an API code from Tankerkoenig.de you can easily keep up to date with the current gas station prices. For this purpose, the data is called up regularly and clearly displayed in a table on the dashboard.

Everything you need for the implementation is described in the following article.


Safety instructions

I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/

Affiliate links/advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂 


Requirements

Helpful articles:
So that you can install new nodes, NodeRed should of course already be installed.
How to prepare a RaspberryPi and then install NodeRed on it is described in the following articles.

The following three articles describe what needs to be done to prepare the RaspberryPi:

Required tool:
-no-

Required material:

In the following list you will find all the parts you need to implement this article.


Log into the NodeRed configuration interface

Before you can edit your NodeRed configuration, you must - if activated - first log into the NodeRed configuration interface.

View of the login dialog. Here you have to enter the login data that you specified during the configuration of the login. You can find information about this in the article NodeRed - set up user login.

Install required nodes

In order for NodeRed to be able to communicate with the Tankerkönig platform, you need the Node

  • node-red-contrib-tankerkoenig

to install. How your node is installed in the article NodeRed – Install new nodes described.

In addition to this node, you should also have the following nodes installed, which are used to display the data.

  • node-red-node-ui-table
  • node-red-dashboard

Information about the dashboard node can also be found in the article NodeRed - Create a user interface with dashboard nodes.


Import node code

The following NodeCode can be imported directly. You only have to make a few settings afterwards.

You also need an API code from tankerkoenig.de. This is the only way you can access the price data. You can download the API code for free at https://creativecommons.tankerkoenig.de/api-key to register.

You can find the NodeCode to import here:

https://github.com/Nerdiyde/NodeRedSnippets/blob/master/snippets/tankerkoenig_api_retrieval.json

How you can import NodeCode into your own NodeRed installation is in the article NodeRed - import and export node code described.

One important thing: you should not set the data retrieval interval too small. You can find more information about this on the tankerkoenig.de website.

View of the flow in the NodeRed configuration view.

View of the retrieved data in the table on the dashboard.

So that the gas station prices can be called up, you must first configure the tankerkoenig-node.

To do this, click on the Tankerkönig node and then click on the pencil in the Location section.

There you can now configure your location. The location is determined based on longitude and latitude.

How you can find out the coordinates of a location is in the article Find the latitude and longitude of any location with GoogleMaps described. Then enter this data under Latitude and Longitude.

You can also set the radius for your price search here and of course enter the previously created API key.

You should leave the setting for “Type” set to “All”, otherwise not all data will be displayed in the table.


Have fun with the project

I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂

PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂

Buy Me a Coffee at ko-fi.com       

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert

This site uses Akismet to reduce spam. Learn how your comment data is processed.