From 3228d57bf168e8c509e480ac4b411841115caac9 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Thu, 29 Jul 2021 20:00:04 +0300 Subject: [PATCH] Add covid tracking script --- covid-widget.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 covid-widget.lua diff --git a/covid-widget.lua b/covid-widget.lua new file mode 100644 index 0000000..d163af3 --- /dev/null +++ b/covid-widget.lua @@ -0,0 +1,15 @@ +function onAlarm() + net:getText("https://api.covid19api.com/summary") +end + +function onNetworkResult(result) + local new = json:getValue(result, "object object:Global int:NewConfirmed") + local total = json:getValue(result, "object object:Global int:TotalConfirmed") + local newDeaths = json:getValue(result, "object object:Global int:NewDeaths") + local totalDeaths = json:getValue(result, "object object:Global int:TotalDeaths") + + ui:showLines({ + "Disease: total = "..total.." new = "..new, + "Deaths: total = "..totalDeaths.." new = "..newDeaths + }) +end