Retrieve the maximum temperature values for each month of the year

Yes, no problem ! I just wanted to warn you of my absence, not easy to work and take care of the children at the same time. I am listening to you while looking on my side.

Try this:

[{"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":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":180,"wires":[]},{"id":"1eabff5f.9d5be1","type":"function","z":"312653fb.4d179c","name":"reset high temp for year","func":"var theYear = {}\ntheYear[0]  = {\"hiTemp\":0, \"mName\": \"Jan\"} // january (arrays start at 0)\ntheYear[1]  = {\"hiTemp\":0, \"mName\": \"Feb\"}\ntheYear[2]  = {\"hiTemp\":0, \"mName\": \"Mar\"}\ntheYear[3]  = {\"hiTemp\":0, \"mName\": \"Apr\"}\ntheYear[4]  = {\"hiTemp\":0, \"mName\": \"May\"}\ntheYear[5]  = {\"hiTemp\":0, \"mName\": \"Jun\"}\ntheYear[6]  = {\"hiTemp\":0, \"mName\": \"Jul\"}\ntheYear[7]  = {\"hiTemp\":0, \"mName\": \"Aug\"}\ntheYear[8]  = {\"hiTemp\":0, \"mName\": \"Sep\"}\ntheYear[9]  = {\"hiTemp\":0, \"mName\": \"Oct\"}\ntheYear[10] = {\"hiTemp\":0, \"mName\": \"Nov\"}\ntheYear[11] = {\"hiTemp\":0, \"mName\": \"Dec\"}\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":370,"y":80,"wires":[["5d875d71.ef3474"]]},{"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":200,"wires":[["35e124a8.bf9044"]]},{"id":"ad2855c1.17652","type":"function","z":"312653fb.4d179c","name":"valeurs max","func":"var theYear = flow.get(\"theYear\") || {};\nnode.warn(theYear)\n\n//get current month\nvar d = new Date();\nvar m = d.getMonth();\nnode.warn(m)\nnode.warn(theYear)\nnode.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\")\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":200,"wires":[["db0a5e0c.143ce8"]]},{"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":200,"wires":[["ad2855c1.17652"]]},{"id":"5d875d71.ef3474","type":"debug","z":"312653fb.4d179c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":80,"wires":[]},{"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":280,"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":340,"wires":[["35e124a8.bf9044"]]},{"id":"c41d0131.ee05b","type":"catch","z":"312653fb.4d179c","name":"","scope":null,"uncaught":false,"x":510,"y":300,"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":700,"y":300,"wires":[]}]

The first flow sets a flow variable (theYear) that is an object with 12 objects in side - one for each month of the year.

the second flow receives the temperature value in the 'valeurs max' function it gets the number of the current month and retreives the flow variable. Using the month number, it gets the temperature for that month. It then compares that temperature to the incoming temperature. If the incoming temperature is greater, it replaces the existing number.

see if it makes sence to you.

thanks i will study this and keep you posted

You are fortunate that we are having a snow storm :cloud_with_snow: today (25.4 cm to 45.72 cm). My grandkids (who live three houses up the street) are stuck at their house and I'm not helping them with their remote schooling. I have some free time today...until I go out to shovel the snow :frowning_face:

I have just studied your program: but I do not understand very well how I can display "month: 12 val max: 25"

Oh yes ! ! you have a lot of snow! ! !
here in France (Normandy) we have more than 10 ° C, but we are starting to be "very affected" with covid19, moreover our president Macron has just been declared positive for covid

what region do you come from ?

I added a "text display" node to see if something is displayed? max value december? ? ? but I have nothing.
am I making a mistake?

however, I have read your program and understand your program more or less.

note: I am a basic arduino programmer and I have been discovering node red for 1 month.

I had a bug in the 'valeurs max' `function' node replace it with this:

var theYear = flow.get("theYear") || {};
//node.warn(theYear)

//get current month
var d = new Date();
var m = d.getMonth();
//node.warn(m)
//node.warn(theYear)
//node.warn(theYear[m])
var mthHigh = theYear[m].hiTemp  

if (mthHigh < msg.payload) {
    mthHigh = msg.payload
    theYear[m].hiTemp = mthHigh
    flow.set("theYear",theYear)
    msg.payload = "month: " + (m+1) +" val max: "+mthHigh;
//    msg.payload = "new high for " + theYear[m].mName +" is "+mthHigh;
}
	return msg;

If you want that to display on the dashboard connect the output of the 'valeurs max' function to the ui_text node and it should then display on the dashboard (Have installed the dashboard?)

Thank you very much, it almost works
if the temperature is higher than the max value => it works; but if a value arrives, it overwrites the message "max value ..." by the lower numeric value which has just arrived.
I have to rectify your code a bit and it works! ! !
Thanks a lot for your help ! ! !

Here is my final code:

[
    {
        "id": "9a301321.5665b",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": ""
    },
    {
        "id": "ccd23a73.fa9fd",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 100,
        "wires": [
            [
                "51f2a42f.d26c94"
            ]
        ]
    },
    {
        "id": "51f2a42f.d26c94",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "reset high temp for year",
        "func": "var theYear = {}\ntheYear[0]  = {\"hiTemp\":0, \"mName\": \"Jan\"} // january (arrays start at 0)\ntheYear[1]  = {\"hiTemp\":0, \"mName\": \"Feb\"}\ntheYear[2]  = {\"hiTemp\":0, \"mName\": \"Mar\"}\ntheYear[3]  = {\"hiTemp\":0, \"mName\": \"Apr\"}\ntheYear[4]  = {\"hiTemp\":0, \"mName\": \"May\"}\ntheYear[5]  = {\"hiTemp\":0, \"mName\": \"Jun\"}\ntheYear[6]  = {\"hiTemp\":0, \"mName\": \"Jul\"}\ntheYear[7]  = {\"hiTemp\":0, \"mName\": \"Aug\"}\ntheYear[8]  = {\"hiTemp\":0, \"mName\": \"Sep\"}\ntheYear[9]  = {\"hiTemp\":0, \"mName\": \"Oct\"}\ntheYear[10] = {\"hiTemp\":0, \"mName\": \"Nov\"}\ntheYear[11] = {\"hiTemp\":0, \"mName\": \"Dec\"}\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,
        "x": 330,
        "y": 100,
        "wires": [
            [
                "e8d340c.68717c"
            ]
        ]
    },
    {
        "id": "c64d2d33.0e4af8",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "valeur",
        "payload": "5",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 90,
        "y": 220,
        "wires": [
            [
                "1bcfba01.cf5ed6"
            ]
        ]
    },
    {
        "id": "1bcfba01.cf5ed6",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "valeur",
        "func": "\nmsg.payload = msg.payload;\nmsg.topic = \"valeur\"\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 270,
        "y": 220,
        "wires": [
            [
                "8173fb32.aa1ce"
            ]
        ]
    },
    {
        "id": "ff95294f.f1bd78",
        "type": "debug",
        "z": "9a301321.5665b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 690,
        "y": 160,
        "wires": []
    },
    {
        "id": "e261a871.9ab63",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "valeur",
        "payload": "15",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 300,
        "wires": [
            [
                "1bcfba01.cf5ed6"
            ]
        ]
    },
    {
        "id": "8ae19dde.9289a8",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "valeur",
        "payload": "25",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 360,
        "wires": [
            [
                "1bcfba01.cf5ed6"
            ]
        ]
    },
    {
        "id": "8f0c3553.6ead1",
        "type": "catch",
        "z": "9a301321.5665b",
        "name": "",
        "scope": null,
        "uncaught": false,
        "x": 470,
        "y": 320,
        "wires": [
            [
                "3464f79c.5de29"
            ]
        ]
    },
    {
        "id": "3464f79c.5de29",
        "type": "debug",
        "z": "9a301321.5665b",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 660,
        "y": 320,
        "wires": []
    },
    {
        "id": "8173fb32.aa1ce",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "valeur max bis",
        "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}\nelse { msg.payload = \"month: \" + (m+1) +\" val max: \"+mthHigh;\n}\n\treturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 440,
        "y": 220,
        "wires": [
            [
                "ff95294f.f1bd78",
                "e8d340c.68717c"
            ]
        ]
    },
    {
        "id": "e8d340c.68717c",
        "type": "ui_template",
        "z": "9a301321.5665b",
        "group": "c0142661.a0eed8",
        "name": "",
        "order": 1,
        "width": 0,
        "height": 0,
        "format": "<span flex style=\"color: red;font-weight:bold;font-size:10px\">{{msg.payload}}</span>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "x": 680,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "c0142661.a0eed8",
        "type": "ui_group",
        "z": "",
        "name": "Luftfeuchtigkeit",
        "tab": "7b41b1f3.424128",
        "order": 4,
        "disp": false,
        "width": "6",
        "collapse": false
    },
    {
        "id": "7b41b1f3.424128",
        "type": "ui_tab",
        "z": "",
        "name": "Home",
        "icon": "home",
        "order": 1
    }
]

Glad you got it working and I hope you learned something. ( I just got in from two hours getting rid of the snow and the front stairs are still covered)

1 Like

what region do you come from ? to have so much snow?

and the covid in your home? how is it going ? here, we just have a curfew from 8 p.m. to 6 a.m. and wearing a compulsory mask. restaurants and shows prohibited. Christmas soon, we plan to celebrate it with the family, but we dread the month of January.
I wish you happy holidays and, above all, good health!

yes, you have allowed me to progress! ! !
(there is only the catsh function, which I do not really understand? but I will look for it!!)

Excuse, but I have a problem "still": I try to carry out my memorizations over several months, we get a maximum value, but it applies to all the months at the same time?
How can I fix it?

here is my code for testing:

[
    {
        "id": "9a301321.5665b",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": ""
    },
    {
        "id": "ccd23a73.fa9fd",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 100,
        "wires": [
            [
                "51f2a42f.d26c94"
            ]
        ]
    },
    {
        "id": "51f2a42f.d26c94",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "reset high temp for year",
        "func": "var theYear = {}\ntheYear[0]  = {\"hiTemp\":0, \"mName\": \"Jan\"} // january (arrays start at 0)\ntheYear[1]  = {\"hiTemp\":0, \"mName\": \"Feb\"}\ntheYear[2]  = {\"hiTemp\":0, \"mName\": \"Mar\"}\ntheYear[3]  = {\"hiTemp\":0, \"mName\": \"Apr\"}\ntheYear[4]  = {\"hiTemp\":0, \"mName\": \"May\"}\ntheYear[5]  = {\"hiTemp\":0, \"mName\": \"Jun\"}\ntheYear[6]  = {\"hiTemp\":0, \"mName\": \"Jul\"}\ntheYear[7]  = {\"hiTemp\":0, \"mName\": \"Aug\"}\ntheYear[8]  = {\"hiTemp\":0, \"mName\": \"Sep\"}\ntheYear[9]  = {\"hiTemp\":0, \"mName\": \"Oct\"}\ntheYear[10] = {\"hiTemp\":0, \"mName\": \"Nov\"}\ntheYear[11] = {\"hiTemp\":0, \"mName\": \"Dec\"}\nflow.set(\"theYear\",theYear)\nmsg.payload = \"Réinitialisation des températures max\"\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "x": 330,
        "y": 100,
        "wires": [
            [
                "e8d340c.68717c",
                "b28e666e.b3465"
            ]
        ]
    },
    {
        "id": "c64d2d33.0e4af8",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "valeur",
        "payload": "5",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 240,
        "wires": [
            [
                "8173fb32.aa1ce",
                "3e6cbeac.764872"
            ]
        ]
    },
    {
        "id": "ff95294f.f1bd78",
        "type": "debug",
        "z": "9a301321.5665b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 690,
        "y": 160,
        "wires": []
    },
    {
        "id": "e261a871.9ab63",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "valeur",
        "payload": "15",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 300,
        "wires": [
            [
                "8173fb32.aa1ce",
                "3e6cbeac.764872"
            ]
        ]
    },
    {
        "id": "8ae19dde.9289a8",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "valeur",
        "payload": "25",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 360,
        "wires": [
            [
                "8173fb32.aa1ce",
                "3e6cbeac.764872"
            ]
        ]
    },
    {
        "id": "8173fb32.aa1ce",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "valeur max decembre",
        "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 && (m+1)==12 ) {\n    mthHigh = msg.payload\n    theYear[m].hiTemp = mthHigh\n    flow.set(\"theYear\",theYear)\n    msg.payload = \"Température max en Décembre : \"+mthHigh+\" °C\";\n//    msg.payload = \"new high for \" + theYear[m].mName +\" is \"+mthHigh;\n}\nelse { msg.payload = \"Température max en Décembre : \"+mthHigh+\" °C\";\n}\n\treturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 360,
        "y": 280,
        "wires": [
            [
                "ff95294f.f1bd78",
                "e8d340c.68717c"
            ]
        ]
    },
    {
        "id": "e8d340c.68717c",
        "type": "ui_template",
        "z": "9a301321.5665b",
        "group": "c0142661.a0eed8",
        "name": "",
        "order": 1,
        "width": 9,
        "height": 1,
        "format": "<span flex style=\"color: red;font-weight:bold;font-size:20px\">{{msg.payload}}</span>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "x": 600,
        "y": 280,
        "wires": [
            []
        ]
    },
    {
        "id": "3e6cbeac.764872",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "valeur max novembre",
        "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 && (m+1)==12 ) {\n    mthHigh = msg.payload\n    theYear[m].hiTemp = mthHigh\n    flow.set(\"theYear\",theYear)\n    msg.payload = \"Température max en Novembre : \"+mthHigh+\" °C\";\n//    msg.payload = \"new high for \" + theYear[m].mName +\" is \"+mthHigh;\n}\nelse { msg.payload = \"Température max en Novembre : \"+mthHigh+\" °C\";\n}\n\treturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 360,
        "y": 320,
        "wires": [
            [
                "b28e666e.b3465"
            ]
        ]
    },
    {
        "id": "b28e666e.b3465",
        "type": "ui_template",
        "z": "9a301321.5665b",
        "group": "c0142661.a0eed8",
        "name": "",
        "order": 3,
        "width": 9,
        "height": 1,
        "format": "<span flex style=\"color: red;font-weight:bold;font-size:20px\">{{msg.payload}}</span>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "x": 600,
        "y": 320,
        "wires": [
            []
        ]
    },
    {
        "id": "c0142661.a0eed8",
        "type": "ui_group",
        "z": "",
        "name": "Luftfeuchtigkeit",
        "tab": "7b41b1f3.424128",
        "order": 4,
        "disp": false,
        "width": 12,
        "collapse": false
    },
    {
        "id": "7b41b1f3.424128",
        "type": "ui_tab",
        "z": "",
        "name": "Home",
        "icon": "home",
        "order": 1
    }
]

You don't need a new function node for each month. When a readiing comes in, the function node gets the current date and gets the current month from that. So this month, the month will be 12, next month it will be 1. So one function handles all the months.

You will notice that in some places you have to subtract one from the month to access the associated month for that month. That is because in the first flow (that builds the flow) the months are stored in an array and the first occurance of any array uses index [0]. So array[0] is January, [1] is February etc.

If you want to test to see how data for November would work you have two choices - change the date on the machine you are using or copy the function node and change:

//get current month
var d = new Date();
var m = d.getMonth();

to

//get current month
var d = new Date();
var m = d.getMonth() - 1; // NOTE this is a hack and will cause a problem come January

As for thecatch node , this is from the 'Help' tab of the node


Détails
Si un nœud renvoie une erreur lors du traitement d'un message, le flux s'arrête généralement. Ce nœud peut être utilisé pour détecter ces erreurs et les gérer avec un flux dédié.

Par défaut, le nœud détecte les erreurs générées par n'importe quel nœud du même onglet. Il peut également être ciblé sur des nœuds spécifiques ou configuré pour ne détecter que les erreurs qui n'ont pas déjà été capturées par un nœud de capture «ciblé».

Lorsqu'une erreur est générée, tous les nœuds catch correspondants recevront le message.

Si une erreur est renvoyée dans un sous-flux, l'erreur sera gérée par tous les nœuds de capture du sous-flux. S'il n'y en a pas, l'erreur sera propagée jusqu'à l'onglet sur lequel se trouve l'instance de sous-flux.

Si le message a déjà une propriété d'erreur, il est copié dans _error.

Sorry, I know I'm asking a lot of you, but I'm having a hard time! not easy to use software without training.
I understand that d.getMonth () changes values ​​every month and that we can test it several times. but I don't know how to make several outputs on a node?
I don't see how to do it?
can you give me the whole program? thank you

note: I don't do a test (var m = d.getMonth () - 1, but var m = d.getMonth () + 1!
I know that the value 0 corresponds to january, that's why my tests do it at m + 1)
my error does not come from there.

I changed my program, but it doesn't always work

here it is :

[
    {
        "id": "9a301321.5665b",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": ""
    },
    {
        "id": "ccd23a73.fa9fd",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 100,
        "wires": [
            [
                "51f2a42f.d26c94"
            ]
        ]
    },
    {
        "id": "51f2a42f.d26c94",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "reset high temp for year",
        "func": "var theYear = {}\ntheYear[0]  = {\"hiTemp\":0, \"mName\": \"Jan\"} // january (arrays start at 0)\ntheYear[1]  = {\"hiTemp\":0, \"mName\": \"Feb\"}\ntheYear[2]  = {\"hiTemp\":0, \"mName\": \"Mar\"}\ntheYear[3]  = {\"hiTemp\":0, \"mName\": \"Apr\"}\ntheYear[4]  = {\"hiTemp\":0, \"mName\": \"May\"}\ntheYear[5]  = {\"hiTemp\":0, \"mName\": \"Jun\"}\ntheYear[6]  = {\"hiTemp\":0, \"mName\": \"Jul\"}\ntheYear[7]  = {\"hiTemp\":0, \"mName\": \"Aug\"}\ntheYear[8]  = {\"hiTemp\":0, \"mName\": \"Sep\"}\ntheYear[9]  = {\"hiTemp\":0, \"mName\": \"Oct\"}\ntheYear[10] = {\"hiTemp\":0, \"mName\": \"Nov\"}\ntheYear[11] = {\"hiTemp\":0, \"mName\": \"Dec\"}\nflow.set(\"theYear\",theYear)\nmsg.payload = \"Réinitialisation des températures max\"\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "x": 330,
        "y": 100,
        "wires": [
            [
                "e8d340c.68717c",
                "b28e666e.b3465"
            ]
        ]
    },
    {
        "id": "c64d2d33.0e4af8",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "valeur",
        "payload": "5",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 240,
        "wires": [
            [
                "8173fb32.aa1ce"
            ]
        ]
    },
    {
        "id": "ff95294f.f1bd78",
        "type": "debug",
        "z": "9a301321.5665b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 690,
        "y": 160,
        "wires": []
    },
    {
        "id": "e261a871.9ab63",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "valeur",
        "payload": "15",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 300,
        "wires": [
            [
                "8173fb32.aa1ce"
            ]
        ]
    },
    {
        "id": "8ae19dde.9289a8",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "valeur",
        "payload": "25",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 360,
        "wires": [
            [
                "8173fb32.aa1ce"
            ]
        ]
    },
    {
        "id": "8173fb32.aa1ce",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "valeur 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)\nnode.log(theYear[m])\nvar mthHigh = theYear[m].hiTemp  \n\nmsg11 = {};\nmsg12 = {};\nmsg1 = {};\n\nmsg11.payload = \"output 1\";\nmsg12.payload = \"output 2\";\nmsg1.payload = \"output 3\";\n\n\nif (mthHigh < msg.payload && (m+1)==12 ) {\n    mthHigh = msg.payload\n    theYear[m].hiTemp = mthHigh\n    flow.set(\"theYear\",theYear)\n    msg.payload = \"Température max en Décembre : \"+mthHigh+\" °C\";\n//    msg.payload = \"new high for \" + theYear[m].mName +\" is \"+mthHigh;\n    return [msg12,msg11,msg1]; \n}\nif (mthHigh < msg.payload && (m+1)==11 ) {\n    mthHigh = msg.payload\n    theYear[m].hiTemp = mthHigh\n    flow.set(\"theYear\",theYear)\n    msg.payload = \"Température max en Novembre : \"+mthHigh+\" °C\";\n    return [msg12,msg11,msg1];\n}   \nif (mthHigh < msg.payload && (m+1)==1 ) {\n    mthHigh = msg.payload\n    theYear[m].hiTemp = mthHigh\n    flow.set(\"theYear\",theYear)\n    msg.payload = \"Température max en Janvier : \"+mthHigh+\" °C\";\n    return [msg12,msg11,msg1];\n}\n",
        "outputs": 3,
        "noerr": 0,
        "x": 310,
        "y": 260,
        "wires": [
            [
                "ff95294f.f1bd78",
                "e8d340c.68717c"
            ],
            [
                "b28e666e.b3465",
                "2b4b945.62017ec"
            ],
            [
                "7ea7530a.dacb14"
            ]
        ]
    },
    {
        "id": "e8d340c.68717c",
        "type": "ui_template",
        "z": "9a301321.5665b",
        "group": "c0142661.a0eed8",
        "name": "",
        "order": 1,
        "width": 9,
        "height": 1,
        "format": "<span flex style=\"color: red;font-weight:bold;font-size:20px\">{{msg.payload}}</span>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "x": 660,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "b28e666e.b3465",
        "type": "ui_template",
        "z": "9a301321.5665b",
        "group": "c0142661.a0eed8",
        "name": "",
        "order": 3,
        "width": 9,
        "height": 1,
        "format": "<span flex style=\"color: red;font-weight:bold;font-size:20px\">{{msg.payload}}</span>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "x": 660,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "2b4b945.62017ec",
        "type": "debug",
        "z": "9a301321.5665b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 640,
        "y": 320,
        "wires": []
    },
    {
        "id": "7ea7530a.dacb14",
        "type": "debug",
        "z": "9a301321.5665b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 640,
        "y": 400,
        "wires": []
    },
    {
        "id": "c0142661.a0eed8",
        "type": "ui_group",
        "z": "",
        "name": "Luftfeuchtigkeit",
        "tab": "7b41b1f3.424128",
        "order": 4,
        "disp": false,
        "width": 12,
        "collapse": false
    },
    {
        "id": "7b41b1f3.424128",
        "type": "ui_tab",
        "z": "",
        "name": "Home",
        "icon": "home",
        "order": 1
    }
]

before we start making changes, what do you want the show on the dashboard? Do you want to display a table of all the months and the high temperature for the month?

yes and tanck you

look at this, I think I'm close to the solution

[
    {
        "id": "c64d2d33.0e4af8",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "valeur",
        "payload": "5",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 240,
        "wires": [
            [
                "8173fb32.aa1ce"
            ]
        ]
    },
    {
        "id": "e261a871.9ab63",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "valeur",
        "payload": "15",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 300,
        "wires": [
            [
                "8173fb32.aa1ce"
            ]
        ]
    },
    {
        "id": "8ae19dde.9289a8",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "valeur",
        "payload": "25",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 360,
        "wires": [
            [
                "8173fb32.aa1ce"
            ]
        ]
    },
    {
        "id": "8173fb32.aa1ce",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "valeur max ",
        "func": "var theYear = flow.get(\"theYear\") || {};\nvar m = new Date().getMonth();\n \nvar mthHigh = theYear[m].hiTemp  \n\nif (m===0 && mthHigh < msg.payload) {\n    mthHigh = msg.payload\n    theYear[m].hiTemp = mthHigh\n    flow.set(\"theYear\",theYear)\n    msg1.payload = \"Janvier : \"+mthHigh;\n    return [msg1,null,null]; \n//    msg.payload = \"new high for \" + theYear[m].mName +\" is \"+mthHigh;\n}\nif (m===10 && mthHigh < msg.payload) {\n    mthHigh = msg.payload\n    theYear[m].hiTemp = mthHigh\n    flow.set(\"theYear\",theYear)\n    msg2.payload = \"Novembre : \"+mthHigh;\n    return [null,msg2,null]; \n//    msg.payload = \"new high for \" + theYear[m].mName +\" is \"+mthHigh;\n}\nif (m===11 && mthHigh < msg.payload) {\n    mthHigh = msg.payload\n    theYear[m].hiTemp = mthHigh\n    flow.set(\"theYear\",theYear)\n    msg3.payload = \"Decembre : \"+mthHigh;\n    return [null,null,msg3]; \n//    msg.payload = \"new high for \" + theYear[m].mName +\" is \"+mthHigh;\n}\n\n\n\n\n\n\n\n\n",
        "outputs": 3,
        "noerr": 0,
        "x": 310,
        "y": 260,
        "wires": [
            [
                "ff95294f.f1bd78",
                "e8d340c.68717c"
            ],
            [
                "b28e666e.b3465",
                "2b4b945.62017ec"
            ],
            [
                "7ea7530a.dacb14"
            ]
        ]
    },
    {
        "id": "ff95294f.f1bd78",
        "type": "debug",
        "z": "9a301321.5665b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 690,
        "y": 160,
        "wires": []
    },
    {
        "id": "e8d340c.68717c",
        "type": "ui_template",
        "z": "9a301321.5665b",
        "group": "c0142661.a0eed8",
        "name": "",
        "order": 1,
        "width": 9,
        "height": 1,
        "format": "<span flex style=\"color: red;font-weight:bold;font-size:20px\">{{msg.payload}}</span>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "x": 660,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "b28e666e.b3465",
        "type": "ui_template",
        "z": "9a301321.5665b",
        "group": "c0142661.a0eed8",
        "name": "",
        "order": 3,
        "width": 9,
        "height": 1,
        "format": "<span flex style=\"color: red;font-weight:bold;font-size:20px\">{{msg.payload}}</span>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "x": 660,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "2b4b945.62017ec",
        "type": "debug",
        "z": "9a301321.5665b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 640,
        "y": 320,
        "wires": []
    },
    {
        "id": "7ea7530a.dacb14",
        "type": "debug",
        "z": "9a301321.5665b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 640,
        "y": 400,
        "wires": []
    },
    {
        "id": "51f2a42f.d26c94",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "reset high temp for year",
        "func": "var theYear = {}\ntheYear[0]  = {\"hiTemp\":0, \"mName\": \"Jan\"} // january (arrays start at 0)\ntheYear[1]  = {\"hiTemp\":0, \"mName\": \"Feb\"}\ntheYear[2]  = {\"hiTemp\":0, \"mName\": \"Mar\"}\ntheYear[3]  = {\"hiTemp\":0, \"mName\": \"Apr\"}\ntheYear[4]  = {\"hiTemp\":0, \"mName\": \"May\"}\ntheYear[5]  = {\"hiTemp\":0, \"mName\": \"Jun\"}\ntheYear[6]  = {\"hiTemp\":0, \"mName\": \"Jul\"}\ntheYear[7]  = {\"hiTemp\":0, \"mName\": \"Aug\"}\ntheYear[8]  = {\"hiTemp\":0, \"mName\": \"Sep\"}\ntheYear[9]  = {\"hiTemp\":0, \"mName\": \"Oct\"}\ntheYear[10] = {\"hiTemp\":0, \"mName\": \"Nov\"}\ntheYear[11] = {\"hiTemp\":0, \"mName\": \"Dec\"}\nflow.set(\"theYear\",theYear)\nmsg.payload = \"Réinitialisation des températures max\"\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "x": 330,
        "y": 100,
        "wires": [
            [
                "e8d340c.68717c",
                "b28e666e.b3465"
            ]
        ]
    },
    {
        "id": "ccd23a73.fa9fd",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 100,
        "wires": [
            [
                "51f2a42f.d26c94"
            ]
        ]
    },
    {
        "id": "c0142661.a0eed8",
        "type": "ui_group",
        "z": "",
        "name": "Luftfeuchtigkeit",
        "tab": "7b41b1f3.424128",
        "order": 4,
        "disp": false,
        "width": 12,
        "collapse": false
    },
    {
        "id": "7b41b1f3.424128",
        "type": "ui_tab",
        "z": "",
        "name": "Home",
        "icon": "home",
        "order": 1
    }
]
  1. Why are you sending the output of the initilization to a ui_template node? Why not send it to a ui_text node?

  2. If you want to display the entire year in a table, why not use the ui_table node?