Wie können die Covid-19 Daten der Johns Hopkins CSSE über die JSON-Api https://covid19.mathdro.id/api in einem Node-RED Flow integriert werden, so das automatisch eine Pushover Nachricht an das Handy versendet wird. Auch ein autom. Tweet an Twitter ist schnell gemacht. Auf einem Raspberry Pi läuft dafür Node-RED.
Hier der Node-RED Flow, der dafür nötig ist:
Und hier die Debug-Nachrich die ausgegeben wird:
Hier der automatische Twitter Eintrag:
Hier der Quellcode des Flows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
[ { "id": "884ebfce.72d028", "type": "tab", "label": "Coronavirus", "disabled": false, "info": "" }, { "id": "e602c35.d1770c", "type": "inject", "z": "884ebfce.72d028", "name": "Täglich um 9:15 Uhr", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "15 09 * * *", "once": false, "onceDelay": 0.1, "x": 140, "y": 100, "wires": [ [ "35fdb980.106f26" ] ] }, { "id": "35fdb980.106f26", "type": "http request", "z": "884ebfce.72d028", "name": "Covid-19 abfragen", "method": "GET", "ret": "obj", "paytoqs": false, "url": "https://covid19.mathdro.id/api", "tls": "", "persist": false, "proxy": "", "authType": "basic", "x": 210, "y": 160, "wires": [ [ "9e353355.0a94e" ] ] }, { "id": "9e353355.0a94e", "type": "function", "z": "884ebfce.72d028", "name": "Covid-19 weltweit Meldung", "func": "\nvar nachricht = \"Bestätigte Personen mit covid-19 weltweit: \" + msg.payload.confirmed.value + \n\" und wiederhergestellt: \" + msg.payload.recovered.value + \n\" und gestorben: \" + msg.payload.deaths.value;\n\nmsg.payload = nachricht;\nmsg.topic = nachricht;\n\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 300, "y": 220, "wires": [ [ "3a1f746c.f0c0fc" ] ] }, { "id": "3a1f746c.f0c0fc", "type": "rbe", "z": "884ebfce.72d028", "name": "Nur bei Änderung des Wert weiter", "func": "rbe", "gap": "", "start": "", "inout": "out", "property": "payload", "x": 380, "y": 280, "wires": [ [ "4a020e21.78c558", "6fd8c4e6.8553e4", "330efe00.b45a22" ] ] }, { "id": "4a020e21.78c558", "type": "debug", "z": "884ebfce.72d028", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 670, "y": 280, "wires": [] }, { "id": "6fd8c4e6.8553e4", "type": "pushover", "z": "884ebfce.72d028", "name": "Sende Pushover Nachricht", "device": "", "title": "Covid-19 Statistik Weltweit", "priority": 0, "sound": "", "url": "http://www.wenzlaff.info", "url_title": "covid-19", "html": false, "x": 480, "y": 340, "wires": [] }, { "id": "622e582b.b2261", "type": "comment", "z": "884ebfce.72d028", "name": "www.wenzlaff.info", "info": "", "x": 770, "y": 40, "wires": [] }, { "id": "e0ebb947.21967", "type": "comment", "z": "884ebfce.72d028", "name": "Erzeuge Meldung über covid-19 weltweit", "info": "", "x": 180, "y": 40, "wires": [] }, { "id": "330efe00.b45a22", "type": "twitter out", "z": "884ebfce.72d028", "twitter": "", "name": "Tweet", "x": 410, "y": 400, "wires": [] }, { "id": "9851a5e0.9e28d", "type": "comment", "z": "884ebfce.72d028", "name": "via Service von https://covid19.mathdro.id/api", "info": "", "x": 530, "y": 160, "wires": [] } ] |