[
    {
        "id": "7634856244e09432",
        "type": "tab",
        "label": "projecteTempBDGràfAlum",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "b21138381a130816",
        "type": "Bme280",
        "z": "7634856244e09432",
        "name": "sensorBME280",
        "bus": "1",
        "address": "0x",
        "topic": "bme280",
        "extra": false,
        "preasure": 1013.25,
        "x": 480,
        "y": 200,
        "wires": [
            [
                "61d5a4055f4a581a"
            ]
        ]
    },
    {
        "id": "f8b1e87a551f8da1",
        "type": "inject",
        "z": "7634856244e09432",
        "name": "clock",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 110,
        "y": 260,
        "wires": [
            [
                "0538f6d252bd3246",
                "5c6d2d18204f2ba6"
            ]
        ]
    },
    {
        "id": "61d5a4055f4a581a",
        "type": "function",
        "z": "7634856244e09432",
        "name": "formatTemperatura",
        "func": "msg.payload=msg.payload.temperature_C.toFixed(1);\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 710,
        "y": 200,
        "wires": [
            [
                "eeb57ec0e4529a4f",
                "e470fe1dd1ed3b0a",
                "18ae0d8354ef9eb6"
            ]
        ]
    },
    {
        "id": "eeb57ec0e4529a4f",
        "type": "ui_gauge",
        "z": "7634856244e09432",
        "name": "mostraTemperatura",
        "group": "68b4d4419e69d76f",
        "order": 2,
        "width": 6,
        "height": 4,
        "gtype": "gage",
        "title": "Temperatura",
        "label": "ºC",
        "format": "{{value}}",
        "min": "-10",
        "max": "45",
        "colors": [
            "#1a5fb4",
            "#26a269",
            "#e01b24"
        ],
        "seg1": "20",
        "seg2": "26",
        "diff": false,
        "className": "",
        "x": 950,
        "y": 200,
        "wires": []
    },
    {
        "id": "0538f6d252bd3246",
        "type": "simpletime",
        "z": "7634856244e09432",
        "name": "dataHora",
        "mydate": false,
        "myymd": true,
        "myyear": false,
        "mymonth": false,
        "mymonthn": false,
        "mymonthf": false,
        "mydom": false,
        "mydoy": false,
        "myday": false,
        "mydayf": false,
        "myhourpm": false,
        "myhour": false,
        "mytime": false,
        "mytimes": true,
        "myminute": false,
        "myminutes": false,
        "mysecond": false,
        "mymillis": false,
        "myepoch": false,
        "myrawdate": false,
        "mypm": false,
        "x": 280,
        "y": 400,
        "wires": [
            [
                "75e726ba3116faeb"
            ]
        ]
    },
    {
        "id": "16599b34948b5b32",
        "type": "ui_text",
        "z": "7634856244e09432",
        "group": "68b4d4419e69d76f",
        "order": 11,
        "width": 6,
        "height": 1,
        "name": "mostraDataHora",
        "label": "Data i hora:",
        "format": "{{msg.payload}}",
        "layout": "row-center",
        "className": "",
        "style": false,
        "font": "",
        "fontSize": 16,
        "color": "#000000",
        "x": 700,
        "y": 400,
        "wires": []
    },
    {
        "id": "75e726ba3116faeb",
        "type": "function",
        "z": "7634856244e09432",
        "name": "formatDataHora",
        "func": "msg.payload = msg.myymd + \" \" + msg.mytimes; \nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 480,
        "y": 400,
        "wires": [
            [
                "16599b34948b5b32",
                "e470fe1dd1ed3b0a"
            ]
        ]
    },
    {
        "id": "e48172557e704307",
        "type": "function",
        "z": "7634856244e09432",
        "name": "insertaTaulaTemperatures",
        "func": "msg.topic = \"insert into nom_taula(nom_camp_de_data_i_hora,nom_camp_de_valors_de_temperatures) values('\" + msg.payload[0] + \"',\" + msg.payload[1]+\")\";\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 850,
        "y": 300,
        "wires": [
            [
                "d8a2bbc188568b08"
            ]
        ]
    },
    {
        "id": "d8a2bbc188568b08",
        "type": "mysql",
        "z": "7634856244e09432",
        "mydb": "92897dcbb936ebcb",
        "name": "",
        "x": 1070,
        "y": 300,
        "wires": [
            []
        ]
    },
    {
        "id": "e470fe1dd1ed3b0a",
        "type": "join",
        "z": "7634856244e09432",
        "name": "uneix",
        "mode": "custom",
        "build": "array",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": ",",
        "joinerType": "str",
        "useparts": false,
        "accumulate": false,
        "timeout": "",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 620,
        "y": 300,
        "wires": [
            [
                "e48172557e704307"
            ]
        ]
    },
    {
        "id": "5c6d2d18204f2ba6",
        "type": "delay",
        "z": "7634856244e09432",
        "name": "",
        "pauseType": "delay",
        "timeout": "10",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 290,
        "y": 200,
        "wires": [
            [
                "b21138381a130816"
            ]
        ]
    },
    {
        "id": "18ae0d8354ef9eb6",
        "type": "ui_chart",
        "z": "7634856244e09432",
        "name": "grafTemperatures",
        "group": "68b4d4419e69d76f",
        "order": 13,
        "width": 6,
        "height": 4,
        "label": "Gràfica de Temperatures",
        "chartType": "line",
        "legend": "false",
        "xformat": "auto",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "0",
        "ymax": "40",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 970,
        "y": 100,
        "wires": [
            []
        ]
    },
    {
        "id": "554fef89073a36a0",
        "type": "function",
        "z": "7634856244e09432",
        "name": "queryDadesTaulaTemperatures",
        "func": "msg.topic = \"select * from nom_taula\";\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 490,
        "y": 520,
        "wires": [
            [
                "e35e6a3564171c97"
            ]
        ]
    },
    {
        "id": "e35e6a3564171c97",
        "type": "mysql",
        "z": "7634856244e09432",
        "mydb": "9f19bccf804024f2",
        "name": "",
        "x": 750,
        "y": 520,
        "wires": [
            [
                "b9f0d24b3e1e5240"
            ]
        ]
    },
    {
        "id": "7e27e3e1b7cc15a2",
        "type": "ui_button",
        "z": "7634856244e09432",
        "name": "ordreMostraTaulaTemperatures",
        "group": "68b4d4419e69d76f",
        "order": 16,
        "width": 3,
        "height": 1,
        "passthru": false,
        "label": "Mostra Temperatures",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "",
        "payloadType": "date",
        "topic": "topic",
        "topicType": "msg",
        "x": 170,
        "y": 520,
        "wires": [
            [
                "554fef89073a36a0"
            ]
        ]
    },
    {
        "id": "389f69ff5dea995c",
        "type": "ui_chart",
        "z": "7634856244e09432",
        "name": "grafTemperaturesBD",
        "group": "68b4d4419e69d76f",
        "order": 14,
        "width": 6,
        "height": 4,
        "label": "Gràfica de Temperatures BD",
        "chartType": "line",
        "legend": "true",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "No hi han dades disponibles",
        "dot": false,
        "ymin": "0",
        "ymax": "40",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 1120,
        "y": 600,
        "wires": [
            []
        ]
    },
    {
        "id": "b9f0d24b3e1e5240",
        "type": "function",
        "z": "7634856244e09432",
        "name": "preparaDadesaTaulaTemperatura",
        "func": "const temparatures = msg.payload;\n\nvar arrayTemperaturesGrafica=[{\n    \"series\":[\"Temperatures\"],\n    \"data\":[[]],\n    \"labels\":[\"\"]\n}]\n\nfor (let temperatura of temparatures){\n    arrayTemperaturesGrafica[0].data[0].push({\n        x: temperatura.datahora,\n        y: temperatura.valor\n    })\n}\n\nmsg.payload = arrayTemperaturesGrafica;\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1000,
        "y": 520,
        "wires": [
            [
                "389f69ff5dea995c"
            ]
        ]
    },
    {
        "id": "7f49670bd48cb7e1",
        "type": "comment",
        "z": "7634856244e09432",
        "name": "accés a dades i crea gràfiques",
        "info": "https://www.youtube.com/watch?v=VjeOZNmajGk",
        "x": 160,
        "y": 40,
        "wires": []
    },
    {
        "id": "b907a29ee7ed35cb",
        "type": "ui_button",
        "z": "7634856244e09432",
        "name": "esborraGrafica",
        "group": "68b4d4419e69d76f",
        "order": 17,
        "width": 3,
        "height": 1,
        "passthru": false,
        "label": "Esborra Gràfica",
        "tooltip": "",
        "color": "black",
        "bgcolor": "red",
        "className": "",
        "icon": "",
        "payload": "[]",
        "payloadType": "json",
        "topic": "topic",
        "topicType": "msg",
        "x": 860,
        "y": 620,
        "wires": [
            [
                "389f69ff5dea995c"
            ]
        ]
    },
    {
        "id": "01c1a767d0a73f39",
        "type": "comment",
        "z": "7634856244e09432",
        "name": "pas de dades a gràfica",
        "info": "https://github.com/node-red/node-red-dashboard/blob/master/Charts.md\nllegeix -> Stored data -> line charts",
        "x": 140,
        "y": 80,
        "wires": []
    },
    {
        "id": "d615e44b8805cba9",
        "type": "ui_spacer",
        "z": "7634856244e09432",
        "name": "spacer",
        "group": "68b4d4419e69d76f",
        "order": 1,
        "width": 3,
        "height": 1
    },
    {
        "id": "28ee323f3ff02191",
        "type": "ui_spacer",
        "z": "7634856244e09432",
        "name": "spacer",
        "group": "68b4d4419e69d76f",
        "order": 3,
        "width": 3,
        "height": 1
    },
    {
        "id": "a56cfabe7076430b",
        "type": "ui_spacer",
        "z": "7634856244e09432",
        "name": "spacer",
        "group": "68b4d4419e69d76f",
        "order": 4,
        "width": 3,
        "height": 1
    },
    {
        "id": "886461933d91c910",
        "type": "ui_spacer",
        "z": "7634856244e09432",
        "name": "spacer",
        "group": "68b4d4419e69d76f",
        "order": 5,
        "width": 3,
        "height": 1
    },
    {
        "id": "8c9578fe55100752",
        "type": "ui_spacer",
        "z": "7634856244e09432",
        "name": "spacer",
        "group": "68b4d4419e69d76f",
        "order": 6,
        "width": 3,
        "height": 1
    },
    {
        "id": "cc115341359ff385",
        "type": "ui_spacer",
        "z": "7634856244e09432",
        "name": "spacer",
        "group": "68b4d4419e69d76f",
        "order": 7,
        "width": 3,
        "height": 1
    },
    {
        "id": "ec9dab1ab276ae80",
        "type": "ui_spacer",
        "z": "7634856244e09432",
        "name": "spacer",
        "group": "68b4d4419e69d76f",
        "order": 8,
        "width": 3,
        "height": 1
    },
    {
        "id": "1ba51cc726bd7dc4",
        "type": "ui_spacer",
        "z": "7634856244e09432",
        "name": "spacer",
        "group": "68b4d4419e69d76f",
        "order": 9,
        "width": 3,
        "height": 1
    },
    {
        "id": "c821dea496ab4609",
        "type": "ui_spacer",
        "z": "7634856244e09432",
        "name": "spacer",
        "group": "68b4d4419e69d76f",
        "order": 10,
        "width": 3,
        "height": 1
    },
    {
        "id": "a8372c4361a59534",
        "type": "ui_spacer",
        "z": "7634856244e09432",
        "name": "spacer",
        "group": "68b4d4419e69d76f",
        "order": 12,
        "width": 3,
        "height": 1
    },
    {
        "id": "83f832275d06272e",
        "type": "ui_spacer",
        "z": "7634856244e09432",
        "name": "spacer",
        "group": "68b4d4419e69d76f",
        "order": 15,
        "width": 3,
        "height": 1
    },
    {
        "id": "732dd70643153e69",
        "type": "ui_spacer",
        "z": "7634856244e09432",
        "name": "spacer",
        "group": "68b4d4419e69d76f",
        "order": 18,
        "width": 3,
        "height": 1
    },
    {
        "id": "68b4d4419e69d76f",
        "type": "ui_group",
        "name": "grup2BME280",
        "tab": "0850d8afab6a3adb",
        "order": 1,
        "disp": true,
        "width": 12,
        "collapse": false,
        "className": ""
    },
    {
        "id": "92897dcbb936ebcb",
        "type": "MySQLdatabase",
        "name": "",
        "host": "",
        "port": "",
        "db": "",
        "tz": "",
        "charset": "UTF8"
    },
    {
        "id": "9f19bccf804024f2",
        "type": "MySQLdatabase",
        "name": "",
        "host": "",
        "port": "",
        "db": "",
        "tz": "",
        "charset": "UTF8"
    },
    {
        "id": "0850d8afab6a3adb",
        "type": "ui_tab",
        "name": "tab2BME280",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    },
    {
        "id": "8333d5b904d9433c",
        "type": "global-config",
        "env": [],
        "modules": {
            "node-red-contrib-bme280": "1.1.0",
            "node-red-dashboard": "3.6.6",
            "node-red-contrib-simpletime": "3.0.2",
            "node-red-node-mysql": "2.0.0"
        }
    }
]