diff --git a/MMM-MyCovid19.njk b/MMM-MyCovid19.njk
index 1529e0b..477e218 100644
--- a/MMM-MyCovid19.njk
+++ b/MMM-MyCovid19.njk
@@ -26,11 +26,9 @@
Inzidenz: {{ cases.new7_100k }}
- Neu: {{ cases.new7 }}
Aktiv: {{ cases.active }}
Gesamt: {{ cases.total }}
Tote: {{ cases.death }}
- Genesen: {{ cases.cured }}
7-Tage Trend, Stand {{ cases.ts }}
diff --git a/README.md b/README.md
index 5f29a75..9493632 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Module: MMM-covid19
-This module displays COVID-19 data aggregated by [rp-online](https://rp-online.de).
+This module displays COVID-19 data aggregated by [c19d](https://c19d.smsvc.net).
![](screenshot.png)
@@ -37,7 +37,7 @@ modules: [
### List available regions
-`curl https://rp-online.de/app/interaktiv_server/data/rki_nrw_mapped.json.php | jq | awk '/^ "/ {print}'`
+`curl -s https://c19d.smsvc.net/api/v2/districts | jq '.[].LK_Name'`
## MMPM integration
```
diff --git a/node_helper.js b/node_helper.js
index 35983dc..08fff30 100644
--- a/node_helper.js
+++ b/node_helper.js
@@ -1,27 +1,32 @@
var NodeHelper = require("node_helper");
const fetch = require("node-fetch");
-var data_url = "https://rp-online.de/app/interaktiv_server/data/rki_nrw_mapped.json.php";
var cases = {}
module.exports = NodeHelper.create({
socketNotificationReceived: function (notification, region) {
- // get and parse json data from source
- res = fetch(data_url)
+
+ // get id for passed region
+ fetch("https://c19d.smsvc.net/api/v2/districts?LK_Name="+region)
.then(response=>response.json())
.then(data=>{
- // extract data
- cases.new7 = data[region]["last_7"];
- cases.new7_100k = data[region]["last_7_100000"];
- cases.active = data[region]["active"];
- cases.total = data[region]["cases"];
- cases.death = data[region]["tot"];
- cases.cured = data[region]["gesund"];
- cases.ts = data[region]["date"];
+ region_id=data[0]["ID"]
- // send data back to module
- this.sendSocketNotification("{{MODULE_NAME}}-set_cases", cases)
+ // get and parse json data from source
+ fetch("https://c19d.smsvc.net/api/v2/districts/"+region_id+"/data/last")
+ .then(response=>response.json())
+ .then(data=>{
+ // extract data
+ cases.new7_100k = data["Cases_Last_Week_Per_100000"];
+ cases.active = data["Cases_Last_Week"];
+ cases.total = data["Cases"];
+ cases.death = data["Deaths"];
+ cases.ts = data["Date"];
+
+ // send data back to module
+ this.sendSocketNotification("{{MODULE_NAME}}-set_cases", cases)
+ })
})
},
});
diff --git a/screenshot.png b/screenshot.png
index 84333cf..a8fa38e 100644
Binary files a/screenshot.png and b/screenshot.png differ