Possible node-red-node-forecastio issue?!?

93 views
Skip to first unread message

Jon Murphy

unread,
Aug 27, 2016, 10:14:39 PM8/27/16
to Node-RED
I downloaded and installed node-red-node-forecastio last night and I am getting some odd data from one of the two nodes.

If I use the forecastio in node (polls forecast.io every 5 minutes) the data within msg.data.currently comes back as expected.  But if I use the forecastio node (polls forecast.io for weather forecast data when an input is received) then the data within msg.data.currently is wrong.  I did not check the other areas within msg.data since I was only looking for current data at this time.

Both forecastio nodes have the same settings:
  • Forecast = Tomorrow
  • Latitude = set correctly for both nodes
  • Longitude = set correctly for both nodes
  • Units = us imperial
 
If I use https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE then I received the correct data also. 

Thoughts of what I should be doing different?

Thank you!   Jon

Dave C-J

unread,
Aug 28, 2016, 3:20:37 AM8/28/16
to node...@googlegroups.com

Can you paste example of the wrong (and corresponding right) data ?

Jon Murphy

unread,
Aug 28, 2016, 11:11:36 AM8/28/16
to Node-RED

is this OK?  The info on the left side is correct.

Mark Setrem

unread,
Aug 28, 2016, 12:57:13 PM8/28/16
to Node-RED
It's returning data for a different location as the sunrise/sunset times are different.
Which would suggest that the lat long is different or formatting is different, either unintentionally or within the nodes code.

Perhaps you could try setting the location to somewhere that isn't private eg a major city and then check to see if the data returned is still different and if it is, then publish your flow to see if other set of eyes can see a difference in the formatting.

Jon Murphy

unread,
Aug 28, 2016, 1:39:30 PM8/28/16
to Node-RED
Here is the data for a quaint little town nearby.

The forcast.io.full.injectpoll.log file is for the forecastio node (polls forecast.io for weather forecast data when an input is received) 

The forcast.io.full.5minpoll.log file is for the forecastio node (polls forecast.io for weather forecast data when an input is received)

The https-api.forecast.io-forecast-APIKey-41.8781--87.6298.txt file is entering https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE into a web browser.
2016-08-28 at 12-12-31 - forcast.io.full.injectpoll.log
2016-08-28 at 12-12-10 - forcast.io.full.5minpoll.log
https-api.forecast.io-forecast-APIKey-41.8781--87.6298.txt

Jon Murphy

unread,
Aug 28, 2016, 1:47:57 PM8/28/16
to Node-RED
Here is the flow:



[{"id":"61d6c670.9e2938","type":"subflow","name":"timestamp log","info":"need **msg.filename** with path\n\nexample:  \nmsg.filename = \"/home/pi/data/myLog.log\";","in":[{"x":240,"y":180,"wires":[{"id":"af1e5541.50e1a8"}]}],"out":[{"x":520,"y":200,"wires":[{"id":"af1e5541.50e1a8","port":0}]}]},{"id":"af1e5541.50e1a8","type":"function","z":"61d6c670.9e2938","name":"","func":"if ((!msg.payload) || (!msg.filename)) { return; }\n\nvar now = new Date();\nmsg.payload = now.toString() + \"\\t\" + now.valueOf() + \"\\t\" + msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":180,"wires":[["3a8db34c.c5724c"]]},{"id":"3a8db34c.c5724c","type":"file","z":"61d6c670.9e2938","name":"","filename":"","appendNewline":true,"createDir":true,"overwriteFile":"false","x":550,"y":140,"wires":[]},{"id":"86e0599e.791fa8","type":"debug","z":"478f9c1e.b87064","name":"5 min fio","active":false,"console":"false","complete":"true","x":680,"y":140,"wires":[]},{"id":"e0f31ba.f1f0ce8","type":"forecastio","z":"478f9c1e.b87064","forecastio":"","name":"","lon":"-87.6298","lat":"41.8781","date":"","time":"","mode":"node","units":"us","x":250,"y":80,"wires":[["4c485fce.b3b7a","7a5e163.f85a1e8"]]},{"id":"4aaabf43.b5554","type":"inject","z":"478f9c1e.b87064","name":"","topic":"","payload":"","payloadType":"str","repeat":"300","crontab":"","once":false,"x":90,"y":80,"wires":[["e0f31ba.f1f0ce8"]]},{"id":"419b4e76.be64b","type":"subflow:61d6c670.9e2938","z":"478f9c1e.b87064","name":"","x":700,"y":200,"wires":[["a1c54777.5e3ab8"]]},{"id":"168bbba9.e97444","type":"function","z":"478f9c1e.b87064","name":"","func":"msg.filename = \"/home/pi/data/forcast.io.full.5minpoll.log\";\nmsg.payload = \"\\n\" + JSON.stringify(msg, null, 4) + \"\\n\";\nreturn msg;\n","outputs":1,"noerr":0,"x":470,"y":180,"wires":[["419b4e76.be64b"]]},{"id":"ac25f974.53da08","type":"forecastio in","z":"478f9c1e.b87064","forecastio":"","name":"","key":"","lon":"-87.6298","lat":"41.8781","date":"","time":"","units":"us","x":260,"y":140,"wires":[["168bbba9.e97444","86e0599e.791fa8"]]},{"id":"4c485fce.b3b7a","type":"debug","z":"478f9c1e.b87064","name":"fio with inject","active":false,"console":"false","complete":"true","x":690,"y":80,"wires":[]},{"id":"7a5e163.f85a1e8","type":"function","z":"478f9c1e.b87064","name":"","func":"msg.filename = \"/home/pi/data/forcast.io.full.injectpoll.log\";\nmsg.payload = \"\\n\" + JSON.stringify(msg, null, 4) + \"\\n\";\nreturn msg;\n","outputs":1,"noerr":0,"x":470,"y":120,"wires":[["419b4e76.be64b"]]},{"id":"a1c54777.5e3ab8","type":"debug","z":"478f9c1e.b87064","name":"log output","active":true,"console":"false","complete":"payload","x":800,"y":320,"wires":[]}]

