If you want get statistics for your country just type it in "select country" switch node.
Moreover it need to change idx'es in function nodes as Cases ,Deaths etc. and you have to create your own custom sensors in Domoticz too.
Code: Select all
[
{
"id": "b4ab87d5.800568",
"type": "mqtt out",
"z": "ebda401.e7556c",
"name": "",
"topic": "domoticz/in",
"qos": "0",
"retain": "false",
"broker": "9748a36f.44bdd",
"x": 1230,
"y": 500,
"wires": []
},
{
"id": "362cf5cf.d65ada",
"type": "debug",
"z": "ebda401.e7556c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 990,
"y": 380,
"wires": []
},
{
"id": "685e4122.5f4f9",
"type": "debug",
"z": "ebda401.e7556c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 990,
"y": 660,
"wires": []
},
{
"id": "4e6e64f8.d3a23c",
"type": "http request",
"z": "ebda401.e7556c",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": false,
"url": "https://www.worldometers.info/coronavirus/",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 290,
"y": 480,
"wires": [
[
"782c7966.acea78"
]
]
},
{
"id": "782c7966.acea78",
"type": "html",
"z": "ebda401.e7556c",
"name": "Table select",
"property": "payload",
"outproperty": "payload",
"tag": "tr",
"ret": "text",
"as": "multi",
"x": 450,
"y": 480,
"wires": [
[
"54b1003a.e4e13"
]
]
},
{
"id": "cc6dcd38.ffa83",
"type": "inject",
"z": "ebda401.e7556c",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "3600",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 130,
"y": 480,
"wires": [
[
"4e6e64f8.d3a23c"
]
]
},
{
"id": "54b1003a.e4e13",
"type": "switch",
"z": "ebda401.e7556c",
"name": "Select country",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "cont",
"v": "Poland",
"vt": "str"
},
{
"t": "cont",
"v": "Italy",
"vt": "str"
},
{
"t": "cont",
"v": "Total:",
"vt": "str"
}
],
"checkall": "false",
"repair": false,
"outputs": 3,
"x": 620,
"y": 480,
"wires": [
[
"48d960e2.51c88"
],
[
"58431ef1.e4577"
],
[
"50a91f56.b04fa"
]
]
},
{
"id": "48d960e2.51c88",
"type": "function",
"z": "ebda401.e7556c",
"name": "parse",
"func": "array = msg.payload.split(\" \");\nfor (var i = 0; i < array.length; i++) {\n array[i] = array[i].trim()\n }\nmsg.topic = array[1]; \nmsg.payload = {};\nmsg.payload.confirmed = array[2].replace(\",\", \"\");\nmsg.payload.newcases = array[3].replace(\"+\", \"\").replace(\",\", \"\");\nmsg.payload.deaths = array[4].replace(\",\", \"\");\nmsg.payload.newdeaths = array[5].replace(\"+\", \"\").replace(\",\", \"\");\nmsg.payload.recovered = array[6].replace(\",\", \"\");\nmsg.payload.active = array[8].replace(\",\", \"\");\nmsg.payload.serious = array[9].replace(\",\", \"\");\n//msg.payload.array = array;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 790,
"y": 460,
"wires": [
[
"c6560917.528468",
"30e38032.19474",
"f323260b.3a85c8",
"362cf5cf.d65ada",
"fc353f4b.bd07c",
"2cebd7ec.6325b8"
]
]
},
{
"id": "c6560917.528468",
"type": "function",
"z": "ebda401.e7556c",
"name": "Cases",
"func": "msg.payload = { \"command\": \"udevice\", \"idx\": 196, \"nvalue\": 0, \"svalue\" :msg.payload.confirmed};\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 970,
"y": 440,
"wires": [
[
"b4ab87d5.800568"
]
]
},
{
"id": "30e38032.19474",
"type": "function",
"z": "ebda401.e7556c",
"name": "Deaths",
"func": "msg.payload = { \"command\": \"udevice\", \"idx\": 197, \"nvalue\": 0, \"svalue\" :msg.payload.deaths};\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 980,
"y": 480,
"wires": [
[
"b4ab87d5.800568"
]
]
},
{
"id": "f323260b.3a85c8",
"type": "function",
"z": "ebda401.e7556c",
"name": "Recovered",
"func": "msg.payload = { \"command\": \"udevice\", \"idx\": 198, \"nvalue\": 0, \"svalue\" :msg.payload.recovered};\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 990,
"y": 520,
"wires": [
[
"b4ab87d5.800568"
]
]
},
{
"id": "50a91f56.b04fa",
"type": "function",
"z": "ebda401.e7556c",
"name": "Total",
"func": "array = msg.payload.split(\" \");\nfor (var i = 0; i < array.length; i++) {\n array[i] = array[i].trim()\n }\nmsg.topic = array[1]; \nmsg.payload = {};\nmsg.payload.total = array[2].replace(\",\", \"\");\nmsg.payload.totalnewcases = array[4].replace(\",\", \"\");\nmsg.payload.totaldeaths = array[5].replace(\",\", \"\");\nmsg.payload.totalnewdeaths = array[6].replace(\",\", \"\");\nmsg.payload.totalrecovered = array[7].replace(\",\", \"\");\nmsg.payload.totalactivecases = array[9].replace(\",\", \"\");\nmsg.payload.totalcritical = array[10].replace(\",\", \"\");\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 790,
"y": 540,
"wires": [
[
"685e4122.5f4f9"
]
]
},
{
"id": "fc353f4b.bd07c",
"type": "function",
"z": "ebda401.e7556c",
"name": "Active cases",
"func": "msg.payload = { \"command\": \"udevice\", \"idx\": 199, \"nvalue\": 0, \"svalue\" :msg.payload.active};\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 990,
"y": 560,
"wires": [
[
"b4ab87d5.800568"
]
]
},
{
"id": "2cebd7ec.6325b8",
"type": "function",
"z": "ebda401.e7556c",
"name": "Serious Critical",
"func": "msg.payload = { \"command\": \"udevice\", \"idx\": 200, \"nvalue\": 0, \"svalue\" :msg.payload.serious};\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1000,
"y": 600,
"wires": [
[
"b4ab87d5.800568"
]
]
},
{
"id": "58431ef1.e4577",
"type": "function",
"z": "ebda401.e7556c",
"name": "parse",
"func": "array = msg.payload.split(\" \");\nfor (var i = 0; i < array.length; i++) {\n array[i] = array[i].trim()\n }\nmsg.topic = array[1]; \nmsg.payload = {};\nmsg.payload.confirmed = array[2].replace(\",\", \"\");\nmsg.payload.newcases = array[3].replace(\"+\", \"\").replace(\",\", \"\");\nmsg.payload.deaths = array[4].replace(\",\", \"\");\nmsg.payload.newdeaths = array[5].replace(\"+\", \"\").replace(\",\", \"\");\nmsg.payload.recovered = array[6].replace(\",\", \"\");\nmsg.payload.active = array[8].replace(\",\", \"\");\nmsg.payload.serious = array[9].replace(\",\", \"\");\n//msg.payload.array = array;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 790,
"y": 500,
"wires": [
[
"362cf5cf.d65ada"
]
]
},
{
"id": "9748a36f.44bdd",
"type": "mqtt-broker",
"z": "",
"broker": "localhost",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
}
]