Retrieve the maximum temperature values for each month of the year

Hello, I am a beginner, and I am trying to memorize the temperature of my sensor (max value) for each month.
example:
January: max temp 6.5 ° c
february: max temp 12.4 °

I found the way to get the month and the temperature, but to link the 2? I appeal to you.
thank you

[
    {
        "id": "9a301321.5665b",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": ""
    },
    {
        "id": "5d664bd2.b9a2d4",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "1",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 130,
        "y": 80,
        "wires": [
            [
                "f70b6c5.13fa81"
            ]
        ]
    },
    {
        "id": "3184516d.c808d6",
        "type": "debug",
        "z": "9a301321.5665b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 470,
        "y": 200,
        "wires": []
    },
    {
        "id": "f70b6c5.13fa81",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "reccup mois",
        "func": "var now     = new Date(); \nvar month   = now.getMonth()+1; \nmsg.payload = month;\nmsg.topic = \"mois\"\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 310,
        "y": 80,
        "wires": [
            [
                "dc7a1b4.c9138e8"
            ]
        ]
    },
    {
        "id": "ed0fbb30.809c",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "",
        "payload": "15",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 90,
        "y": 240,
        "wires": [
            [
                "c4e9c65d.26937"
            ]
        ]
    },
    {
        "id": "dc7a1b4.c9138e8",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "valeurs max",
        "func": "context.data = context.data || new Object();\nswitch (msg.topic) {\n    case \"mois\":\n        context.data.mois = msg.payload;\n        msg = null;\n        break;\n    case \"valeur\":\n        context.data.valeur = msg.payload;\n        msg = null;\n        break;   \n    default:\n        msg = null;\n    \tbreak;\n}\n\nlet valeur_max;\nif(context.data.mois == 12 && context.data.valeur >= valeur_max ) {\n    valeur_max=valeur;\n    msg.payload = msgOut;\n\treturn msg;\n} \n",
        "outputs": 1,
        "noerr": 0,
        "x": 310,
        "y": 200,
        "wires": [
            [
                "3184516d.c808d6"
            ]
        ]
    },
    {
        "id": "c4e9c65d.26937",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "valeur",
        "func": "\nmsg.payload = msg.payload;\nmsg.topic = \"valeur\"\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 170,
        "y": 300,
        "wires": [
            [
                "dc7a1b4.c9138e8"
            ]
        ]
    }
]

