Feinstaub (Particulate Matter, Pył ) Messung mit dem Raspberry Pi aus einer JSON Datei und NodeRED – Teil 1

Man kann mit dem Raspberry Pi auch Feinstaub messen, wenn man einen entsprechenden Sensor hat.

In diesem 1. Teil, beschreibe ich, wie man Messwerte aus öffentlicher Quelle, auch um später Vergleichswerte zu haben auswertet. Die Niedersächsische Gewerbeaufsicht misst Umweltdaten und stellt sie zur freien Verfügung bereit. Unter LÜN gibt es z.B. das Ergebniss für Hannover. Da gibt es auch eine kostenlose App für diese Daten für alle Handys.

Hier nun die Architektur:

Feinstaub (Particulate Matter, Pył ) Messung mit dem Raspberry Pi aus einer JSON Datei und NodeRED – Teil 1

Die Daten für zur Zeit 27 Messstationen werden im JSON-Format (und auch XML) im Internet frei veröffentlicht unter der URL: http://www.luen-ni.de/JSON.txt und enthalten ua. folgende Daten:

- Feinstaub
- Stickstoffdioxid 
- Windrichtung
- Windgeschwindigkeit
- Ozon 
- Luftdruck
- Schwefeldioxid 
- Regendauer
- Kohlenmonoxid 
- UV-Index
- Temperatur 
- Globalstrahlung
- Rel. Luftfeuchtigkeit

Dies JSON Daten werden von mir 2 mal am Tag eingelesen und an Thingspeak für eine Grafik und per Pushover an mein Handy versendet. Das ganze läuft auf einem Raspberry Pi mit NodeRED. Das ist der Flow auch mit den anderen Werten zur Verwendung:

Feinstaub (Particulate Matter, Pył ) Messung mit dem Raspberry Pi aus einer JSON Datei und NodeRED – Teil 1

Mich interessiert erst einmal nur der Feinstaub. Da habe ich vor ein paar Tagen schon mal eine Mindmap erstellt. Über einen Button in der GUI kann der aktuelle PM10 Wert jederzeit angezeigt werden.

Der Wert für Feinstaub und Hannover bekommt man aus der JSON Datei mit folgenden JSONPath Ausdruck.

Da bei ist die 10 die Messtelle Hannover (DENI054 es gibt in Hannover noch eine andere an der Göttinger Ch.) und die 47 ist der letzte gemessene Wert.

$.messwerte.10.messstellen.0.verlauf.47

Die Monatsprotokolle aller Messstellen sind hier zu finden und eine schöne Übersicht hier.

Wer will, kann sich den von mir entwickelten Flow hier kopieren, und nach seinen Wünsche anpassen:

