Skip to content

voice output example

Dave Conway-Jones edited this page Sep 11, 2013 · 1 revision

#Get Sunrise and Sunset

Uses openweathermap api to get sunrise and sunset times for location passed in.

How-to

  • fires once at startup - or on button press

     [{"id":"8665d1f6.d0466","type":"inject","name":"","topic":"","payload":"Winchester,uk","repeat":"","once":true,"x":107,"y":1295,"wires":[["5edc0711.d26ff8"]]},{"id":"5edc0711.d26ff8","type":"httpget","name":"Get Weather","baseurl":"http://api.openweathermap.org/data/2.5/weather?q=","append":"&units=metric","x":253.9999542236328,"y":1246,"wires":[["ef7a00f6.f9ed5"]]},{"id":"ef7a00f6.f9ed5","type":"function","name":"Sunrise/sunset","func":"\nvar weather = JSON.parse(msg.payload); \nmsg1 = {topic:msg._payload+\"/sunrise\", payload:weather.sys.sunrise};\nmsg2 = {topic:msg._payload+\"/sunset\", payload:weather.sys.sunset};\nreturn [msg1, msg2];","outputs":"2","x":356,"y":1328,"wires":[["df574c39.4ef258"],["df574c39.4ef258"]]},{"id":"df574c39.4ef258","type":"debug","name":"","complete":false,"x":538.0000190734863,"y":1296.9999589920044,"wires":[]}]