Buienradar - windrichting

Bart,
bedankt voor de info.
Zoals ik schreef in de vraag is daar een manier voor die werkt maar ik krijg dan de vermelding niet op het scherm bij de cirkel van het diagram.
Ik zoek een andere oplossing
Een afbeelding met die aanduidingen N-E enz al in de afbeelding.
Dick

I am confused about your issue... are you looking for something like a dashboard display?

Thanks

The display is good, but now i am looking for an integration in node-red/gauge/

Dick

Verzonden vanuit Mail voor Windows

I still don't understand what you are asking from us? That display I showed IS a custom gauge in node-red

@dick I see you have another topic about collecting weather data... with equally confusing details...

Are you looking to make some form of display or have you already got one and want to add details like the wind compass?

I made this one from OpenWeatherMap Weather Dashboard with Icons - Landscape (flow) - Node-RED, and later added in my compass. I pull the weather data from Weather API - OpenWeatherMap

1 Like

the custom display in node-red is without the markering e ,s,w etc.

the display you mentioned is not that i can find in NR.
thanks for your efforts.
Dick

Gunner,
thanks
My purpose at this moment is to integrate my OWN data (a string of values, transformed to excel as a
possibility) When i get this data in NR, than comes the question how to do that?
Is it possible to get a string of data into NR?
Dick

It is a custom gauge based on Canvas. There have been a few recent topics about these such gauges and their various libraries.

You may have to install the canvas library in your node-red static folder... similar to how I did in this post


Here is two examples of the same "gauge" with changes to size, colours, tick marks etc. The script source path assumes node-red's settings.js path is at /home/pi/node-red-static/ and the folder containing the library is called Canvas-Gauges but you can make it however you want and edit the path accordingly.