[
    {
        "id": "6fc7c919.4cb8f",
        "type": "inject",
        "z": "8c738661.d2ae58",
        "name": "Täglich um 15:30 Uhr",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "30 15 * * *",
        "once": false,
        "x": 160,
        "y": 200,
        "wires": [
            [
                "de02db66.df05a8"
            ]
        ]
    },
    {
        "id": "de02db66.df05a8",
        "type": "http request",
        "z": "8c738661.d2ae58",
        "name": "Wetter LÜN",
        "method": "GET",
        "ret": "obj",
        "url": "http://www.luen-ni.de/JSON.txt",
        "tls": "",
        "x": 390,
        "y": 160,
        "wires": [
            [
                "503e055b.35922c",
                "f5376ae5.643cd8",
                "ec9c9358.c18338",
                "41771794.1023",
                "c3758f6d.4984d8",
                "e9283ab2.4af498",
                "53e24aa3.c7b2bc",
                "1802f25.b55c50e",
                "fffc81b.15329",
                "5cda4d1c.3d0f44"
            ]
        ]
    },
    {
        "id": "3aec92e9.65a7c6",
        "type": "debug",
        "z": "8c738661.d2ae58",
        "name": "",
        "active": false,
        "complete": false,
        "x": 690,
        "y": 620,
        "wires": []
    },
    {
        "id": "503e055b.35922c",
        "type": "contrib-json",
        "z": "8c738661.d2ae58",
        "engine": "JSONPath",
        "command": "jq",
        "expr": "$.messwerte.10.messstellen.0.verlauf.47",
        "complete": "property",
        "prop": "payload",
        "name": "Feinstaub PM10 Wert in yg/m3",
        "x": 410,
        "y": 260,
        "wires": [
            [
                "3aec92e9.65a7c6",
                "995b3669.26e1a",
                "5c1fc0d9.85b138"
            ]
        ]
    },
    {
        "id": "f66cbc54.3084c",
        "type": "comment",
        "z": "8c738661.d2ae58",
        "name": "Datenquelle: http://www.luen-ni.de/JSON.txt",
        "info": "http://www.umwelt.niedersachsen.de/themen/luft/LUEN/aktuelle_messwerte/archiv/messwertarchiv-9108.html",
        "x": 210,
        "y": 80,
        "wires": []
    },
    {
        "id": "f5376ae5.643cd8",
        "type": "contrib-json",
        "z": "8c738661.d2ae58",
        "engine": "JSONPath",
        "command": "jq",
        "expr": "$.messwerte.10.messstellen.3.verlauf.47",
        "complete": "property",
        "prop": "payload",
        "name": "Temperatur Wert in Grad Celsius",
        "x": 410,
        "y": 380,
        "wires": [
            [
                "3aec92e9.65a7c6",
                "5c10203.6606de"
            ]
        ]
    },
    {
        "id": "ec9c9358.c18338",
        "type": "contrib-json",
        "z": "8c738661.d2ae58",
        "engine": "JSONPath",
        "command": "jq",
        "expr": "$.messwerte.10.messstellen.4.verlauf.47",
        "complete": "property",
        "prop": "payload",
        "name": "Luftdruck Wert in hPa",
        "x": 380,
        "y": 420,
        "wires": [
            [
                "3aec92e9.65a7c6"
            ]
        ]
    },
    {
        "id": "41771794.1023",
        "type": "contrib-json",
        "z": "8c738661.d2ae58",
        "engine": "JSONPath",
        "command": "jq",
        "expr": "$.messwerte.10.messstellen.7.verlauf.47",
        "complete": "property",
        "prop": "payload",
        "name": "Rel. Feuchte in % (TF)",
        "x": 380,
        "y": 540,
        "wires": [
            [
                "3aec92e9.65a7c6"
            ]
        ]
    },
    {
        "id": "c3758f6d.4984d8",
        "type": "contrib-json",
        "z": "8c738661.d2ae58",
        "engine": "JSONPath",
        "command": "jq",
        "expr": "$.messwerte.10.messstellen.9.verlauf.47",
        "complete": "property",
        "prop": "payload",
        "name": "Letzter Globalstrahlung in W/m2 (g)",
        "x": 420,
        "y": 620,
        "wires": [
            [
                "3aec92e9.65a7c6"
            ]
        ]
    },
    {
        "id": "e9283ab2.4af498",
        "type": "contrib-json",
        "z": "8c738661.d2ae58",
        "engine": "JSONPath",
        "command": "jq",
        "expr": "$.messwerte.10.messstellen.2.verlauf.47",
        "complete": "property",
        "prop": "payload",
        "name": "Ozon Wert in yg/m3",
        "x": 380,
        "y": 340,
        "wires": [
            [
                "3aec92e9.65a7c6"
            ]
        ]
    },
    {
        "id": "a20ef711.9f5f7",
        "type": "comment",
        "z": "8c738661.d2ae58",
        "name": "Abfrage der Messstelle Hannover (HRSW) und senden der Feinstaub Daten per Pushover und Thinkspeak",
        "info": "",
        "x": 400,
        "y": 40,
        "wires": []
    },
    {
        "id": "53e24aa3.c7b2bc",
        "type": "contrib-json",
        "z": "8c738661.d2ae58",
        "engine": "JSONPath",
        "command": "jq",
        "expr": "$.messwerte.10.messstellen.1.verlauf.47",
        "complete": "property",
        "prop": "payload",
        "name": "Stickstoffdioxid Wert in yg/m3 (NO2)",
        "x": 430,
        "y": 300,
        "wires": [
            [
                "3aec92e9.65a7c6"
            ]
        ]
    },
    {
        "id": "1802f25.b55c50e",
        "type": "contrib-json",
        "z": "8c738661.d2ae58",
        "engine": "JSONPath",
        "command": "jq",
        "expr": "$.messwerte.10.messstellen.5.verlauf.47",
        "complete": "property",
        "prop": "payload",
        "name": "Windrichtung Wert in Grad (DD)",
        "x": 410,
        "y": 460,
        "wires": [
            [
                "3aec92e9.65a7c6"
            ]
        ]
    },
    {
        "id": "fffc81b.15329",
        "type": "contrib-json",
        "z": "8c738661.d2ae58",
        "engine": "JSONPath",
        "command": "jq",
        "expr": "$.messwerte.10.messstellen.6.verlauf.47",
        "complete": "property",
        "prop": "payload",
        "name": "Windgeschwindigkeit Wert in m/s (FF)",
        "x": 430,
        "y": 500,
        "wires": [
            []
        ]
    },
    {
        "id": "5cda4d1c.3d0f44",
        "type": "contrib-json",
        "z": "8c738661.d2ae58",
        "engine": "JSONPath",
        "command": "jq",
        "expr": "$.messwerte.10.messstellen.8.verlauf.47",
        "complete": "property",
        "prop": "payload",
        "name": "Regendauer Wert in Minuten (RD)",
        "x": 420,
        "y": 580,
        "wires": [
            [
                "3aec92e9.65a7c6"
            ]
        ]
    },
    {
        "id": "412e26bd.217cd",
        "type": "pushover",
        "z": "8c738661.d2ae58",
        "name": "Sende an Pushover",
        "device": "",
        "title": "Hannover Linden Wetter",
        "priority": 0,
        "sound": "",
        "url": "",
        "url_title": "",
        "x": 930,
        "y": 320,
        "wires": []
    },
    {
        "id": "995b3669.26e1a",
        "type": "template",
        "z": "8c738661.d2ae58",
        "name": "Format",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "Feinstaub: {{payload}} Mikro Gramm pro m3\n",
        "x": 680,
        "y": 260,
        "wires": [
            [
                "412e26bd.217cd",
                "e7cbf924.b1bcf8",
                "e7c487ab.ac2878"
            ]
        ]
    },
    {
        "id": "5c10203.6606de",
        "type": "template",
        "z": "8c738661.d2ae58",
        "name": "Format",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "Temperatur: {{payload}} Grad Celsius",
        "x": 680,
        "y": 380,
        "wires": [
            [
                "412e26bd.217cd",
                "e7cbf924.b1bcf8"
            ]
        ]
    },
    {
        "id": "e7cbf924.b1bcf8",
        "type": "debug",
        "z": "8c738661.d2ae58",
        "name": "",
        "active": false,
        "console": "false",
        "complete": "payload",
        "x": 910,
        "y": 380,
        "wires": []
    },
    {
        "id": "49e322e4.1da15c",
        "type": "comment",
        "z": "8c738661.d2ae58",
        "name": "www.wenzlaff.info",
        "info": "",
        "x": 910,
        "y": 40,
        "wires": []
    },
    {
        "id": "75b44b5c.65353c",
        "type": "ui_button",
        "z": "8c738661.d2ae58",
        "name": "",
        "group": "c18727d3.1b7608",
        "order": 7,
        "width": 0,
        "height": 0,
        "label": "Feinstaub Abfrage Hannover",
        "color": "",
        "bgcolor": "",
        "icon": "",
        "payload": "",
        "payloadType": "str",
        "topic": "",
        "x": 160,
        "y": 120,
        "wires": [
            [
                "de02db66.df05a8"
            ]
        ]
    },
    {
        "id": "e7c487ab.ac2878",
        "type": "ui_toast",
        "z": "8c738661.d2ae58",
        "position": "top right",
        "displayTime": "5",
        "outputs": 0,
        "ok": "OK",
        "cancel": "",
        "topic": "",
        "name": "Ergebnis Dialog",
        "x": 920,
        "y": 260,
        "wires": []
    },
    {
        "id": "5c1fc0d9.85b138",
        "type": "ThingspeakSendSimple",
        "z": "8c738661.d2ae58",
        "name": "An Thingspeak senden",
        "writekey": "KEY",
        "fieldid": "1",
        "x": 720,
        "y": 200,
        "wires": []
    },
    {
        "id": "85d3292c.0c1d4",
        "type": "inject",
        "z": "8c738661.d2ae58",
        "name": "Täglich um 6:30 Uhr",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "30 6 * * *",
        "once": false,
        "x": 160,
        "y": 160,
        "wires": [
            [
                "de02db66.df05a8"
            ]
        ]
    },
    {
        "id": "3a1f164f.75bf8a",
        "type": "comment",
        "z": "8c738661.d2ae58",
        "name": "Siehe: https://thingspeak.com/channels/277565",
        "info": "",
        "x": 800,
        "y": 160,
        "wires": []
    },
    {
        "id": "c18727d3.1b7608",
        "type": "ui_group",
        "z": "",
        "name": "wenzlaff.info",
        "tab": "a9e39ea1.b18f3",
        "disp": false,
        "width": "6"
    },
    {
        "id": "a9e39ea1.b18f3",
        "type": "ui_tab",
        "z": "",
        "name": "wenzlaff.info",
        "icon": "dashboard"
    }
]

Fragen oder Anregungen? Gern als Post oder Like!

Ähnliche Artikel:

  1. Überwachung: Automatischer Ping an Server mit NodeRED auf Raspberry Pi (مراقبة)
  2. Node-RED von IBM für den Raspberry Pi auf Jessie
  3. Upgrade von Node-RED-Contrib-UI nach Node-RED-Dashboard

wallpaper-1019588
Final Fantasy XII – Brettspiel zum PS2-Klassiker angekündigt
wallpaper-1019588
Super Nintendo World – „Donkey Kong Country“-Eröffnung verschoben
wallpaper-1019588
Pokémon Karmesin und Purpur – Neues Tera-Raid-Event am Wochenende
wallpaper-1019588
Sonic Dream Team – Sega veröffentlicht zweites Inhaltsupdate