Add watches for Defiance
This commit is contained in:
58
flows.json
58
flows.json
@ -97,12 +97,14 @@
|
||||
"404170ec56d4c845",
|
||||
"ab2e9b884521285a",
|
||||
"9151c0cd48bb3c45",
|
||||
"67561d51aaa61dfa"
|
||||
"67561d51aaa61dfa",
|
||||
"6e785299ac298ccd",
|
||||
"4d8ca3ed3f302d97"
|
||||
],
|
||||
"x": 14,
|
||||
"y": 239,
|
||||
"w": 1032,
|
||||
"h": 202
|
||||
"h": 322
|
||||
},
|
||||
{
|
||||
"id": "200f284a1171f0a8",
|
||||
@ -406,8 +408,8 @@
|
||||
"z": "ed4ea3c2bc13d1ec",
|
||||
"g": "b0521ee44dc796d1",
|
||||
"name": "Filter",
|
||||
"func": "const severeWarningEvents = [\"Severe Thunderstorm Warning\",\"Destructive Severe Thunderstorm Warning\",\"Considerable Destructive Severe Thunderstorm Warning\"]\nconst tornadoWarningEvents = [\"Tornado Warning\",\"Radar Indicated Tornado Warning\",\"Confirmed Tornado Warning\",\"Tornado Emergency\"]\n\nlet alerts = msg.payload.features\nlet tornado_possible = false\nlet considerable_destructive = false\nlet confirmed = false\n\n// Filter for Severe Thunderstorm Warnings\n\nlet ts = alerts.filter(function(alert) {\n if (alert.properties &&\n severeWarningEvents.includes(alert.properties.event)) {\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.properties &&\n severeWarningEvents.includes(alert.properties.event) &&\n alert.properties.parameters &&\n alert.properties.parameters.tornadoDetection &&\n alert.properties.parameters.tornadoDetection.length > 0) {\n let tornadoPossible = alert.properties.parameters.tornadoDetection[0]\n return tornadoPossible === \"POSSIBLE\"\n }\n})\n\nif (tstp.length > 0) {\n tornado_possible = true\n}\n\n// Filter for considerable destructive severe thunderstorm warnings\n\nlet cdst = alerts.filter(function(alert) {\n if (alert.properties &&\n alert.properties.event === \"Considerable Destructive Severe Thunderstorm Warning\") {\n return true\n }\n})\n\nif (cdst.length > 0) {\n considerable_destructive = true\n}\n\n// Filter for Tornado Warnings\n\nlet tornado = alerts.filter(function(alert) {\n if (alert.properties &&\n tornadoWarningEvents.includes(alert.properties.event)) {\n return true\n }\n})\n\nlet confirmed_tornado = alerts.filter(function(alert) {\n if (alert.properties &&\n alert.properties.event === \"Confirmed Tornado Warning\") {\n return true\n }\n})\n\nif (confirmed_tornado.length > 0) {\n confirmed = true\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\": tornado_possible,\n \"considerable_destructive\": considerable_destructive\n }\n}\n\nlet tornadoWarnMsg = {\n \"payload\": {\n \"alerts\": tornado,\n \"count\": tornado.length,\n \"confirmed\": confirmed\n }\n}\n\nnode.send([tstormMsg,tornadoWarnMsg])\nnode.status({fill:'green',shape:'dot',text:'Alerts Updated'})",
|
||||
"outputs": 2,
|
||||
"func": "const severeWarningEvents = [\"Severe Thunderstorm Warning\",\"Destructive Severe Thunderstorm Warning\",\"Considerable Destructive Severe Thunderstorm Warning\"]\nconst tornadoWarningEvents = [\"Tornado Warning\",\"Radar Indicated Tornado Warning\",\"Confirmed Tornado Warning\",\"Tornado Emergency\"]\nconst tornadoWatchEvents = [\"Tornado Watch\"]\nconst severeThunderstormWatchEvents = [\"Severe Thunderstorm Watch\"]\n\nlet alerts = msg.payload.features\nlet tornado_possible = false\nlet considerable_destructive = false\nlet confirmed = false\n\n// Filter for Severe Thunderstorm Warnings\n\nlet ts = alerts.filter(function(alert) {\n if (alert.properties &&\n severeWarningEvents.includes(alert.properties.event)) {\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.properties &&\n severeWarningEvents.includes(alert.properties.event) &&\n alert.properties.parameters &&\n alert.properties.parameters.tornadoDetection &&\n alert.properties.parameters.tornadoDetection.length > 0) {\n let tornadoPossible = alert.properties.parameters.tornadoDetection[0]\n return tornadoPossible === \"POSSIBLE\"\n }\n})\n\nif (tstp.length > 0) {\n tornado_possible = true\n}\n\n// Filter for considerable destructive severe thunderstorm warnings\n\nlet cdst = alerts.filter(function(alert) {\n if (alert.properties &&\n alert.properties.event === \"Considerable Destructive Severe Thunderstorm Warning\") {\n return true\n }\n})\n\nif (cdst.length > 0) {\n considerable_destructive = true\n}\n\n// Filter for Tornado Warnings\n\nlet tornado = alerts.filter(function(alert) {\n if (alert.properties &&\n tornadoWarningEvents.includes(alert.properties.event)) {\n return true\n }\n})\n\nlet confirmed_tornado = alerts.filter(function(alert) {\n if (alert.properties &&\n alert.properties.event === \"Confirmed Tornado Warning\") {\n return true\n }\n})\n\nif (confirmed_tornado.length > 0) {\n confirmed = true\n}\n\n// Filter for Tornado Watches\n\nlet tornado_watch = alerts.filter(function(alert) {\n if (alert.properties &&\n tornadoWatchEvents.includes(alert.properties.event)) {\n return true\n }\n})\n\n// Filter for Severe Thunderstorm Watches\n\nlet severe_thunderstorm_watch = alerts.filter(function(alert) {\n if (alert.properties &&\n severeThunderstormWatchEvents.includes(alert.properties.event)) {\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\": tornado_possible,\n \"considerable_destructive\": considerable_destructive\n }\n}\n\nlet tornadoWarnMsg = {\n \"payload\": {\n \"alerts\": tornado,\n \"count\": tornado.length,\n \"confirmed\": confirmed\n }\n}\n\nlet tornadoWatchMsg = {\n \"payload\": {\n \"alerts\": tornado_watch,\n \"count\": tornado_watch.length\n }\n}\n\nlet severeThunderstormWatchMsg = {\n \"payload\": {\n \"alerts\": severe_thunderstorm_watch,\n \"count\": severe_thunderstorm_watch.length\n }\n}\n\nnode.send([tstormMsg,tornadoWarnMsg,tornadoWatchMsg,severeThunderstormWatchMsg])\nnode.status({fill:'green',shape:'dot',text:'Alerts Updated'})",
|
||||
"outputs": 4,
|
||||
"timeout": 0,
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
@ -421,11 +423,19 @@
|
||||
],
|
||||
[
|
||||
"ab2e9b884521285a"
|
||||
],
|
||||
[
|
||||
"6e785299ac298ccd"
|
||||
],
|
||||
[
|
||||
"4d8ca3ed3f302d97"
|
||||
]
|
||||
],
|
||||
"outputLabels": [
|
||||
"Severe Thunderstorm Warning",
|
||||
"Tornado Warning"
|
||||
"Tornado Warning",
|
||||
null,
|
||||
null
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -554,6 +564,44 @@
|
||||
"y": 180,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "6e785299ac298ccd",
|
||||
"type": "mqtt out",
|
||||
"z": "ed4ea3c2bc13d1ec",
|
||||
"g": "b0521ee44dc796d1",
|
||||
"name": "",
|
||||
"topic": "weather/alerts/defiance/tornado_watch",
|
||||
"qos": "0",
|
||||
"retain": "",
|
||||
"respTopic": "",
|
||||
"contentType": "",
|
||||
"userProps": "",
|
||||
"correl": "",
|
||||
"expiry": "",
|
||||
"broker": "200f284a1171f0a8",
|
||||
"x": 770,
|
||||
"y": 460,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "4d8ca3ed3f302d97",
|
||||
"type": "mqtt out",
|
||||
"z": "ed4ea3c2bc13d1ec",
|
||||
"g": "b0521ee44dc796d1",
|
||||
"name": "",
|
||||
"topic": "weather/alerts/defiance/severe_thunderstorm_watch",
|
||||
"qos": "0",
|
||||
"retain": "",
|
||||
"respTopic": "",
|
||||
"contentType": "",
|
||||
"userProps": "",
|
||||
"correl": "",
|
||||
"expiry": "",
|
||||
"broker": "200f284a1171f0a8",
|
||||
"x": 820,
|
||||
"y": 520,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "a1c109993f7dd396",
|
||||
"type": "mqtt in",
|
||||
|
Reference in New Issue
Block a user