Does anyone know if its possible or have specific examples where a source is actually an online resource for grabbing weather data like temp humidity etc…
The use case I have is currently I have built a temp and humidity devise for monitoring the inside of my plane hanger that send data to Ubidots. Instead of adding additional censors to also monitor outside temp and humidity I’m wondering if its possible to pull this data from an online source like Weather Underground from stations that are reasonably close to my hanger.
The two scenarios I envision is either programmatically including code within my existing code to grab variables from these online sources an embedding their values it into the existing code for sending to Ubidots OR creating a Source with variables within Ubidots as an independent mechanism for grabbing this data from these online sources.
Any examples that can be shared would be great.
I did see this existing thread within the community however not really sure how to proceed. (Sorry Virgin API guy)
Hi @kbnetguy this is a great idea. The best scenario would be to have a server pull the Weather data and then post it to Ubidots. I just made a test using the Weather Underground API and pure shell -so you don’t have to code-. You should be able to replicate this by adding this line to a cron job, say every minute. If you need help setting up the cron job, we can put it in our servers, let us know at support@ubidots.com:
If you run this line every minute using a cron job, it will update your Ubidots variable with the weather of San Francisco. To get Farenheit, change “temp_c” to “temp_f”. To get another city, change “San_Francisco.json” with another name and test the URL in your browser to make sure it’s supported by Weather Underground.
The way this works is:
This line makes a GET request to the Weather API. If there’s an error, it sends it to /dev/null:
which is a “mini-Python-script” to load the JSON object and decode it. Make sure your OS has Python 2.7 at least. Steps 1-3 will throw a simple number (the temperature).
Then we do a POST request to Ubidots, using curl and that number we got:
Thank you so much Ubidots for helping create a really nice solution for ingesting a Wundergorund .JSON file. The solution allows us to write certain data points from the .json file into predefined variables on ubidots. Were able to see local weather in real time on our website. We use it as another source of information prior to wheels up on our local runway.
UPDATE: Thanks to our new addition, Ubidots Plugins, you can pull weather data in just a few clicks. See this article on how to pull data from OpenWeather: