[{"id":"56b83b7bec2eff35","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"2aa6c7d0d6c34c69","type":"http request","z":"56b83b7bec2eff35","name":"Api Trajet Les Andelys","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://api.mapbox.com/directions/v5/mapbox/driving-traffic/42.586364, 2.370217;01.41859,49.24665?access_token=pk.eyJ1IjoianVtb3JlYXVqdSIsImEiOiJjbDA3Y2g3OGUwMzhmM29xMGR2OGJocHJwIn0.VYT4Y8Hd_of5tKXqluVjng","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":380,"y":220,"wires":[["902eeb605ce660fd","d35d5f8df3edeeea"]]},{"id":"6ea28c57b0da3a95","type":"inject","z":"56b83b7bec2eff35","name":"Toutes les heures","props":[{"p":"payload"}],"repeat":"3600","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":220,"wires":[["2aa6c7d0d6c34c69"]]},{"id":"902eeb605ce660fd","type":"debug","z":"56b83b7bec2eff35","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":590,"y":280,"wires":[]},{"id":"da8870c4b442b262","type":"mqtt out","z":"56b83b7bec2eff35","name":"Trajet Les Andelys","topic":"gladys/master/device/mqtt:les-andelys/feature/mqtt:les-andelys/state","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"b43615cb2732e077","x":950,"y":220,"wires":[]},{"id":"9a4c9dd06fabf7df","type":"debug","z":"56b83b7bec2eff35","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":890,"y":280,"wires":[]},{"id":"d35d5f8df3edeeea","type":"json","z":"56b83b7bec2eff35","name":"","property":"payload","action":"obj","pretty":false,"x":570,"y":220,"wires":[["4e6f68ad1abebbb4"]]},{"id":"4e6f68ad1abebbb4","type":"function","z":"56b83b7bec2eff35","name":"duration","func":"var duration=msg.payload.routes[0].duration;\n\n// transforme en nombre\nduration = parseFloat(duration);\n\n// convertit en hh:mn:ss\nvar temps=new Date();\ntemps.setTime(duration*1000);\nmsg.payload = (temps.getHours()-1) + \":\" + temps.getMinutes() + \":\" + temps.getSeconds();\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":720,"y":220,"wires":[["9a4c9dd06fabf7df","da8870c4b442b262"]]},{"id":"b43615cb2732e077","type":"mqtt-broker","name":"","broker":"mqtt://localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]
tu fais un import dans un flow, tu charge ton access token et t’auras en sortie en hh:mm:ss