Hier mal ein kleines Beispiel dafür, was ein Raspberry Pi noch alles so mit Node-Red auf die Schnelle und sehr einfach mit auslesen kann. Diesmal geht es um das Thema Wetter. An vielen Orten wird vom Deutschen Wetterdienst, DWD, eine Wetterstation betrieben. So auch in Schloß-Holte Stukenbrock. Die Kennung unserer Station hier lautet P0232.
Gegeben sei folgende Aufgabe: Lies die Daten der Wetterstation aus und zeige die Daten im Dashboard an.
Um die Daten auszulesen muss die Palette „node-red-contrib-dwd-local-weather“ installiert werden. Danach ist der Node für die Abfrage der Station verfügbar. Der Node stellt diese Daten im msg-Objekt zur Verfügung. Für die Anzeige muss das msg-Objekt etwas auseinander genommen werden. Dieses erfolgt mit einem CHANGE Node. Ein Inject Node startet die Datenabfrage alle x Sekunden, Minuten, …
Hier ist der Code zum Import, wer mag kann das gern einmal ausprobieren. Viel Spaß dabei.
[
{
"id": "2740ca08f2560eb7",
"type": "dwdweather",
"z": "f4ab87a35fa1925f",
"name": "",
"mosmixStation": "P0232",
"lookAheadHours": "0",
"additionalFields": "",
"omitMessageOnStart": true,
"repeat": "0",
"topic": "",
"x": 270,
"y": 320,
"wires": [
[
"e9d10f6cb793b276",
"40ead01ede229631",
"3e6ac3b7520c0fc8",
"0886356e296aad0f",
"8884c76f14eb54ec",
"d1d7cb50a0544c20"
]
]
},
{
"id": "303c797eb63196b4",
"type": "inject",
"z": "f4ab87a35fa1925f",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "300",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 110,
"y": 320,
"wires": [
[
"2740ca08f2560eb7"
]
]
},
{
"id": "8ae4433f02fe2bbd",
"type": "ui_gauge",
"z": "f4ab87a35fa1925f",
"name": "",
"group": "64f84e9efb68df3c",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Temperatur",
"label": "°C",
"format": "{{value}}",
"min": "-15",
"max": "40",
"colors": [
"#b30000",
"#1be600",
"#cb3a3a"
],
"seg1": "",
"seg2": "",
"className": "",
"x": 910,
"y": 320,
"wires": []
},
{
"id": "e9d10f6cb793b276",
"type": "change",
"z": "f4ab87a35fa1925f",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.tempc",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 710,
"y": 320,
"wires": [
[
"8ae4433f02fe2bbd"
]
]
},
{
"id": "8f76c3e37cbb2543",
"type": "ui_gauge",
"z": "f4ab87a35fa1925f",
"name": "",
"group": "64f84e9efb68df3c",
"order": 2,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Luftfeuchtigkeit",
"label": "%",
"format": "{{value}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"className": "",
"x": 920,
"y": 380,
"wires": []
},
{
"id": "40ead01ede229631",
"type": "change",
"z": "f4ab87a35fa1925f",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.humidity",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 710,
"y": 380,
"wires": [
[
"8f76c3e37cbb2543"
]
]
},
{
"id": "a0e9f18fd3228959",
"type": "ui_gauge",
"z": "f4ab87a35fa1925f",
"name": "",
"group": "e18ad5d84e92ad29",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Windgeschwindigkeit",
"label": "m/s",
"format": "{{value}}",
"min": 0,
"max": "20",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"className": "",
"x": 940,
"y": 440,
"wires": []
},
{
"id": "3e6ac3b7520c0fc8",
"type": "change",
"z": "f4ab87a35fa1925f",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.windspeed",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 710,
"y": 440,
"wires": [
[
"a0e9f18fd3228959"
]
]
},
{
"id": "0886356e296aad0f",
"type": "change",
"z": "f4ab87a35fa1925f",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.winddirection",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 710,
"y": 500,
"wires": [
[
"a62a7361744baa74"
]
]
},
{
"id": "8884c76f14eb54ec",
"type": "change",
"z": "f4ab87a35fa1925f",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.precipitationNext24h",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 710,
"y": 560,
"wires": [
[
"0bcb9395d450a1ad"
]
]
},
{
"id": "d1d7cb50a0544c20",
"type": "change",
"z": "f4ab87a35fa1925f",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.precipitation_perc",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 710,
"y": 620,
"wires": [
[
"161cdce4826d487c"
]
]
},
{
"id": "0bcb9395d450a1ad",
"type": "ui_text",
"z": "f4ab87a35fa1925f",
"group": "c1bee9a314e67e19",
"order": 2,
"width": 0,
"height": 0,
"name": "",
"label": "Niederschlag in nächsten 24h in kg/m2",
"format": "{{msg.payload}}",
"layout": "col-center",
"className": "",
"x": 990,
"y": 560,
"wires": []
},
{
"id": "161cdce4826d487c",
"type": "ui_gauge",
"z": "f4ab87a35fa1925f",
"name": "",
"group": "c1bee9a314e67e19",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Niederschlagswahrscheinlichkeit",
"label": "%",
"format": "{{value}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"className": "",
"x": 970,
"y": 620,
"wires": []
},
{
"id": "a62a7361744baa74",
"type": "ui_gauge",
"z": "f4ab87a35fa1925f",
"name": "",
"group": "e18ad5d84e92ad29",
"order": 2,
"width": 0,
"height": 0,
"gtype": "compass",
"title": "Windkompass",
"label": "Grad",
"format": "{{value}}",
"min": 0,
"max": "360",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"className": "",
"x": 920,
"y": 500,
"wires": []
},
{
"id": "8ee7cb69ebf17889",
"type": "comment",
"z": "f4ab87a35fa1925f",
"name": "Hier werden die Daten der DWD Wetterstation P0232 SHS ausgelesen",
"info": "",
"x": 270,
"y": 260,
"wires": []
},
{
"id": "64f84e9efb68df3c",
"type": "ui_group",
"name": "DWD P0232 Temp/ Feutigkeit",
"tab": "82b1024b5995a8f8",
"order": 2,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "e18ad5d84e92ad29",
"type": "ui_group",
"name": "DWD P0232 Wind",
"tab": "82b1024b5995a8f8",
"order": 3,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "c1bee9a314e67e19",
"type": "ui_group",
"name": "DWD P0232 Niederschlag",
"tab": "82b1024b5995a8f8",
"order": 4,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "82b1024b5995a8f8",
"type": "ui_tab",
"name": "Schloss-Holte Stukenbrock",
"icon": "dashboard",
"order": 7,
"disabled": false,
"hidden": false
}
]
Hinterlasse einen Kommentar