Revise general alert data

This commit is contained in:
2025-03-18 01:12:51 -04:00
parent 83adbb42af
commit cef4003e9f

View File

@ -69,18 +69,14 @@
"7d9f24e0a78ec15c",
"7a962f9a62b1c9bd",
"f9f2f5c1415ff1be",
"6837f30909e2eb48",
"b2fd625446aad769",
"4982986ff8aefd02",
"ca5ab0add7ccdb84",
"e7c7b4fcae2ded18",
"474ea9dc63cf9b40",
"42b8b21e40f8b824"
],
"x": 14,
"y": 79,
"w": 1352,
"h": 202
"w": 1032,
"h": 142
},
{
"id": "b0521ee44dc796d1",
@ -101,7 +97,7 @@
"67561d51aaa61dfa"
],
"x": 14,
"y": 299,
"y": 239,
"w": 1032,
"h": 202
},
@ -235,8 +231,8 @@
"z": "ed4ea3c2bc13d1ec",
"g": "df425a30fbcfb2e9",
"name": "Filter",
"func": "let alerts = msg.payload\n\n// Filter for Severe Thunderstorm Warnings\n\nlet ts = alerts.filter(function(alert) {\n if (alert.raw.properties &&\n alert.raw.properties.event === \"Severe Thunderstorm Warning\") {\n return true\n }\n})\n\n// Filter for Severe Thunderstorm Warnings with tornado detection\n// that have a tornado possible parameter\n\nlet tstp = alerts.filter(function(alert) {\n if (alert.raw.properties &&\n alert.raw.properties.event === \"Severe Thunderstorm Warning\" &&\n alert.raw.properties.parameters &&\n alert.raw.properties.parameters.tornadoDetection &&\n alert.raw.properties.parameters.tornadoDetection.length > 0) {\n let tornadoPossible = alert.raw.properties.parameters.tornadoDetection[0]\n return tornadoPossible === \"POSSIBLE\"\n }\n})\n\n// Filter for Tornado Warnings\n\nlet tornado = alerts.filter(function(alert) {\n if (alert.raw.properties &&\n alert.raw.properties.event === \"Tornado Warning\") {\n return true\n }\n})\n\n// If there are any alerts, return them\n\nmsg.ts = ts\nmsg.ts_count = ts.length\n\nmsg.tstp = tstp\nmsg.tstp_count = tstp.length\n\nmsg.tornado = tornado\nmsg.tornado_count = tornado.length\n\nreturn msg",
"outputs": 1,
"func": "let alerts = msg.payload\n\n// Filter for Severe Thunderstorm Warnings\n\nlet ts = alerts.filter(function(alert) {\n if (alert.raw.properties &&\n alert.raw.properties.event === \"Severe Thunderstorm Warning\") {\n return true\n }\n})\n\n// Filter for Severe Thunderstorm Warnings with tornado detection\n// that have a tornado possible parameter\n\nlet tstp = alerts.filter(function(alert) {\n if (alert.raw.properties &&\n alert.raw.properties.event === \"Severe Thunderstorm Warning\" &&\n alert.raw.properties.parameters &&\n alert.raw.properties.parameters.tornadoDetection &&\n alert.raw.properties.parameters.tornadoDetection.length > 0) {\n let tornadoPossible = alert.raw.properties.parameters.tornadoDetection[0]\n return tornadoPossible === \"POSSIBLE\"\n }\n})\n\n// Filter for Tornado Warnings\n\nlet tornado = alerts.filter(function(alert) {\n if (alert.raw.properties &&\n alert.raw.properties.event === \"Tornado Warning\") {\n return true\n }\n})\n\n// If there are any alerts, return them\n\nlet tstormMsg = {\n \"payload\": {\n \"alerts\": ts,\n \"count\": ts.length,\n \"tornado_possible\": tstp.length\n }\n}\n\nlet tornadoWarnMsg = {\n \"payload\": {\n \"alerts\": tornado,\n \"count\": tornado.length\n }\n}\n\nnode.send([tstormMsg,tornadoWarnMsg])\nnode.status({fill:'green',shape:'dot',text:'Alerts Updated'})",
"outputs": 2,
"timeout": 0,
"noerr": 0,
"initialize": "",
@ -246,85 +242,15 @@
"y": 120,
"wires": [
[
"b2fd625446aad769",
"4982986ff8aefd02",
"e7c7b4fcae2ded18"
]
]
},
{
"id": "6837f30909e2eb48",
"type": "mqtt out",
"z": "ed4ea3c2bc13d1ec",
"g": "df425a30fbcfb2e9",
"name": "",
"topic": "weather/alerts/general/severe_thunderstorm_warning/tornado_possible",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 1090,
"y": 180,
"wires": []
},
{
"id": "b2fd625446aad769",
"type": "change",
"z": "ed4ea3c2bc13d1ec",
"g": "df425a30fbcfb2e9",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "tstp_count",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 180,
"wires": [
[
"6837f30909e2eb48"
]
]
},
{
"id": "4982986ff8aefd02",
"type": "change",
"z": "ed4ea3c2bc13d1ec",
"g": "df425a30fbcfb2e9",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "tornado_count",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 240,
"wires": [
"474ea9dc63cf9b40"
],
[
"ca5ab0add7ccdb84"
]
],
"outputLabels": [
"Severe Thunderstorm Warning",
"Tornado Warning"
]
},
{
@ -342,38 +268,10 @@
"correl": "",
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 1000,
"y": 240,
"x": 780,
"y": 180,
"wires": []
},
{
"id": "e7c7b4fcae2ded18",
"type": "change",
"z": "ed4ea3c2bc13d1ec",
"g": "df425a30fbcfb2e9",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "ts_count",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 120,
"wires": [
[
"474ea9dc63cf9b40"
]
]
},
{
"id": "474ea9dc63cf9b40",
"type": "mqtt out",
@ -389,7 +287,7 @@
"correl": "",
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 1040,
"x": 820,
"y": 120,
"wires": []
},
@ -411,7 +309,7 @@
"senderr": false,
"headers": [],
"x": 300,
"y": 400,
"y": 340,
"wires": [
[
"fc63778f17491208",
@ -442,7 +340,7 @@
"payload": "",
"payloadType": "date",
"x": 130,
"y": 400,
"y": 340,
"wires": [
[
"8ac36baa32177bd6"
@ -465,7 +363,7 @@
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 730,
"y": 340,
"y": 280,
"wires": []
},
{
@ -489,7 +387,7 @@
"to": "",
"reg": false,
"x": 500,
"y": 340,
"y": 280,
"wires": [
[
"846ac653b993bbec"
@ -510,7 +408,7 @@
"finalize": "",
"libs": [],
"x": 470,
"y": 400,
"y": 340,
"wires": [
[
"9151c0cd48bb3c45"
@ -540,7 +438,7 @@
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 780,
"y": 460,
"y": 400,
"wires": []
},
{
@ -559,7 +457,7 @@
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 820,
"y": 400,
"y": 340,
"wires": []
},
{
@ -589,7 +487,7 @@
"b98e25d5de4ce89c"
],
"x": 185,
"y": 460,
"y": 400,
"wires": [
[
"8ac36baa32177bd6"