Dave C-J

unread,
Aug 28, 2016, 6:36:30 PM8/28/16
to node...@googlegroups.com
Hi Jon,

yes I think there may be a slight wrinkle... let me dig a bit. Thanks for finding it !

Dave C-J

unread,
Aug 28, 2016, 6:49:43 PM8/28/16
to node...@googlegroups.com
Ah yes - one was asking for the forecast and one was asking for the historical conditions for "now" ... different API calls - which for some reason give differing results for what should be the same time... maybe the historical is a bit more "smoothed" over an area ?
I don't know... just hypothesising... but now using the same by default. 
Version 0.1.9 on npm

Jon Murphy

unread,
Aug 29, 2016, 3:12:41 PM8/29/16
to Node-RED
Dave - installed 0.1.9 last night and let it run overnight.  Tried both nodes and all works A-OK! 

FYI - I did not try the Time Machine or historical weather via dates in the past.  I only did an inject with a timestamp (the current time).

Thank you!  Jon

Paul Reed

unread,
Aug 29, 2016, 4:09:55 PM8/29/16
to Node-RED
Jon, are you sure it's retrieving the current weather conditions when you inject the current timestamp?
I'm doing the same, and it doesn't matter what epoch I use, it still retrieves tomorrows data. The flow was working OK until I updated to v0.1.9 earlier today.

ie, instead of injecting the timestamp, try injecting 1472680800000 (10pm 31st Aug 2016) and see if the result is the same.

Paul 

Toshi Bass

unread,
Aug 29, 2016, 4:12:13 PM8/29/16
to Node-RED
Since updateing to 0.1.9 forcastiio does not work correctly see last two posts here https://groups.google.com/d/msg/node-red/W5kWPG555OQ/IMbpj2VTAwAJ

Jon Murphy

unread,
Aug 29, 2016, 4:17:25 PM8/29/16
to Node-RED
Here is my test from last night (I didn't save today's test).  So "yes".  But I'll give it another test.
Screen Shot 2016-08-28 at 7.47.49 PM.png

Jon Murphy

unread,
Aug 29, 2016, 5:02:22 PM8/29/16
to Node-RED

here is a quick test using the current time.  The far right results are via  https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE and are about 5 minutes later than the other two.



I'll test with 1472680800000 (10pm 31st Aug 2016) - I read thru your post too quick and didn't see the future time test.




Jon Murphy

unread,
Aug 29, 2016, 5:13:33 PM8/29/16
to Node-RED
 test with inject set to 1472680800000.

from your comments above you were looking at just the current data? -  msg.data.currently




Paul Reed

unread,
Aug 29, 2016, 5:25:10 PM8/29/16
to Node-RED
I'm struggling reading the data on my tablet, but isn't it retrieving exactly the same data injecting 1472680800000 as injecting the current timestamp?
Exactly same temperature, etc.

Jon Murphy

unread,
Aug 29, 2016, 5:31:02 PM8/29/16
to Node-RED
That sounds like the issue I was having with v0.1.8 and current data (msg.data.currently).  My temp was off by 3-5º and humidity was wrong by 3-5% with v0.1.8.  

Even now (using v0.1.9) the numbers aren't exact, but they are only off the 0.01 to 0.1 degrees.  I just guessed forecast io was recalculating numbers between my requests.

Jon Murphy

unread,
Aug 29, 2016, 6:24:55 PM8/29/16
to Node-RED


Sorry to add more confusion, but if I type in: 
for 10pm 31st Aug 2016 UTC and then I type in:
for epoch right now then the current data (msg.data.currently) is different.


Screen Shot 2016-08-29 at 5.12.44 PM.png
Reply all
Reply to author
Forward
0 new messages