MQTT exports for storm alerts

This commit is contained in:
2025-03-17 01:26:59 -04:00
parent 37d56df0b4
commit 480a4d082e
2 changed files with 545 additions and 1 deletions

View File

@ -15,6 +15,64 @@
"info": "",
"env": []
},
{
"id": "ed4ea3c2bc13d1ec",
"type": "tab",
"label": "Weather",
"disabled": false,
"info": "",
"env": []
},
{
"id": "df425a30fbcfb2e9",
"type": "group",
"z": "ed4ea3c2bc13d1ec",
"name": "General Alerts",
"style": {
"label": true
},
"nodes": [
"7d9f24e0a78ec15c",
"7a962f9a62b1c9bd",
"f9f2f5c1415ff1be",
"6837f30909e2eb48",
"b2fd625446aad769",
"4982986ff8aefd02",
"ca5ab0add7ccdb84",
"e7c7b4fcae2ded18",
"474ea9dc63cf9b40"
],
"x": 14,
"y": 79,
"w": 1352,
"h": 202
},
{
"id": "b0521ee44dc796d1",
"type": "group",
"z": "ed4ea3c2bc13d1ec",
"name": "Defiance Alerts",
"style": {
"label": true
},
"nodes": [
"8ac36baa32177bd6",
"aa989a69868fc5fe",
"846ac653b993bbec",
"fc63778f17491208",
"404170ec56d4c845",
"15a570205c470b53",
"6d492df9348a35e9",
"ab2e9b884521285a",
"eff5cac2621c8c91",
"9151c0cd48bb3c45",
"1bbab6628566033e"
],
"x": 14,
"y": 299,
"w": 1372,
"h": 262
},
{
"id": "200f284a1171f0a8",
"type": "mqtt-broker",
@ -331,5 +389,491 @@
"x": 550,
"y": 240,
"wires": []
},
{
"id": "7d9f24e0a78ec15c",
"type": "http request",
"z": "ed4ea3c2bc13d1ec",
"g": "df425a30fbcfb2e9",
"name": "AtmosphericX",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "http://192.168.1.106:3010/api/warnings",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 320,
"y": 120,
"wires": [
[
"f9f2f5c1415ff1be"
]
]
},
{
"id": "7a962f9a62b1c9bd",
"type": "inject",
"z": "ed4ea3c2bc13d1ec",
"g": "df425a30fbcfb2e9",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "30",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 120,
"wires": [
[
"7d9f24e0a78ec15c"
]
]
},
{
"id": "f9f2f5c1415ff1be",
"type": "function",
"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,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 490,
"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": [
[
"ca5ab0add7ccdb84"
]
]
},
{
"id": "ca5ab0add7ccdb84",
"type": "mqtt out",
"z": "ed4ea3c2bc13d1ec",
"g": "df425a30fbcfb2e9",
"name": "",
"topic": "weather/alerts/general/tornado_warning",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 1000,
"y": 240,
"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",
"z": "ed4ea3c2bc13d1ec",
"g": "df425a30fbcfb2e9",
"name": "",
"topic": "weather/alerts/general/severe_thunderstorm_warning",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 1040,
"y": 120,
"wires": []
},
{
"id": "8ac36baa32177bd6",
"type": "http request",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "Defiance County",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://api.weather.gov/alerts/active/zone/OHC039",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 300,
"y": 400,
"wires": [
[
"fc63778f17491208",
"404170ec56d4c845"
]
]
},
{
"id": "aa989a69868fc5fe",
"type": "inject",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "30",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 400,
"wires": [
[
"8ac36baa32177bd6"
]
]
},
{
"id": "846ac653b993bbec",
"type": "mqtt out",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "",
"topic": "weather/alerts/defiance",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 730,
"y": 340,
"wires": []
},
{
"id": "fc63778f17491208",
"type": "change",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.features",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 500,
"y": 340,
"wires": [
[
"846ac653b993bbec"
]
]
},
{
"id": "404170ec56d4c845",
"type": "function",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "Filter",
"func": "let alerts = msg.payload.features\n\n// Filter for Severe Thunderstorm Warnings\n\nlet ts = alerts.filter(function(alert) {\n if (alert.properties &&\n alert.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.properties &&\n alert.properties.event === \"Severe Thunderstorm Warning\" &&\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\n// Filter for Tornado Warnings\n\nlet tornado = alerts.filter(function(alert) {\n if (alert.properties &&\n alert.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,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 470,
"y": 400,
"wires": [
[
"eff5cac2621c8c91",
"15a570205c470b53",
"6d492df9348a35e9"
]
]
},
{
"id": "15a570205c470b53",
"type": "change",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "tstp_count",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 460,
"wires": [
[
"1bbab6628566033e"
]
]
},
{
"id": "6d492df9348a35e9",
"type": "change",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "tornado_count",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 520,
"wires": [
[
"ab2e9b884521285a"
]
]
},
{
"id": "ab2e9b884521285a",
"type": "mqtt out",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "",
"topic": "weather/alerts/defiance/tornado_warning",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 1000,
"y": 520,
"wires": []
},
{
"id": "eff5cac2621c8c91",
"type": "change",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "ts_count",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 400,
"wires": [
[
"9151c0cd48bb3c45"
]
]
},
{
"id": "9151c0cd48bb3c45",
"type": "mqtt out",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "",
"topic": "weather/alerts/defiance/severe_thunderstorm_warning",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 1040,
"y": 400,
"wires": []
},
{
"id": "1bbab6628566033e",
"type": "mqtt out",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "",
"topic": "weather/alerts/defiance/severe_thunderstorm_warning/tornado_possible",
"qos": "0",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "200f284a1171f0a8",
"x": 1100,
"y": 460,
"wires": []
}
]

View File

@ -1,3 +1,3 @@
{
"$": "dedc4844b17024634c37414e77a00c0cZVRqzrSY/m9SjTWpb+gdDmsN2uHh2bUF7El66/XU+1/IxDhOf/AFxxdhOVnOENd3VuPJfWBzcQLNOcC+A706lls="
"$": "cf7de089b3bb02493c93035279de8bd3Br29jiTXIQ+gGZiB99I8ugwkuXqI8iKYRaCkgT11B6JAHtxLmYBqUPvVy7T8a57oDwsAhzp8urBDyMBY/VN0I6zSNQbLUt0lhMF1ghX7P61Rnml+ISKv"
}