NODE RED – Reduire des données sur un graph – Objets Connectés – Forum Projets DIY • Domotique et Objets Connectés

bonjour, je suis débutant j’ai un capteur meteo qui m’envoie des valeurs toutes les minutes.

j’ai un graph qui affiche ces valeurs sur 24 h.

=> je trouve que cela prend trop de place inutilement en mémoire, donc je voudrais filtrer ces valeurs à 1 toutes les 15 mn.

j’ai réalisé un exemple ci-dessous ( petit programme ) ( j’ai 3 entrées qui simulent les infos capteurs temperature que je clic toutes les 5 secondes et j’ai une entree true qui est valide toutes les 2 minutes => je voudrais valider l’info capteur qui arrive toutes les 2 minutes )

j’espère avoir été assez clair ? ? ?

merci de m’aider :

programme de test :

[
{
    "id": "441f38f7.3482a",
    "type": "tab",
    "label": "Flow 1",
    "disabled": false,
    "info": ""
},
{
    "id": "722297dd.871728",
    "type": "inject",
    "z": "441f38f7.3482a",
    "name": "",
    "topic": "",
    "payload": "true",
    "payloadType": "bool",
    "repeat": "120",
    "crontab": "",
    "once": false,
    "onceDelay": 0.1,
    "x": 150,
    "y": 100,
    "wires": [
        [
            "12bb68ae.ac0d57"
        ]
    ]
},
{
    "id": "6fba18d2.f80df",
    "type": "function",
    "z": "441f38f7.3482a",
    "name": "arrondir a 1 chiffre apres virgule topic \"temp_cap\"",
    "func": "msg.payload = Math.round(msg.payload*10)/10;\nmsg.topic = \"temp_cap\"\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 310,
    "y": 240,
    "wires": [
        [
            "3af2ffc8.53cc",
            "70a221fb.a781f8"
        ]
    ]
},
{
    "id": "12bb68ae.ac0d57",
    "type": "function",
    "z": "441f38f7.3482a",
    "name": "topic \"tempsmn\"",
    "func": "\n\n  \n\nmsg.payload=true;\nmsg.topic = \"tempsmn\"\n\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 340,
    "y": 100,
    "wires": [
        [
            "3af2ffc8.53cc",
            "d8ffe315.045d9"
        ]
    ]
},
{
    "id": "3af2ffc8.53cc",
    "type": "function",
    "z": "441f38f7.3482a",
    "name": "et logique entre 2 topics",
    "func": "context.data = context.data || new Object();\n\nswitch (msg.topic) {\n    case \"tempsmn\":\n        context.data.tempsmn = msg.payload;\n        msg = null;\n        break;\n    case \"temp_cap\":\n        context.data.temp_cap = msg.payload;\n        msg = null;\n        break;   \n    default:\n        msg = null;\n    \tbreak;\n\n}\n\nif(context.data.tempsmn === true ) {\n    msg.payload = context.data.temp_cap;\n\treturn msg;\n} \n//else return msg;\n",
    "outputs": 1,
    "noerr": 0,
    "x": 570,
    "y": 160,
    "wires": [
        [
            "222bdeed.402762",
            "82b13b72.fbdb"
        ]
    ]
},
{
    "id": "d8ffe315.045d9",
    "type": "debug",
    "z": "441f38f7.3482a",
    "name": "",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "false",
    "x": 560,
    "y": 100,
    "wires": []
},
{
    "id": "82b13b72.fbdb",
    "type": "debug",
    "z": "441f38f7.3482a",
    "name": "",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "false",
    "x": 810,
    "y": 140,
    "wires": []
},
{
    "id": "222bdeed.402762",
    "type": "ui_chart",
    "z": "441f38f7.3482a",
    "name": "char temp",
    "group": "77b5652b.76cee4",
    "order": 24,
    "width": 5,
    "height": 3,
    "label": "",
    "chartType": "line",
    "legend": "false",
    "xformat": "HH:mm",
    "interpolate": "linear",
    "nodata": "",
    "dot": false,
    "ymin": "",
    "ymax": "",
    "removeOlder": 1,
    "removeOlderPoints": "",
    "removeOlderUnit": "86400",
    "cutout": 0,
    "useOneColor": false,
    "useUTC": false,
    "colors": [
        "#ff8000",
        "#aec7e8",
        "#f94f06",
        "#2ca02c",
        "#98df8a",
        "#d62728",
        "#ff9896",
        "#9467bd",
        "#c5b0d5"
    ],
    "outputs": 1,
    "x": 820,
    "y": 220,
    "wires": [
        []
    ]
},
{
    "id": "c13f02b7.777c68",
    "type": "inject",
    "z": "441f38f7.3482a",
    "name": "reception temperature simulation 12.45",
    "topic": "",
    "payload": "12.45",
    "payloadType": "str",
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": 0.1,
    "x": 190,
    "y": 180,
    "wires": [
        [
            "6fba18d2.f80df"
        ]
    ]
},
{
    "id": "c71f2eda.2c7dc",
    "type": "inject",
    "z": "441f38f7.3482a",
    "name": "reception temperature simulation 9.25",
    "topic": "",
    "payload": "9.25",
    "payloadType": "str",
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": 0.1,
    "x": 190,
    "y": 300,
    "wires": [
        [
            "6fba18d2.f80df"
        ]
    ]
},
{
    "id": "bb405121.59af98",
    "type": "inject",
    "z": "441f38f7.3482a",
    "name": "reception temperature simulation 5.5",
    "topic": "",
    "payload": "5.5",
    "payloadType": "str",
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": 0.1,
    "x": 190,
    "y": 360,
    "wires": [
        [
            "6fba18d2.f80df"
        ]
    ]
},
{
    "id": "70a221fb.a781f8",
    "type": "debug",
    "z": "441f38f7.3482a",
    "name": "",
    "active": false,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "false",
    "x": 590,
    "y": 300,
    "wires": []
},
{
    "id": "77b5652b.76cee4",
    "type": "ui_group",
    "name": "Group 1",
    "tab": "7b41b1f3.424128",
    "order": 1,
    "disp": true,
    "width": 6
},
{
    "id": "7b41b1f3.424128",
    "type": "ui_tab",
    "z": "",
    "name": "Home",
    "icon": "home",
    "order": 1
}

]