[{"id":"c09d075d66e41467","type":"random","z":"8c7dfd6121113522","name":"","low":"0","high":"360","inte":"true","property":"payload","x":340,"y":460,"wires":[["9dac9baa9ffe467e","0e36bebef61b9bec","d21356027fdc21f8"]]},{"id":"9dac9baa9ffe467e","type":"ui_template","z":"8c7dfd6121113522","group":"a86601a0d85e8a94","name":"Compass","order":1,"width":10,"height":8,"format":"<div style=\"margin:auto\">\n    \n<script src=\"/Canvas-Gauges/gauge.min.js\"></script>\n\n<canvas data-type=\"radial-gauge\"\n    data-width=\"350\"\n    data-height=\"350\"\n    data-min-value=\"0\"\n    data-max-value=\"360\"\n    data-major-ticks=\"N,NE,E,SE,S,SW,W,NW,N\"\n    data-minor-ticks=\"22\"\n    data-ticks-angle=\"360\"\n    data-start-angle=\"180\"\n    data-stroke-ticks=\"false\"\n    data-highlights=\"false\"\n    data-color-plate=\"#222\"\n    data-color-major-ticks=\"#f5f5f5\"\n    data-color-minor-ticks=\"#ddd\"\n    data-color-numbers=\"#ccc\"\n    data-color-needle=\"rgba(240, 128, 128, 1)\"\n    data-color-needle-end=\"rgba(255, 160, 122, .9)\"\n    data-value-box=\"false\"\n    data-value-Dec=\"0\" \n    data-value-text-shadow=\"false\"\n    data-color-circle-inner=\"#fff\"\n    data-color-needle-circle-outer=\"#ccc\"\n    data-needle-circle-size=\"15\"\n    data-needle-circle-outer=\"false\"\n    data-animation-rule=\"linear\"\n    data-needle-type=\"line\"\n    data-needle-start=\"70\"\n    data-needle-end=\"99\"\n    data-needle-width=\"3\"\n    data-borders=\"true\"\n    data-border-inner-width=\"0\"\n    data-border-middle-width=\"0\"\n    data-border-outer-width=\"10\"\n    data-color-border-outer=\"#ccc\"\n    data-color-border-outer-end=\"#ccc\"\n    data-color-needle-shadow-down=\"#222\"\n    data-border-shadow-width=\"0\"\n    data-animation-duration=\"1000\"\n    data-value={{msg.payload}}\n></canvas>\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":660,"y":440,"wires":[[]]},{"id":"0e36bebef61b9bec","type":"ui_text","z":"8c7dfd6121113522","group":"a86601a0d85e8a94","order":2,"width":0,"height":0,"name":"","label":"Degrees","format":"{{msg.payload}}","layout":"col-center","x":660,"y":480,"wires":[]},{"id":"d21356027fdc21f8","type":"ui_template","z":"8c7dfd6121113522","group":"a86601a0d85e8a94","name":"Small Compass","order":3,"width":10,"height":3,"format":"<div style=\"margin:auto\">\n    \n<script src=\"/Canvas-Gauges/gauge.min.js\"></script>\n\n<canvas data-type=\"radial-gauge\"\n    data-width=\"140\"\n    data-height=\"140\"\n    data-min-value=\"0\"\n    data-max-value=\"360\"\n    data-major-ticks=\"N,NE,E,SE,S,SW,W,NW,N\"\n    data-font-Numbers-Size=\"28\"\n    data-minor-ticks=\"4\"\n    data-ticks-angle=\"360\"\n    data-start-angle=\"180\"\n    data-stroke-ticks=\"false\"\n    data-highlights=\"false\"\n    data-color-plate=\"#333333\"\n    data-color-major-ticks=\"lightblue\"\n    data-color-minor-ticks=\"lightgrey\"\n    data-color-numbers=\"cyan\"\n    data-color-needle=\"rgba(240, 128, 128, 1)\"\n    data-color-needle-end=\"rgba(255, 160, 122, .9)\"\n    data-value-box=\"false\"\n    data-value-Dec=\"0\" \n    data-value-text-shadow=\"false\"\n    data-color-circle-inner=\"#fff\"\n    data-color-needle-circle-outer=\"#ccc\"\n    data-needle-circle-size=\"5\"\n    data-needle-circle-outer=\"false\"\n    data-animation-rule=\"linear\"\n    data-needle-type=\"line\"\n    data-needle-start=\"70\"\n    data-needle-end=\"99\"\n    data-needle-width=\"3\"\n    data-borders=\"true\"\n    data-border-inner-width=\"0\"\n    data-border-middle-width=\"0\"\n    data-border-outer-width=\"2\"\n    data-color-border-outer=\"#ccc\"\n    data-color-border-outer-end=\"#ccc\"\n    data-color-needle-shadow-down=\"#222\"\n    data-border-shadow-width=\"0\"\n    data-animation-duration=\"1000\"\n    data-value={{msg.payload}}\n></canvas>\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":680,"y":540,"wires":[[]]},{"id":"5c83c1e35c72d6e6","type":"inject","z":"8c7dfd6121113522","name":"","props":[{"p":"payload"}],"repeat":"3","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":110,"y":320,"wires":[["01183e3a5d78bff9","0c8a61b04dc5fd5a","3309ec3494dbae53","5d6c7e51cc1523bf","ab02a775fe61480c","637cc3cb57087783","4d92bd212b2e6b74","9851b92096c23aec","a7cecd63f040a432","c09d075d66e41467"]]},{"id":"a86601a0d85e8a94","type":"ui_group","name":"Compass","tab":"2deac665c2e9da53","order":9,"disp":true,"width":10,"collapse":false},{"id":"2deac665c2e9da53","type":"ui_tab","name":"Gauges Galore","icon":"data_usage","disabled":false,"hidden":false}]

As stated in that other topic... there should be no need to get Excel involved, but you do need to provide clear details about where you are getting your data, and how it looks "natively" from the source.

These gauges (as do most) assume data as a number (in this case degrees 0-360), but just as it is possible to convert from number to cardinal, one can go the other way... See here (as posted above by @BartButenaers): node-red-contrib-compass (node) - Node-RED

But again... all depends on the source and type of your data and then what exactly you want to do with it.

