I was inspired by a video from Csongor Varga for a new project idea with my Node-Red. Basically he uses Node-Red for requesting the Google API and getting the travel time form home to work. My idea was then to request the data from the Google API and save them in my InfluxDB for further analytics.
I start with a Big Timer to limit the requests to a timeslot from 4:30am to 10:30am. Then i use the Switch and Join elements to limit the request to any tenth trigger. After that there is the http get with the Google API call.
For the following three change elements which extracts the values i want to save i use a json element for transforming the output of the http call.
The last join than aggregates the values to a new json which is than forwarded to the influxdb in a database called statistics.
The output than looks like this in the influxDB
> select * from travel_allach ORDER BY time DESC limit 1;
name: travel_allach
time distance duration duration_in_traffic value
---- -------- -------- ------------------- -----
1570212851482806984 60696 3331 3143
>
This is the output of the Grafana Visualization:
Links: