Node-red weather services and dashboards

here is a node- red flow for freeboard dashboard ( and others)and some js for it thirdparty plugin that I created for building your own weather dashboard. you can build 7 day forecast easily enough.

you can use the wu plugin for node-red but it sort of sucks and with a free sub it will get you ban for 24s easily as it make request too often , and the info kind of on the sparse side

node-red flow wu to freeboard.txt (1.1 KB)
just import flow into node-red

it not necessary to use weatherunderground you can use any provider that that provides a json string… i use because it provides a icon url for conditions…

freeboard thirdparty plugins
textwrap.js — provides a text box where the information wraps inside the box
text2.js — allow to it input two data sources into one box
and icon.js - just downloads images at icon size
freeboard-plugins.zip (5.2 KB)

1 Like

in case someone is lost how to install in freeboard , same as installing any third party js for freeboard copy *.js to the third party plugin folder in freeboard
then edit the index.html of freeboard to include the newly installed scripts. ie

     <script type="text/javascript">
    head.js("js/freeboard_plugins.min.js",
             "plugins/thirdparty/icon.js",
              'plugins/thirdparty/plugin_highcharts.js',
               "plugins/thirdparty/index.js",
               "plugins/thirdparty/text2.js",
               "plugins/thirdparty/textwrap.js",

then in freeboard add the datasource for forecast and conditions
if you called forecast WF and conditions WC in freeboard
to bring up the icon for the weather it would look something like this when you add the data source to your icon widget ( freeboard will help you somewhat locate it in the json string)

and the datasource for textwrap to display the days forecast
datasources[“wf”][“forecast”][“txt_forecast”][“forecastday”][0][“fcttext_metric”]

then for live weather up date just use WC for example current temp outside in Celsius and Fahrenheit
datasources[“wc”][“current_observation”][“temp_c”]
datasources[“wc”][“current_observation”][“temp_f”]

you do not have to use the node-red flow listed above and can simple install this in the json widget
http://api.wunderground.com/api/yourapikey/forecast/q/yourcountry/yourcity.json

http://api.wunderground.com/api/yourapikey/conditions/q/yourcountry/yourcity.json
and it will work equally as well BUT if you open multiple pages or refresh your page often, you can exceed the 10 time per minute 500 time per day limit

Nice Stephen

I’m not a fan of WU’s weather icons though, they always look a little scrappy around the edges, so I’ve done some development on a set of weather icons which are in a compatible format to Font Awsome, so that they play nicely with node-red, and can be resized, rotated or coloured via css.

Not sure how they would integrate with freeboard though.

Paul

2 Likes

how do you load yours in node-red for your weather and I will see of well they I can integrate in freeboard

I’ve described an example in the repo readme - GitHub - Paul-Reed/weather-icons: Node-red weather icons

Paul

Also… you may wish to update your api url that retrieves the conditions.

If you use the api url as described in the WU guide (and your flow), you will not get nighttime icons, such as the one shown in my screenshot above.

There is a version 11 of the api available (which isn’t documented) that prefixes nighttime icons with nt_ so that nighttime icons can be displayed.

An example api url would be http://api.wunderground.com/api/myapikey/conditions_v11/q/EGCN.json

I’ve added the corresponding WU nighttime icons to the css in my repo.

Hope this is helpful.

Paul

i get the current day and night conditions and the condition for the next 7days – currently my condition is nt_snow but i am not getting any display in dashboard ui I tried just inserting a base condition manually such as just snow or day_sunny but still no luck not sure where i went wrong. but currently it seams not to be working for me in dashboard ui

Here’s an example flow…

Firstly, as per the repo read.me create your NR static directory & git clone the icon files;
cd && cd .node-red mkdir public cd public git clone https://github.com/Paul-Reed/weather-icons.git

Now add your static directory to your NR settings file;

cd && cd .node-red nano settings.js

Then finally copy and import the attached example flow.

Paul
example flow.txt (1.5 KB)

NOTE, creating the static directory and loading it via the settings file might seem a bit of a pain just for a few weather icons, but once created, it can be used for many other things too in NR, such as loading other scripts, your own css, or even to hold images to display in your dashboards.

humm??

still does not work for me.
I even deleted everything and built fresh still nothing
all I get is this

I drop an image in the folder to see if I can bring it up. does not seam to work either
ie 192.168.168.13:1880/image.jpg all I get is “can not get” so it does not seam to to be open to port ( maybe it only open internally)
but if I stick in freeboard ie:
192.168.168.13:1880/freeboard/image.jpg it displays fine

also within dashboard ui: ( template)
if is use img src="/freeboard/image.png" it works fine
but img src=“image.png” will not

something still seams missing: ( i restarted node-red too)

If I drop an image into the /home/pi/.node-red/public directory and then go to https://192.168.1.10:8443/minion.jpg - I see the image in my browser.

Also, if I put <img style="width: 100%" ng-src="/minion.jpg"> then I see;

Just reading the notes on setting up a static directory, it say’s;

httpStatic - a local directory from which to serve static web content from. This content is served from the top level url, /.
When this property is used, httpAdminRoot must also be used to make editor UI available at a path other than /.

So if you edit settings.js
httpAdminRoot: '/admin',
Then after a restart you would access your flows editor at the URL 192.168.168.13:1880/admin
and leave 192.168.168.13:1880/ free for any static content.

(I’d already done this to stop outsiders guessing my node-red URL)

Can you try that Stephen please.

Paul

humm still does not work. maybe since I am working from a basic raspberry image on an actual raspberry pi ( not my orangepi so it should be identical to what you are working with) and I think you are working with oem pi image. maybe there are other setting enabled that you were unaware of .
because i see my public folder exist on the pi - as if i enable authentication on the httpstatic and then try to access it . a log in dialogue pops up… it just does not serve anything for some strange reason …
are you willing to send me a copy of your setting.js just so I can compare the differences

I’ve PM’d you with it.

I’m not using the emoncms Pi image, my system was built from scratch with Jessie which has node-red pre-installed, so it’s pretty much a out-of-the-box default installation on a raspberry pi.

Static directories are a standard function in node-red which are used regularly for various things, so I’m at a loss why you are having these problems.

Maybe ask the experts in the node-red slack channel

Paul

okay i load node-red into a virtual machine. did the same above and it works fine. but with in this virtual machine i can not seam to install freeboard. all i get is errors for the freeboard

maybe my node.js or node-red is too current on the virtual machine – as the raspberry pi versions are significantly older then the ones on the virtualmachine

but it looks like perhaps freeboard is preventing the install of a static folder-- i will reflash my sd again and install clean with out freeboard and try again - and if it work s then try installing freeboard afterwards and see if it breaks it

You could always ask in the node-red slack board about Freeboard compatibility. I’m sure others there are using it too.

The node-red dashboard project is developing fast and to a high standard, so I’ve decided to use that instead of third party dashboards.
I’ve not yet finished the weather dashboard, but emoncms supplies the power data via MQTT.

Paul

2 Likes

Shouldn’t your “Home Usage Today, Power Generated Today” and “Power Diverted Today” units be kWh vice kW?

If you’re going to be like that, Bill, I’ll join in. :grinning:

I was thinking of switching to dashboard ui but i see it has issues to the graphing module, it seams to have a memory leak of some form. as i was building a 15 inch touch screen display from an old laptop screen that is connecting to my orange pi then place it on my wall to display the info continuously - but usually after an hour of displaying info then it starts getting errors and continues to pop script error dialogs . and the system slows right down to a stand still almost. then you restart and it good again for another hour… with freeboard I do not have that issue. i think it related to the 3 inputs into my graph they come different speeds. and the dashboard graph does not tolerate that very well . where as freeboard does not mind it

Ha ha, thanks guys, yes now sorted!

@stephen the memory leak issue has now been sorted as node-red now uses chartjs instead - see Reimplementation of the chart node using angular-chart.js (#95) · node-red/node-red-dashboard@e685c39 · GitHub

The main current chart gripe is that you are limited to about 1500 points per chart, otherwise it starts to get bogged down.
The timing of the data shouldn’t really be a problem, because the data is stored in a JSON string together with the datapoint epoch.

There are benefits and disadvantages for both systems, and I suppose it comes down to personal choice.

Paul

Yep, guilty as charged. I’ve got to stop doin’ things half-way!

humm ???
another strange problem I ran into/ on my virtual machine when I do a git of weather-icons
i get this-
( the index.png was my test image)
but when i do a git on a pi - sorry minimal install so no graphical interface
I only get these folders or should i say this folder

and this was how it was on my other pi flash ( but with was a full install) only this single folder