[SOLVED] Adding Weather Data - Life after WeatherUnderground

I am looking at a new service from Particle called Particle Rules Engine - which is a managed implementation of NodeRed. One of my early efforts will be to use this service to add weather data to the hourly data uploads from my devices. I am looking auto using Dark Sky which offers micro-forecasting so I can put a fair bit of (real or imagined?) precision into the data.

So, here is the approach -

  • Particle Rules Engine - Node Red
  • Ubidots Node Red plug-in
  • Dark Sky plug-in
  • An injector to kick off an hourly update

It looks like this:

I have tested this and I can receive the data in Ubidots which looks like this:

So far, so good. Here is where I need some help:

  1. Can the lat and long be added to one of the other values (such as temp) as “context” so I can use the Ubidots map widget?
  2. Some of the data is textual, such as “detail” which is a one word description of the weather. How can I capture this. Context again?

Even for folks that don’t use Particle, this approach using Node Red seems like a very useful way to add weather context to Ubidots data.

If there is a better way of doing this, I am all ears.

Greetings @chipmc, answering your questions:

Can the lat and long be added to one of the other values (such as temp) as “context” so I can use the Ubidots map widget?

Yes, if you send your coordinates to another variable different to position, you must set the variable to retrieve coordinates values from at the device view:

With this, you will not have issues when you attempt to create widgets.

Some of the data is textual, such as “detail” which is a one word description of the weather. How can I capture this. Context again?

Yes, you should use the context, please refer an example here

All the best

OK, so it looks like I need to do a little more work in Node Red.

  1. I need to take the JSON payload from Dark Sky and pare it down to just the data points I want.
  2. I need to pick a “key” numeric variable - such as Temp and - using Node Red and a little JavaScript - add the latitude and longitude as “context”. The map widget will then key off that variable
  3. As I also want that detail descriptions which is text, I need to select another numeric variable - such as Humidity - and add the description as context there too.

Thank you for the link and the suggestions. I will keep you all posted on my progress.

Please know that the Ubidots NodeRed plugin-in is valued.

Thanks, Chip

Hi @chipmc, thanks for your comments. Let us to know your project advance and if any assistance is required, just let me here or in the embeded chat a note and we will be glad to help you as much as we can.

All the best

1 Like

UPDATE: Hi @chipmc, thanks to our new addition, Ubidots Plugins, you can now pull weather data in just a few clicks. As we alll know, DarkSky was acquired and not accepting further API usage, but see this article on how to pull data from OpenWeather:

If you have any suggestions as to which other weather API to implement, just let us know and we’ll create a new plugin.

@jotathebest,

I am now using the OpenWeather data and I love this new service. Thank you!

One suggestion, it would be very cool to have a custom widget for the dashboard that would take the “weather code” and convert it to an icon as described here.

https://openweathermap.org/weather-conditions

Perhaps this can be done using a webhook?

Thanks,

Chip

Very glad you asked! the new version of the OpenWeather plugin is sending the “weather code” and its metadata to a new variable:

You can then use this data in a “Metric widget” to achieve the desired outcome:

This is achieved by using the “HTML editor” of the Metric widget, and accessing the “context” of the “weather code” variable:

Here’s the code for the metric widget:

<img src="{{context.icon_url}}">
<p style="font-size: 4rem; font-weight: bolder; line-height: normal; margin: 0;">
  {{context.main}}
</p>
<p style="margin: 0;">{{context.description}}</p>
<p style="margin: 0;">{{timestamp}}</p>

Soon, the Values table widget will also support images, so you should be able to have a historical table of weather icons :slight_smile:

Wow! This is fantastic. Followed your instructions and it worked like a charm! Would be nice if the time of the reading matched the time specified on the dynamic dashboard. Had to use “static” variables to make this work. Love it!

1 Like

Nice dashboard @chipmc!

The metric widget should work just like any other dynamic widget, that it, by inheriting the device selected in the dashboard and use the variable label found in the device. See an animation here where the icon changes depending on the selected device:

Mar-09-2021 21-09-56

This is the setting of the metric widget:
image

Nice but, in my dashboard, I am mixing two devices (the counter and the weather). Can you have a dynamic page with more than one device?

That’s interesting, not yet. Will add a “+1” to an internal feature that will enable this.

1 Like

OK, because, in my opinion, we don’t need a dashboard purely focused on weather - we have many commercial sites that fill this need. What would be very valuable is being able to pull in weather data to provide context for the data coming from a device. Something like, “oh, I see why there were so few pedestrians that day, it was snowing”.

Thank you for entertaining this request.

2 Likes

@chipmc this is a a great point! I completely agree Combining outdoor conditions with sensor data can significantly increase the richness of the data!

1 Like