Let me try to help you figure out the problem yourself. First off remove the interval in the inject node (so you don't flood the sidebar debug) then put a debug node on the output of the 'reccup mois' function node and on the output of the 'valeur' function node to make sure data is coming from both.

Next add a node.warn() in the 'valeurs max' function node after the first line. formate the node.warn like this: node.warn("context.data = "& context.data) so the first two lines are:

context.data = context.data || {};
node.warn("context.data = "& context.data)

deploy and run the your flow pressing each inject node.

What do the results tell you?

thank you for helping me, but I have a lot of trouble understanding (I don't speak English, and I use translate)

I'm not sure if I followed your recommendations, but on output I get "0" every second?

voir si cela a plus de sens (See if this makes more sense.)

First off remove the interval in the inject node (so you don't flood the sidebar debug)
Change
Screen Shot 2020-12-17 at 6.16.10 AM
to
Screen Shot 2020-12-17 at 6.16.25 AM

Next put a debug node on the output of the 'reccup mois' function node and on the output of the 'valeur' function node to make sure data is coming from both.

Next add a node.warn() in the 'valeurs max' function node after the first line. formate the node.warn like this: node.warn("context.data = "& context.data) so the first two lines are:

context.data = context.data || {};
node.warn("context.data = "& context.data)

deploy and run the your flow pressing each inject node.

What do the results tell you?

ok I redo your diagram, I will come back immediately

if I click on time, I have output 0 and 12
if i click on 15, i have output 0 and 15

I'm sorry, I have to go eat (I'll be back at 1:00 p.m.)

So the 12 and 15 are correct, but the output of the node.warn is 0.

So what do you expect context.data to be?

I don't know, I'm lost!
if I validate that the first ms.payload (the 2 others inactivated) with 1 pulse on time.stamp I have 0 and 12 on output; if a pulse on "15" then I only have 0 in output?
I don't know what to think?

in output of max value I always have 0 in output! either with input 15 or input time

[
    {
        "id": "9a301321.5665b",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": ""
    },
    {
        "id": "5d664bd2.b9a2d4",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 100,
        "y": 160,
        "wires": [
            [
                "f70b6c5.13fa81"
            ]
        ]
    },
    {
        "id": "3184516d.c808d6",
        "type": "debug",
        "z": "9a301321.5665b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 470,
        "y": 220,
        "wires": []
    },
    {
        "id": "f70b6c5.13fa81",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "reccup mois",
        "func": "var now     = new Date(); \nvar month   = now.getMonth()+1; \nmsg.payload = month;\nmsg.topic = \"mois\"\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 230,
        "y": 100,
        "wires": [
            [
                "dc7a1b4.c9138e8",
                "18accb5a.f7085d"
            ]
        ]
    },
    {
        "id": "ed0fbb30.809c",
        "type": "inject",
        "z": "9a301321.5665b",
        "name": "",
        "topic": "",
        "payload": "15",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 90,
        "y": 240,
        "wires": [
            [
                "c4e9c65d.26937"
            ]
        ]
    },
    {
        "id": "dc7a1b4.c9138e8",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "valeurs max",
        "func": "\ncontext.data = context.data || {};\nnode.warn(\"context.data = \"& context.data)",
        "outputs": 1,
        "noerr": 0,
        "x": 290,
        "y": 220,
        "wires": [
            [
                "3184516d.c808d6"
            ]
        ]
    },
    {
        "id": "c4e9c65d.26937",
        "type": "function",
        "z": "9a301321.5665b",
        "name": "reccup mois",
        "func": "\nmsg.payload = msg.payload;\nmsg.topic = \"valeur\"\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 190,
        "y": 300,
        "wires": [
            [
                "dc7a1b4.c9138e8",
                "47ed9bc7.b47a0c"
            ]
        ]
    },
    {
        "id": "18accb5a.f7085d",
        "type": "debug",
        "z": "9a301321.5665b",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 440,
        "y": 100,
        "wires": []
    },
    {
        "id": "47ed9bc7.b47a0c",
        "type": "debug",
        "z": "9a301321.5665b",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 420,
        "y": 340,
        "wires": []
    }
]

I apologize, but I would like to move forward in my project. Thank you for kindly showing me the solution to my problem, but I have a lot of trouble understanding you (problem of different languages) could you give me the final solution (I don't think there is much code?) I will then try to understand the instructions and use it for similar functions. it would save me a lot of time (I am on a project and here I am at a standstill)
thank you for your understanding and above all for your help.
this is in no way a criticism or reproach towards the forum, but I am blocked

I added "return msg;" at the end of the "max value" function, now if I click on time I have 0 and 12 and if I click on 15 I have 0 and 15.
this means, that when the "max value" function receives an information, it reads the 2 inputs but the input information is not stored (hence the value 0). I don't know how to fix it?

in the function node:

context.data = context.data || new Object();
switch (msg.topic) {
    case "mois":
        context.data.mois = msg.payload;
        msg = null;
        break;
    case "valeur":
        context.data.valeur = msg.payload;
        msg = null;
        break;   
    default:
        msg = null;
    	break;
}

let valeur_max;
if(context.data.mois == 12 && context.data.valeur >= valeur_max ) {
    valeur_max=valeur;
    msg.payload = msgOut;    <========== 
	return msg;
} 

MsgOut n'a jamais été défini. Voulez-vous enregistrer la valeur_max la plus élevée et la mettre dans msg.payload?
qu'est-ce que valeur_max, vous ne l'avez jamais défini sur quoi que ce soit?

I have a temperature sensor which gives me data every minute, I would like to record the max values ​​for each month of the year.
January => 5 ° c
February => 12 ° c
for example

hence my mini program with 2 inputs (time and a digital input) output I would like to have (12 outputs with the maximum values ​​that I will display)

I'm coming back in 30 minutes (I'm going to pick up my daughter from school) and I'm back.
Thanks again for your help !

Give me a few minutes

hello i am