Gunner,
I run yous advice
withsettings.js path is at /home/pi/node-red-static/
etc
But i cannot find
settings.js So it one a file without data
How do I fill that settings.js?

Dick

settings.js should be in /home/pi/.node-red (note the period)

Inside it is a parameter ‘node-red-static’ that you can set to point at a folder for static data

https://nodered.org/docs/user-guide/runtime/settings-file

The location of settings.js should be in /var/log/syslog.
In a terminal run tail -f /var/log/syslog
In another sudo systemctl restart nodered
Then after a couple of seconds, in the first terminal CTRL c to stop the output.

You should get something like this

Aug 20 18:29:00 GlassPi Node-RED[14438]: 20 Aug 18:29:00 - [info] Node-RED version: v2.0.5
Aug 20 18:29:00 GlassPi Node-RED[14438]: 20 Aug 18:29:00 - [info] Node.js  version: v12.22.5
Aug 20 18:29:00 GlassPi Node-RED[14438]: 20 Aug 18:29:00 - [info] Linux 5.10.52-v7l+ arm LE
Aug 20 18:29:00 GlassPi Node-RED[14438]: 20 Aug 18:29:00 - [info] Loading palette nodes
Aug 20 18:29:02 GlassPi Node-RED[14438]: 20 Aug 18:29:02 - [info] Dashboard version 2.30.0 started at /ui
Aug 20 18:29:03 GlassPi Node-RED[14438]: 20 Aug 18:29:03 - [info] Settings file  : /home/pi/.node-red/settings.js
Aug 20 18:29:03 GlassPi Node-RED[14438]: 20 Aug 18:29:03 - [info] HTTP Static    : /home/pi/.node-red/node-red-static

Zenofmud and other persons who give me advice
Thanks for that inf
Especially to the person who writes the info on
(Another gauge.js library - #17 by Gunner)
those infi is sublime
and should be posted on Canvas-Gauges website/homepage.
THANKS

Dick

Don’t trust anything on google.
Because in this case when deg=191.25 it will return “N”. :grin:

image

Good catch @guidoleijten ... Yep... a closer look at the function shows greater than num.dec and less than num.dec which leaves all exact num.dec to fall through as N

This explains the occasional glitch I have been seeing... one I had attributed to browser refresh or something interrupting the 10 minute update cycle I use.

A simple tweak changing the rest of the < symbols to <= corrected that.

As was in the initial beginning of the function

image

"New and Improved... Now with 99% more = " :stuck_out_tongue:

let degreesToCardinal = function(deg){
  if (deg>11.25 && deg<=33.75){return "NNE";}
  else if (deg>33.75 && deg<=56.25){return "NE";}
  else if (deg>56.25 && deg<=78.75){return "ENE";}
  else if (deg>78.75 && deg<=101.25){return "E";}
  else if (deg>101.25 && deg<=123.75){return "ESE";}
  else if (deg>123.75 && deg<=146.25){return "SE";}
  else if (deg>146.25 && deg<=168.75){return "SSE";}
  else if (deg>168.75 && deg<=191.25){return "S";}
  else if (deg>191.25 && deg<=213.75){return "SSW";}
  else if (deg>213.75 && deg<=236.25){return "SW";}
  else if (deg>236.25 && deg<=258.75){return "WSW";}
  else if (deg>258.75 && deg<=281.25){return "W";}
  else if (deg>281.25 && deg<=303.75){return "WNW";}
  else if (deg>303.75 && deg<=326.25){return "NW";}
  else if (deg>326.25 && deg<=348.75){return "NNW";}
  else {return "N";}
}

With a bit Math may be simpler

function degToCompass(num) {
    var val = Math.floor((num / 22.5) + 0.5);
    var arr = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"];
    return arr[(val % 16)];
}
1 Like

Great minds think alike..

Yes, unfortunately Math and I do not compute :stuck_out_tongue: So I tend to just grab what I can find and shoehorn it into my code :innocent:

Eventually I tweak my stuff as I get a better understanding of the improvements offered. Thanks :smiley:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.