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"
]
]
}
]