Retrieve the maximum temperature values for each month of the year

first question :
because this way, on my screen, I can choose the color as well as the size in px

second question:
If you want to display the whole year in a table, why not use the ui_table node?

If you want ! keep it simple, I'll be fine with it

thank you

In that case, use a seperate ui_template for that screen item - I'd also add a timer to clear the message after a minute or two.

As for displaying the table, you could display the entire table at once, no need to have a ui_template name for each month. You can even change color of the items in the table. Here is a screen shot of one of my projects using a ui_template:

You can get quite complex (my CSS is rusty) in what you build.

But for starting off, try the ui_table and once you get the flow working properly, then take the next step to make it more interesting.

yes indeed!
it's very good (beyond my skills)
but for the moment I have nothing in output!

it does not work ? ? ?
and I don't understand where it came from!
I can't seem to get the max values ​​out of each month.
I despair ! I've been there for almost 10/15 hours!
I am looking on the internet but nothing, and the worst is that there is nothing in French!

Try this flow:

[{"id":"19aa0743.f60b49","type":"inject","z":"312653fb.4d179c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":80,"wires":[["1eabff5f.9d5be1"]]},{"id":"db0a5e0c.143ce8","type":"debug","z":"312653fb.4d179c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":730,"y":260,"wires":[]},{"id":"1eabff5f.9d5be1","type":"function","z":"312653fb.4d179c","name":"reset high temp for year","func":"var theYear = {}\ntheYear = [\n    {\"mName\": \"Janvier\", \"hiTemp\":0},\n    {\"mName\": \"Feb\", \"hiTemp\":0},\n    {\"mName\": \"Mar\", \"hiTemp\":0},\n    {\"mName\": \"Apr\", \"hiTemp\":0},\n    {\"mName\": \"May\", \"hiTemp\":0},\n    {\"mName\": \"Jun\", \"hiTemp\":0},\n    {\"mName\": \"Jul\", \"hiTemp\":0},\n    {\"mName\": \"Aug\", \"hiTemp\":0},\n    {\"mName\": \"Sep\", \"hiTemp\":0},\n    {\"mName\": \"Oct\", \"hiTemp\":0},\n    {\"mName\": \"Novembre\", \"hiTemp\":0},\n    {\"mName\": \"Décembre\", \"hiTemp\":0}\n    ]\n\nflow.set(\"theYear\",theYear)\nmsg.payload = \"Réinitialisation de la température élevée pour tous les mois\"\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":350,"y":80,"wires":[["ec7bced8.c07928"]]},{"id":"7398cc08.0cd16c","type":"inject","z":"312653fb.4d179c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"valeur","payload":"5","payloadType":"num","x":130,"y":260,"wires":[["35e124a8.bf9044"]]},{"id":"ad2855c1.17652","type":"function","z":"312653fb.4d179c","name":"valeurs max","func":"var theYear = flow.get(\"theYear\") || {};\n//node.warn(theYear)\n\n//get current month\nvar d = new Date();\nvar m = d.getMonth();\n//node.warn(m)\n//node.warn(theYear)\n//node.warn(theYear[m])\nvar mthHigh = theYear[m].hiTemp  \n\nif (mthHigh < msg.payload) {\n    mthHigh = msg.payload\n    theYear[m].hiTemp = mthHigh\n    flow.set(\"theYear\",theYear)\n    msg.payload = \"month: \" + (m+1) +\" val max: \"+mthHigh;\n//    msg.payload = \"new high for \" + theYear[m].mName +\" is \"+mthHigh;\n}\n\treturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":260,"wires":[["db0a5e0c.143ce8","a78afa8e.a4e928"]]},{"id":"35e124a8.bf9044","type":"function","z":"312653fb.4d179c","name":"valeur","func":"\nmsg.payload = msg.payload;\nmsg.topic = \"valeur\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":310,"y":260,"wires":[["ad2855c1.17652"]]},{"id":"f339037b.582c98","type":"inject","z":"312653fb.4d179c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"valeur","payload":"15","payloadType":"num","x":140,"y":340,"wires":[["35e124a8.bf9044"]]},{"id":"3c45d3fe.b529b4","type":"inject","z":"312653fb.4d179c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"valeur","payload":"25","payloadType":"num","x":140,"y":400,"wires":[["35e124a8.bf9044"]]},{"id":"c41d0131.ee05b","type":"catch","z":"312653fb.4d179c","name":"","scope":null,"uncaught":false,"x":820,"y":80,"wires":[["e76aaf67.cd931"]]},{"id":"e76aaf67.cd931","type":"debug","z":"312653fb.4d179c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":810,"y":120,"wires":[]},{"id":"fa6c2e1.0149ed","type":"ui_table","z":"312653fb.4d179c","group":"1409ff93.c2dc08","name":"table","order":2,"width":"12","height":"7","columns":[],"outputs":0,"cts":false,"x":490,"y":380,"wires":[]},{"id":"a78afa8e.a4e928","type":"change","z":"312653fb.4d179c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"theYear","tot":"flow"},{"t":"set","p":"payload","pt":"msg","to":"payload[*]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":320,"wires":[["fa6c2e1.0149ed","5ecd8042.fcb138"]]},{"id":"5ecd8042.fcb138","type":"debug","z":"312653fb.4d179c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":320,"wires":[]},{"id":"7c4ce3c2.991784","type":"ui_template","z":"312653fb.4d179c","group":"1409ff93.c2dc08","name":"","order":1,"width":"12","height":"1","format":"<p style=\"font-size:25px; color:red !important;\">{{msg.payload}}</font>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":600,"y":80,"wires":[[]]},{"id":"ec7bced8.c07928","type":"trigger","z":"312653fb.4d179c","name":"","op1":"","op2":" ","op1type":"pay","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":510,"y":160,"wires":[["7c4ce3c2.991784"]]},{"id":"1409ff93.c2dc08","type":"ui_group","name":"Luftfeuchtigkeit","tab":"7378d0b7.f51148","order":4,"disp":false,"width":"12","collapse":false},{"id":"7378d0b7.f51148","type":"ui_tab","name":"Home - paul","icon":"home","order":1,"disabled":false,"hidden":false}]

You should edit the 'reset high temp for year' function node to put in the French names of the months. If you want to change the font size and/or color of the message, check the ui_template node. I've also added a timer to blank out the message after 5 seconds - you can change that.

In the change node you will see I used JSONata to format the data correctly for the table - just accept it works and later you can go learn about JSONata at https://docs.jsonata.org/overview.html

You should also look at the examples for the ui_table. Here is one called 'Richer Table' that displays some of the power of the ui_table
Screen Shot 2020-12-18 at 6.21.42 AM

To get the example tables, click on the 'hamburger' menu at the top right of the editor and pick Import. Then select 'Examples' and scroll down till you you find 'node-red-node-ui-table.

he tells me unknown; ui_table?

which library should I load please?

ok i found it!

1 Like

yes, it works!
Thank you for your patience
it remains for me to understand how it works.
it's not easy !
for me it's another world. . .

I am looking for how to change the name of the months in the table? (there are 3 in French, the others in English)

I found !

I managed to complete my subject:
Here is the sorting of the maximum and minimum data according to the months of the year.
(without your help I would never have made it)

I hope that the student that I am sufficiently recorded your lessons.
Thanks again for your help.

[{"id":"47f440de.3c3c18","type":"inject","z":"94f1d713.3529c8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":540,"wires":[["c099f9dd.176ab8"]]},{"id":"c099f9dd.176ab8","type":"function","z":"94f1d713.3529c8","name":"remise a 0 des tableaux","func":"var theYear = {}\nvar theYear2 = {}\ntheYear = [\n    {\"mName\": \"Janvier\", \"loTemp\":100},\n    {\"mName\": \"Février\", \"loTemp\":100},\n    {\"mName\": \"Mars\", \"loTemp\":100},\n    {\"mName\": \"Avril\", \"loTemp\":100},\n    {\"mName\": \"Mai\", \"loTemp\":100},\n    {\"mName\": \"Juin\", \"loTemp\":100},\n    {\"mName\": \"Juillet\", \"loTemp\":100},\n    {\"mName\": \"Août\", \"loTemp\":100},\n    {\"mName\": \"Septembre\", \"loTemp\":100},\n    {\"mName\": \"Octobre\", \"loTemp\":100},\n    {\"mName\": \"Novembre\", \"loTemp\":100},\n    {\"mName\": \"Décembre\", \"loTemp\":100}\n    ]\ntheYear2 = [\n    {\"mName\": \"Janvier\", \"hiTemp\":0},\n    {\"mName\": \"Février\", \"hiTemp\":0},\n    {\"mName\": \"Mars\", \"hiTemp\":0},\n    {\"mName\": \"Avril\", \"hiTemp\":0},\n    {\"mName\": \"Mai\", \"hiTemp\":0},\n    {\"mName\": \"Juin\", \"hiTemp\":0},\n    {\"mName\": \"Juillet\", \"hiTemp\":0},\n    {\"mName\": \"Août\", \"hiTemp\":0},\n    {\"mName\": \"Septembre\", \"hiTemp\":0},\n    {\"mName\": \"Octobre\", \"hiTemp\":0},\n    {\"mName\": \"Novembre\", \"hiTemp\":0},\n    {\"mName\": \"Décembre\", \"hiTemp\":0}\n    ]\nflow.set(\"theYear\",theYear)\nflow.set(\"theYear2\",theYear2)\nmsg.payload = \"Réinitialisation de la température élevée pour tous les mois\"\nreturn msg;\n","outputs":1,"noerr":0,"x":390,"y":540,"wires":[["bdf00dd5.740c78"]]},{"id":"bdf00dd5.740c78","type":"trigger","z":"94f1d713.3529c8","op1":"","op2":" ","op1type":"pay","op2type":"str","duration":"5","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":580,"y":540,"wires":[["de2e06fd.fca67"]]},{"id":"de2e06fd.fca67","type":"ui_template","z":"94f1d713.3529c8","group":"3c182adf.1fc50e","name":"","order":1,"width":"12","height":"1","format":"<p style=\"font-size:25px; color:red !important;\">{{msg.payload}}</font>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":720,"y":540,"wires":[[]]},{"id":"964c7a87.4531","type":"debug","z":"94f1d713.3529c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":600,"wires":[]},{"id":"31479558.0f77aa","type":"function","z":"94f1d713.3529c8","name":"valeurs max","func":"var theYear2 = flow.get(\"theYear2\") || {};\n//node.warn(theYear)\n\n//get current month\nvar d = new Date();\nvar m = d.getMonth();\n//node.warn(m)\n//node.warn(theYear)\n//node.warn(theYear[m])\nvar mthHigh = theYear2[m].hiTemp  \n\nif (mthHigh < msg.payload) {\n    mthHigh = msg.payload\n    theYear2[m].hiTemp = mthHigh\n    flow.set(\"theYear2\",theYear2)\n    msg.payload = \"month: \" + (m+1) +\" val max: \"+mthHigh;\n//    msg.payload = \"new high for \" + theYear[m].mName +\" is \"+mthHigh;\n}\n\treturn msg;\n","outputs":1,"noerr":0,"x":470,"y":600,"wires":[["964c7a87.4531","5d05f4a.513f70c"]]},{"id":"5d05f4a.513f70c","type":"change","z":"94f1d713.3529c8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"theYear2","tot":"flow"},{"t":"set","p":"payload","pt":"msg","to":"payload[*]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":660,"wires":[["b046e9ea.12ae38","4c6eeca6.052084"]]},{"id":"4c6eeca6.052084","type":"debug","z":"94f1d713.3529c8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":670,"y":660,"wires":[]},{"id":"b046e9ea.12ae38","type":"ui_table","z":"94f1d713.3529c8","group":"3c182adf.1fc50e","name":"table","order":2,"width":"5","height":"7","columns":[],"outputs":0,"cts":false,"x":450,"y":700,"wires":[]},{"id":"73a474f6.a40bcc","type":"function","z":"94f1d713.3529c8","name":"valeurs min","func":"var theYear = flow.get(\"theYear\") || {};\n//node.warn(theYear)\n\n//get current month\nvar d = new Date();\nvar m = d.getMonth();\n//node.warn(m)\n//node.warn(theYear)\n//node.warn(theYear[m])\nvar mthHigh = theYear[m].loTemp  \n\nif (mthHigh > msg.payload) {\n    mthHigh = msg.payload\n    theYear[m].loTemp = mthHigh\n    flow.set(\"theYear\",theYear)\n    msg.payload = \"month: \" + (m+1) +\" val max: \"+mthHigh;\n//    msg.payload = \"new high for \" + theYear[m].mName +\" is \"+mthHigh;\n}\n\treturn msg;\n","outputs":1,"noerr":0,"x":450,"y":740,"wires":[["bee04a88.067ee","d2030fbb.416fa8"]]},{"id":"bee04a88.067ee","type":"debug","z":"94f1d713.3529c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":740,"wires":[]},{"id":"8b15242e.63941","type":"debug","z":"94f1d713.3529c8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":780,"wires":[]},{"id":"d2030fbb.416fa8","type":"change","z":"94f1d713.3529c8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"theYear","tot":"flow"},{"t":"set","p":"payload","pt":"msg","to":"payload[*]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":780,"wires":[["fb62d44a.fb199","8b15242e.63941"]]},{"id":"fb62d44a.fb199","type":"ui_table","z":"94f1d713.3529c8","group":"3c182adf.1fc50e","name":"table","order":2,"width":"5","height":"7","columns":[],"outputs":0,"cts":false,"x":450,"y":820,"wires":[]},{"id":"898b19c5.8e00e","type":"inject","z":"94f1d713.3529c8","name":"","topic":"valeur","payload":"25","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":740,"wires":[["31479558.0f77aa","73a474f6.a40bcc"]]},{"id":"bb9514ec.98915","type":"inject","z":"94f1d713.3529c8","name":"","topic":"valeur","payload":"15","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":700,"wires":[["31479558.0f77aa","73a474f6.a40bcc"]]},{"id":"e68a4da8.c96b8","type":"inject","z":"94f1d713.3529c8","name":"","topic":"valeur","payload":"5","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":660,"wires":[["31479558.0f77aa","73a474f6.a40bcc"]]},{"id":"3c182adf.1fc50e","type":"ui_group","name":"Luftfeuchtigkeit","tab":"13fdc15a.f11f1f","order":4,"disp":false,"width":"12","collapse":false},{"id":"13fdc15a.f11f1f","type":"ui_tab","name":"Home - paul","icon":"home","order":1,"disabled":false,"hidden":false}]
1 Like

You could merge the two values into the same object:
{"mName": "Janvier", "loTemp":100, "hiTemp":0},

yes, but my neurons are starting to heat up seriously!

I'm going to take a little break, it's 4:00 p.m. here.

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