buienradar van
node-red-contrib-buienradar (node) - Node-RED werkt OK
Je kunt de windrichting goed aangeven in graden (0-360) met windrichtingGR.
Vraag
De windrichting met {{payload.buienradar.windrichting}} heeft een aanduiding nodig in de vorm
N-NE-E-S-SW-W-NW
Is daar iets voor beschreven?
Iets anders dan:
graden-degree to point-compass point /. n-points to degree-degree
Dick
No idea if this is what you are looking for, but I found this with a little Googleing.
var 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";}
}
Check the flow library - Convert wind direction in degrees to Cardinal direction. (flow) - Node-RED
Or a simple function node containing...
const dir = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW", "N" ]
msg.payload = dir[Math.round((msg.payload % 360) / 22.5)];
return msg;
Full demo flow...
[{"id":"fae4aae186e35517","type":"inject","z":"62a0e5a5.fc59bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"11.24","payloadType":"num","x":650,"y":380,"wires":[["5805640b9486c47e"]]},{"id":"047c61d4e8e0c877","type":"inject","z":"62a0e5a5.fc59bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"33.74","payloadType":"num","x":650,"y":480,"wires":[["5805640b9486c47e"]]},{"id":"102a9f98d23bdd3c","type":"inject","z":"62a0e5a5.fc59bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"33.75","payloadType":"num","x":650,"y":540,"wires":[["5805640b9486c47e"]]},{"id":"8844d69f280c2e43","type":"inject","z":"62a0e5a5.fc59bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"56.24","payloadType":"num","x":650,"y":580,"wires":[["5805640b9486c47e"]]},{"id":"5805640b9486c47e","type":"function","z":"62a0e5a5.fc59bc","name":"","func":"const dir = [\"N\", \"NNE\", \"NE\", \"ENE\", \"E\", \"ESE\", \"SE\", \"SSE\", \"S\", \"SSW\", \"SW\", \"WSW\", \"W\", \"WNW\", \"NW\", \"NNW\", \"N\" ]\nmsg.payload = dir[Math.round((msg.payload % 360) / 22.5)];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":860,"y":500,"wires":[["5d92eb51bcdd9dd4"]]},{"id":"5d92eb51bcdd9dd4","type":"debug","z":"62a0e5a5.fc59bc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1030,"y":500,"wires":[]},{"id":"c777f8bd41667972","type":"inject","z":"62a0e5a5.fc59bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"11.25","payloadType":"num","x":650,"y":440,"wires":[["5805640b9486c47e"]]},{"id":"dc86553f83a8c29c","type":"inject","z":"62a0e5a5.fc59bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"348.75","payloadType":"num","x":650,"y":340,"wires":[["5805640b9486c47e"]]},{"id":"25e915f3b430db60","type":"comment","z":"62a0e5a5.fc59bc","name":"In accordance with http://snowfence.umn.edu/Components/winddirectionanddegrees.htm","info":"","x":890,"y":280,"wires":[]},{"id":"b98ca6f5997169e4","type":"inject","z":"62a0e5a5.fc59bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"56.25","payloadType":"num","x":650,"y":640,"wires":[["5805640b9486c47e"]]},{"id":"e667b328ee4ad615","type":"inject","z":"62a0e5a5.fc59bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"78.75","payloadType":"num","x":650,"y":700,"wires":[["5805640b9486c47e"]]},{"id":"1a3ce1c53c909aab","type":"inject","z":"62a0e5a5.fc59bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"101.25","payloadType":"num","x":650,"y":740,"wires":[["5805640b9486c47e"]]},{"id":"224b04bac8344009","type":"inject","z":"62a0e5a5.fc59bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"123.75","payloadType":"num","x":650,"y":780,"wires":[["5805640b9486c47e"]]}]
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
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
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
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â.