Tutorial - Informationen zum Pollenflug-Risiko abrufen

Hallo,

Hier möchte ich Ihnen zeigen, wie Sie die Pollenrisiko-Informationen abrufen und dann in ein MQTT-Topic übertragen können.
Die Daten stammen von dieser Website: https://www.pollens.fr

Das Endergebnis:

Hier ist der Node-Red-Fluss:
(Ein Catch-All ist vorhanden, um Fehler abzufangen und per E-Mail zu versenden)

Hier ist der Fluss im JSON-Format zum Importieren in Ihren Node-Red:
(Die Werte werden jeden Morgen um 9:00 Uhr abgerufen)

[
    {
        "id": "bbc343252cb25eac",
        "type": "tab",
        "label": "Flux - Pollen",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "7ac575237abb4457",
        "type": "http request",
        "z": "bbc343252cb25eac",
        "name": "API-Anfrage",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "https://www.pollens.fr/risks/thea/counties/69",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 350,
        "y": 340,
        "wires": [
            [
                "bf36dd6349fe905f"
            ]
        ]
    },
    {
        "id": "bf36dd6349fe905f",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Daten extrahieren",
        "func": "const data = msg.payload;\n\n// Relevante Informationen extrahieren\nconst pollenRisks = data?.risks;\n\n// Erstelle separate Nachrichten für jeden pollenName\nconst messages = pollenRisks.map(risk => {\n    let levelNumber = 0; // Standardmäßig 0, wenn das Level unbekannt ist\n    switch (risk.level) {\n        case 0:\n        case 1:\n        case 2:\n        case 3:\n            levelNumber = risk.level;\n            break;\n    }\n    return {\n        topic: `pollen/${risk.pollenName}`, // Topic ist einzigartig für jeden pollenName\n        payload: levelNumber\n    };\n});\n\n// Alle Nachrichten ausgeben\nfor (const message of messages) {\n    node.send({ payload: message });\n}",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 530,
        "y": 340,
        "wires": [
            [
                "ebb744a52f2d0284"
            ]
        ]
    },
    {
        "id": "7552d67540a2d961",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Urticaceae",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:urticacees/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1260,
        "y": 20,
        "wires": []
    },
    {
        "id": "738b03c93b31f727",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Linde",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:tilleul/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1250,
        "y": 60,
        "wires": []
    },
    {
        "id": "a12343f669e4f8ce",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Weide",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:saule/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1240,
        "y": 100,
        "wires": []
    },
    {
        "id": "dc592ae8bba8cef2",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Platane",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:platane/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1240,
        "y": 140,
        "wires": []
    },
    {
        "id": "30f2ee8f4b0b53bf",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Wegerich",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:plantain/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1240,
        "y": 180,
        "wires": []
    },
    {
        "id": "24a47cf2553c0f7c",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Pappel",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:peuplier/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1230,
        "y": 220,
        "wires": []
    },
    {
        "id": "bc93d0fd53439b94",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Sauerampfer",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:oseille/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1230,
        "y": 260,
        "wires": []
    },
    {
        "id": "6832327866bc04d4",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Olivier",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:olivier/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1230,
        "y": 300,
        "wires": []
    },
    {
        "id": "e2fced2c1228b5b3",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Hasel",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:noisetier/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1230,
        "y": 340,
        "wires": []
    },
    {
        "id": "c9e8b061faf6b7ab",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Gräser",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:graminees/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1240,
        "y": 380,
        "wires": []
    },
    {
        "id": "68afc7734f581758",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Esche",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:frene/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1220,
        "y": 420,
        "wires": []
    },
    {
        "id": "92ad5dd377dc541f",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Zypressen",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:cupressacees/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1250,
        "y": 460,
        "wires": []
    },
    {
        "id": "939b222b7f7c1e9e",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Eiche",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:chene/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1230,
        "y": 500,
        "wires": []
    },
    {
        "id": "e67e604f59541e3c",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Kastanie",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:chataignier/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1250,
        "y": 540,
        "wires": []
    },
    {
        "id": "4ade92344aec1398",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Hainbuche",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:charme/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1230,
        "y": 580,
        "wires": []
    },
    {
        "id": "9d07f4044c43f4ca",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Birke",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:bouleau/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1230,
        "y": 620,
        "wires": []
    },
    {
        "id": "c52ccb37cc771e50",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Erle",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:aulne/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1220,
        "y": 660,
        "wires": []
    },
    {
        "id": "63ebd22212600817",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Beifuß",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:armoise/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1230,
        "y": 700,
        "wires": []
    },
    {
        "id": "b5014ef4d4b78031",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Beifuß",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:ambroisies/state",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1230,
        "y": 740,
        "wires": []
    },
    {
        "id": "ebb744a52f2d0284",
        "type": "switch",
        "z": "bbc343252cb25eac",
        "name": "",
        "property": "payload.topic",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "Urticacées",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Tilleul",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Saule",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Platane",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Plantain",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Peuplier",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Oseille",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Olivier",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Noisetier",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Graminées",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Frêne",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Cupressacées",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Chêne",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Châtaignier",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Charme",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Bouleau",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Aulne",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Armoise",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "Ambroisies",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 19,
        "x": 710,
        "y": 340,
        "wires": [
            [
                "8d0adde0aff95a13"
            ],
            [
                "45b3b282ee5c7f5b"
            ],
            [
                "141cd61cf70552dc"
            ],
            [
                "0c8d638c799564f0"
            ],
            [
                "a76f02d65b5b251b"
            ],
            [
                "ab7ba6214628bc23"
            ],
            [
                "4b764b9864485c4c"
            ],
            [
                "96b42f8a867b2fc6"
            ],
            [
                "2f2dad2bd71e80f9"
            ],
            [
                "552335c84c6fe8df"
            ],
            [
                "26e08c68dc2065bb"
            ],
            [
                "60bdf90b83076df1"
            ],
            [
                "caec8f89d4738303"
            ],
            [
                "6be8143442f0a2eb"
            ],
            [
                "e43acc2af6e9fe96"
            ],
            [
                "5d402663ddcf3d59"
            ],
            [
                "2c3f0316affb6ae7"
            ],
            [
                "19c57cc67447e518"
            ],
            [
                "e48d51016db99b89"
            ]
        ]
    },
    {
        "id": "141cd61cf70552dc",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 100,
        "wires": [
            [
                "a12343f669e4f8ce"
            ]
        ]
    },
    {
        "id": "45b3b282ee5c7f5b",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 60,
        "wires": [
            [
                "738b03c93b31f727"
            ]
        ]
    },
    {
        "id": "8d0adde0aff95a13",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 20,
        "wires": [
            [
                "7552d67540a2d961"
            ]
        ]
    },
    {
        "id": "0c8d638c799564f0",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 140,
        "wires": [
            [
                "dc592ae8bba8cef2"
            ]
        ]
    },
    {
        "id": "a76f02d65b5b251b",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 180,
        "wires": [
            [
                "30f2ee8f4b0b53bf"
            ]
        ]
    },
    {
        "id": "ab7ba6214628bc23",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 220,
        "wires": [
            [
                "24a47cf2553c0f7c"
            ]
        ]
    },
    {
        "id": "4b764b9864485c4c",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 260,
        "wires": [
            [
                "bc93d0fd53439b94"
            ]
        ]
    },
    {
        "id": "96b42f8a867b2fc6",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 300,
        "wires": [
            [
                "6832327866bc04d4"
            ]
        ]
    },
    {
        "id": "2f2dad2bd71e80f9",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 340,
        "wires": [
            [
                "e2fced2c1228b5b3"
            ]
        ]
    },
    {
        "id": "552335c84c6fe8df",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 380,
        "wires": [
            [
                "c9e8b061faf6b7ab"
            ]
        ]
    },
    {
        "id": "26e08c68dc2065bb",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 420,
        "wires": [
            [
                "68afc7734f581758"
            ]
        ]
    },
    {
        "id": "60bdf90b83076df1",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 460,
        "wires": [
            [
                "92ad5dd377dc541f"
            ]
        ]
    },
    {
        "id": "caec8f89d4738303",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 500,
        "wires": [
            [
                "939b222b7f7c1e9e"
            ]
        ]
    },
    {
        "id": "6be8143442f0a2eb",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 540,
        "wires": [
            [
                "e67e604f59541e3c"
            ]
        ]
    },
    {
        "id": "e43acc2af6e9fe96",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 580,
        "wires": [
            [
                "4ade92344aec1398"
            ]
        ]
    },
    {
        "id": "5d402663ddcf3d59",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 620,
        "wires": [
            [
                "9d07f4044c43f4ca"
            ]
        ]
    },
    {
        "id": "2c3f0316affb6ae7",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 660,
        "wires": [
            [
                "c52ccb37cc771e50"
            ]
        ]
    },
    {
        "id": "19c57cc67447e518",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 700,
        "wires": [
            [
                "63ebd22212600817"
            ]
        ]
    },
    {
        "id": "e48d51016db99b89",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Wert extrahieren",
        "func": "const topic = msg.payload.topic;\nconst payload = msg.payload.payload;\nmsg.topic = topic;\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 740,
        "wires": [
            [
                "b5014ef4d4b78031"
            ]
        ]
    },
    {
        "id": "6e9a8b6333516061",
        "type": "cronplus",
        "z": "bbc343252cb25eac",
        "name": "Cron",
        "outputField": "payload",
        "timeZone": "",
        "storeName": "",
        "commandResponseMsgOutput": "output1",
        "defaultLocation": "",
        "defaultLocationType": "default",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 07 * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 190,
        "y": 340,
        "wires": [
            [
                "7ac575237abb4457",
                "aa3e0879.49a3d8"
            ]
        ]
    },
    {
        "id": "4e5ac12b.2d8a4c",
        "type": "catch",
        "z": "bbc343252cb25eac",
        "name": "Fehler",
        "scope": null,
        "uncaught": false,
        "x": 170,
        "y": 240,
        "wires": [
            [
                "29c9f07e.2920d6"
            ]
        ]
    },
    {
        "id": "29c9f07e.2920d6",
        "type": "e-mail",
        "z": "bbc343252cb25eac",
        "server": "monserveuremail",
        "port": "465",
        "authtype": "BASIC",
        "saslformat": false,
        "token": "oauth2Response.access_token",
        "secure": true,
        "tls": true,
        "name": "monadresse@email.fr",
        "dname": "Mail",
        "x": 320,
        "y": 240,
        "wires": []
    },
    {
        "id": "aa3e0879.49a3d8",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Aktuelles Datum & Uhrzeit abrufen",
        "func": "// Aktuelles Datum und Uhrzeit für Paris abrufen\nvar currentDate = new Date();\n\n// Zeitverschiebung für Paris berechnen (in Minuten)\nvar offsetParis = 120; // Zeitverschiebung für Paris (UTC+2) in Minuten\n\n// Zeitverschiebung von Paris zum aktuellen Datum hinzufügen\ncurrentDate.setMinutes(currentDate.getMinutes() + offsetParis);\n\n// Komponenten des Datums und der Uhrzeit abrufen\nvar day = (\"0\" + currentDate.getDate()).slice(-2);\nvar month = (\"0\" + (currentDate.getMonth() + 1)).slice(-2);\nvar year = currentDate.getFullYear();\nvar hours = (\"0\" + currentDate.getHours()).slice(-2);\nvar minutes = (\"0\" + currentDate.getMinutes()).slice(-2);\n\n// Komponenten zusammenfügen, um das gewünschte Format zu erhalten\nvar formattedDate = day + \"/\" + month + \"/\" + year + \" \" + hours + \":\" + minutes;\n\n// Antwortobjekt erstellen\nvar msg = {\n    payload: formattedDate\n};\n\n// Ausgabemeldung senden\nreturn msg;\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1010,
        "y": 780,
        "wires": [
            [
                "8bec17071380c5a3"
            ]
        ]
    },
    {
        "id": "8bec17071380c5a3",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "Datum/Uhrzeit",
        "topic": "gladys/master/device/mqtt:pollens/feature/mqtt:pollens-date-maj/text",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ee77e0f90aa9681",
        "x": 1230,
        "y": 780,
        "wires": []
    },
    {
        "id": "0ee77e0f90aa9681",
        "type": "mqtt-broker",
        "name": "Gladys",
        "broker": "mqtt://192.168.xx.xx",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthRetain": "false",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closeRetain": "false",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willRetain": "false",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]

Denken Sie daran, die Nummer Ihres Departements im Knoten « Api Request » zu ändern
Und auch die IP-Adresse Ihres MQTT-Brokers

Hier ist das MQTT-Gerät mit den Funktionen:











Wenn Sie Fragen oder Anmerkungen haben, zögern Sie nicht, mir Bescheid zu sagen :slight_smile:

Changelog (künftig):

  • Keine (Ihre Kommentare :slight_smile: )

Edit 13/05/2024:

  • Änderung der Funktionsarten in Risikostufen mit der Veröffentlichung der Version 4.41.0 von Gladys

Edit 15/05/2024:

  • Hinzufügen des Datums und der Uhrzeit der Aktualisierung

Sacré flow Node-RED :joy:

Man muss schauen, ob es eine bestehende Funktion gibt, die deiner ähnelt und bunte Badges hat

Falls nicht, kann man es zu Gladys hinzufügen, das ist eigentlich ganz einfach.

Echt jetzt, das ist ein richtig guter Flow :sweat_smile:
Danke für dein Feedback.
Ich glaube nicht, dass es eine bestehende Funktion gibt, die dem hier nahekommt :frowning:

Soll ich dafür einen Feature-Request erstellen?

hallo @prohand

du hast einen kleinen Fehler in Zeile 1002 deines Flows

        "name": "aremplacer@monmail.fr),
=>
        "name": "aremplacer@monmail.fr",

Ansonsten ist der Flow aber sehr gut! Node-Red für Gladys ist wirklich ein unverzichtbares Add-on für Gladys! :blush:

Hallo,

Danke, das ist geändert :wink:
Tatsächlich ist Node Red eine unverzichtbare Ergänzung zu Gladys

Gerne! :slight_smile:

Das ist erledigt :slight_smile:

Danke für dieses Beispiel, das den Vorteil verdeutlicht, das Thema in Gladys angeben zu können. Wenn dies möglich wäre, müsste man im Knotenpunkt „Extract Data“ das Thema für jedes Allergen formatieren und es direkt an einen einzigen Knotenpunkt „MQTT out“ weiterleiten. In Gladys müsste man das richtige Thema jeder Funktion bei ihrer Erstellung zuordnen. Die Vervielfältigung der Knotenpunkte würde überflüssig werden.

Ja, ich bin deiner Meinung, aber ich habe nicht herausgefunden, wie man das macht :frowning:

Hallo,
man kann sehr gut nur einen MQTT-Ausgang haben.

Ich habe nur den Ausgang geändert

[
    {
        "id": "bbc343252cb25eac",
        "type": "tab",
        "label": "Flux - Pollens",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "7ac575237abb4457",
        "type": "http request",
        "z": "bbc343252cb25eac",
        "name": "API Request",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "https://www.pollens.fr/risks/thea/counties/69",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 350,
        "y": 340,
        "wires": [
            [
                "bf36dd6349fe905f"
            ]
        ]
    },
    {
        "id": "bf36dd6349fe905f",
        "type": "function",
        "z": "bbc343252cb25eac",
        "name": "Extract Data",
        "func": "const data = msg.payload;\n\n// Extract relevant information\nconst pollenRisks = data?.risks;\n\n// Create separate messages for each pollenName\nconst messages = pollenRisks.map(risk => {\n    let levelText = \"\";\n    switch (risk) {\n        case 0:\n            levelText = \"Aucun\";\n            break;\n        case 1:\n            levelText = \"Faible\";\n            break;\n        case 2:\n            levelText = \"Moyen\";\n            break;\n        case 3:\n            levelText = \"Elevée\";\n            break;\n        default:\n            levelText = \"Inconnu\";\n            break;\n    }\n    //Pour enlever les accents\n    const removeAccents = str =>\n        str.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '');\n\n    let a = removeAccents(risk.pollenName);\n    a = a.toLowerCase()//Mettre en commentaire cette ligne pour laisser le premier caractère e un majuscules\n    msg.topic = \"gladys/master/device/mqtt:pollens/feature/mqtt:\" + a + \"/text\";\n    msg.payload = levelText ;\n    node.send(msg);\n    //return {\n        //topic: `pollen/${risk.pollenName}`, // Topic is unique for each pollenName\n        //topic: risk.pollenName, // Topic is unique for each pollenName\n        //payload: levelText,\n    //};\n});\n\n// Output all messages\n//for (const message of messages) {\n//    node.send({ payload: message });\n//}\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 530,
        "y": 340,
        "wires": [
            [
                "5810137e3ac9c2a1",
                "8ee9057a695c554b"
            ]
        ]
    },
    {
        "id": "6e9a8b6333516061",
        "type": "cronplus",
        "z": "bbc343252cb25eac",
        "name": "Cron",
        "outputField": "payload",
        "timeZone": "",
        "storeName": "",
        "commandResponseMsgOutput": "output1",
        "defaultLocation": "",
        "defaultLocationType": "default",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 07 * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 190,
        "y": 340,
        "wires": [
            [
                "7ac575237abb4457"
            ]
        ]
    },
    {
        "id": "4e5ac12b.2d8a4c",
        "type": "catch",
        "z": "bbc343252cb25eac",
        "name": "Erreurs",
        "scope": null,
        "uncaught": false,
        "x": 170,
        "y": 240,
        "wires": [
            []
        ]
    },
    {
        "id": "5810137e3ac9c2a1",
        "type": "debug",
        "z": "bbc343252cb25eac",
        "name": "envoi MQTT",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 710,
        "y": 300,
        "wires": []
    },
    {
        "id": "8ee9057a695c554b",
        "type": "mqtt out",
        "z": "bbc343252cb25eac",
        "name": "",
        "topic": "",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "3afb98e8a9f77095",
        "x": 690,
        "y": 340,
        "wires": []
    },
    {
        "id": "3afb98e8a9f77095",
        "type": "mqtt-broker",
        "name": "Gladys",
        "broker": "localhost",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]

Da haben wir uns missverstanden, ich sprach davon, einen Feature-Request für eine pollenbezogene Funktionsart zu erstellen :smiley:

Wir versuchen, in Gladys möglichst spezifische Lösungen zu bieten, nicht generische :slight_smile:

Offensichtlich haben wir uns missverstanden :wink:
Da es Abstimmungen gibt, habe ich die erste Anfrage belassen und gerade eine weitere erstellt.

Ich glaube nicht, dass das etwas ist, was wir bei der ersten Anfrage machen werden ^^ das passt nicht so ganz zur Philosophie

Kein Problem
Falls du möchtest, kannst du den Beitrag komplett löschen :slight_smile:

Ja, das funktioniert zwar, aber dadurch gibt es eine starke Kopplung zwischen der Namensgebung, die von der API verwendet wird, und der Namensgebung, die in Gladys angewendet werden muss.
Persönlich finde ich das auf lange Sicht recht wackelig.

Vielen Dank für dieses Tutorial :pray: Ich habe es auf meiner Seite mit n8n umgesetzt (nur für den Pollen, der mich interessiert).
Ich warte auf die nächste Version, die die Anzeige im Dashboard integriert :wink:

Gern geschehen :wink:
Sobald die nächste Version von Gladys rauskommt, aktualisiere ich den Leitfaden :wink:

Tutorial-Update :slight_smile:
Siehe Changelog im ersten Beitrag.
Danke :wink:

Tutorial-Update :slight_smile:
Siehe Changelog im ersten Beitrag.
Danke :wink:

Hallo,

Ich erlaube mir, das Thema wieder aufzugreifen, super Arbeit, das ist großartig!

Allerdings könntest du mir sagen, wie du den API-Endpoint für Pollen gefunden hast? Ich habe auf Google ziemlich viel gesucht, ohne Erfolg, und sogar einige Dorks (wie inurl:risk site:pollens.fr) bringen nichts, ich würde gerne herausfinden, wie man die Informationen für eine Stadt und nicht für ein Departement bekommt, wenn möglich.

Das Wissen wird es ermöglichen, die Lösung gleichzeitig nachhaltig zu machen :slight_smile:

Vielen Dank :handshake:


EDIT Ich habe meine Recherchen fortgesetzt und die URL auf einem openHAB-Forum gefunden, ich nehme an, die Information wurde dort gefunden, danke :).

Ich setze meine Recherchen fort, um die Daten nur für eine Stadt zu erhalten