Files
nodered-hub/flows.json
2025-03-18 01:12:51 -04:00

818 lines
22 KiB
JSON

[
{
"id": "ed4ea3c2bc13d1ec",
"type": "tab",
"label": "Weather",
"disabled": false,
"info": "",
"env": []
},
{
"id": "91324b2dbbd2a883",
"type": "tab",
"label": "Settings",
"disabled": false,
"info": "",
"env": []
},
{
"id": "50d1e20d24132c99",
"type": "tab",
"label": "Testing",
"disabled": false,
"info": "",
"env": []
},
{
"id": "4107976aa434eb03",
"type": "subflow",
"name": "Weather Conversions",
"info": "",
"category": "",
"in": [
{
"x": 40,
"y": 80,
"wires": [
{
"id": "388878f6056fa3e4"
}
]
}
],
"out": [
{
"x": 500,
"y": 80,
"wires": [
{
"id": "80ce4b42b82e3c78",
"port": 0
}
]
}
],
"env": [],
"meta": {},
"color": "#DDAA99",
"icon": "font-awesome/fa-cloud"
},
{
"id": "df425a30fbcfb2e9",
"type": "group",
"z": "ed4ea3c2bc13d1ec",
"name": "General Alerts",
"style": {
"label": true
},
"nodes": [
"7d9f24e0a78ec15c",
"7a962f9a62b1c9bd",
"f9f2f5c1415ff1be",
"ca5ab0add7ccdb84",
"474ea9dc63cf9b40",
"42b8b21e40f8b824"
],
"x": 14,
"y": 79,
"w": 1032,
"h": 142
},
{
"id": "b0521ee44dc796d1",
"type": "group",
"z": "ed4ea3c2bc13d1ec",
"name": "Defiance Alerts",
"style": {
"label": true
},
"nodes": [
"8ac36baa32177bd6",
"aa989a69868fc5fe",
"846ac653b993bbec",
"fc63778f17491208",
"404170ec56d4c845",
"ab2e9b884521285a",
"9151c0cd48bb3c45",
"67561d51aaa61dfa"
],
"x": 14,
"y": 239,
"w": 1032,
"h": 202
},
{
"id": "200f284a1171f0a8",
"type": "mqtt-broker",
"name": "",
"broker": "192.168.1.251",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "5",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthRetain": "false",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closeRetain": "false",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willRetain": "false",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "388878f6056fa3e4",
"type": "function",
"z": "4107976aa434eb03",
"name": "Conversions",
"func": "msg.data.main.temp = ((msg.data.main.temp - 273.15) * 1.8) + 32\nmsg.data.main.feels_like = ((msg.data.main.feels_like - 273.15) * 1.8) + 32\nmsg.data.main.temp_min = ((msg.data.main.temp_min - 273.15) * 1.8) + 32\nmsg.data.main.temp_max = ((msg.data.main.temp_max - 273.15) * 1.8) + 32\nmsg.data.main.pressure = msg.data.main.pressure * 0.029529983071445\nmsg.data.wind.speed = msg.data.wind.speed * 2.237\nmsg.data.wind.gust = msg.data.wind.gust * 2.237\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 190,
"y": 80,
"wires": [
[
"80ce4b42b82e3c78"
]
]
},
{
"id": "80ce4b42b82e3c78",
"type": "function",
"z": "4107976aa434eb03",
"name": "Rounding",
"func": "const temp = msg.data.main.temp\nconst feels_like = msg.data.main.feels_like\nconst temp_min = msg.data.main.temp_min\nconst temp_max = msg.data.main.temp_max\nconst pressure = msg.data.main.pressure\nconst windspeed = msg.data.wind.speed\nconst windgust = msg.data.wind.gust\n\nmsg.data.main.temp = +temp.toFixed(1)\nmsg.data.main.feels_like = +feels_like.toFixed(1)\nmsg.data.main.temp_min = +temp_min.toFixed(1)\nmsg.data.main.temp_max = +temp_max.toFixed(1)\nmsg.data.main.pressure = +pressure.toFixed(2)\nmsg.data.wind.speed = +windspeed.toFixed(2)\nmsg.data.wind.gust = +windgust.toFixed(2)\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 360,
"y": 80,
"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\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": "",
"finalize": "",
"libs": [],
"x": 490,
"y": 120,
"wires": [
[
"474ea9dc63cf9b40"
],
[
"ca5ab0add7ccdb84"
]
],
"outputLabels": [
"Severe Thunderstorm Warning",
"Tornado Warning"
]
},
{
"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": 780,
"y": 180,
"wires": []
},
{
"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": 820,
"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": 340,
"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": 340,
"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": 280,
"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": 280,
"wires": [
[
"846ac653b993bbec"
]
]
},
{
"id": "404170ec56d4c845",
"type": "function",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "Filter",
"func": "let alerts = msg.payload.features\nlet tornado_possible = false\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\nif (tstp.length > 0) {\n tornado_possible = true\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\nlet tstormMsg = {\n \"payload\": {\n \"alerts\": ts,\n \"count\": ts.length,\n \"tornado_possible\": tornado_possible\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": "",
"finalize": "",
"libs": [],
"x": 470,
"y": 340,
"wires": [
[
"9151c0cd48bb3c45"
],
[
"ab2e9b884521285a"
]
],
"outputLabels": [
"Severe Thunderstorm Warning",
"Tornado Warning"
]
},
{
"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": 780,
"y": 400,
"wires": []
},
{
"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": 820,
"y": 340,
"wires": []
},
{
"id": "42b8b21e40f8b824",
"type": "link in",
"z": "ed4ea3c2bc13d1ec",
"g": "df425a30fbcfb2e9",
"name": "Weather - General Alerts Trigger",
"links": [
"b98e25d5de4ce89c"
],
"x": 185,
"y": 180,
"wires": [
[
"7d9f24e0a78ec15c"
]
]
},
{
"id": "67561d51aaa61dfa",
"type": "link in",
"z": "ed4ea3c2bc13d1ec",
"g": "b0521ee44dc796d1",
"name": "Weather - Defiance Alerts Trigger",
"links": [
"b98e25d5de4ce89c"
],
"x": 185,
"y": 400,
"wires": [
[
"8ac36baa32177bd6"
]
]
},
{
"id": "a1c109993f7dd396",
"type": "mqtt in",
"z": "91324b2dbbd2a883",
"name": "",
"topic": "house/time/night_mode",
"qos": "2",
"datatype": "auto-detect",
"broker": "200f284a1171f0a8",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 140,
"y": 60,
"wires": [
[
"0ea09d79d6de5c53"
]
]
},
{
"id": "0ea09d79d6de5c53",
"type": "change",
"z": "91324b2dbbd2a883",
"name": "",
"rules": [
{
"t": "set",
"p": "night_mode",
"pt": "global",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 380,
"y": 60,
"wires": [
[]
]
},
{
"id": "395e101ae9c12369",
"type": "mqtt in",
"z": "91324b2dbbd2a883",
"name": "",
"topic": "house/time/give_me_darkness",
"qos": "2",
"datatype": "auto-detect",
"broker": "200f284a1171f0a8",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 160,
"y": 120,
"wires": [
[
"7e79da9ecd800892"
]
]
},
{
"id": "7e79da9ecd800892",
"type": "change",
"z": "91324b2dbbd2a883",
"name": "",
"rules": [
{
"t": "set",
"p": "give_me_darkness",
"pt": "global",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 440,
"y": 120,
"wires": [
[]
]
},
{
"id": "a67eb32acf21917c",
"type": "mqtt in",
"z": "91324b2dbbd2a883",
"name": "",
"topic": "house/time/early_night_mode",
"qos": "2",
"datatype": "auto-detect",
"broker": "200f284a1171f0a8",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 160,
"y": 180,
"wires": [
[
"e183038952420a88"
]
]
},
{
"id": "e183038952420a88",
"type": "change",
"z": "91324b2dbbd2a883",
"name": "",
"rules": [
{
"t": "set",
"p": "early_night_mode",
"pt": "global",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 440,
"y": 180,
"wires": [
[]
]
},
{
"id": "da24109fa6585678",
"type": "mqtt in",
"z": "91324b2dbbd2a883",
"name": "",
"topic": "house/studio/live",
"qos": "2",
"datatype": "auto-detect",
"broker": "200f284a1171f0a8",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 120,
"y": 240,
"wires": [
[
"f7219402165cd674"
]
]
},
{
"id": "f7219402165cd674",
"type": "change",
"z": "91324b2dbbd2a883",
"name": "",
"rules": [
{
"t": "set",
"p": "studio_live",
"pt": "global",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 340,
"y": 240,
"wires": [
[]
]
},
{
"id": "59d2d6fec223bd16",
"type": "mqtt in",
"z": "91324b2dbbd2a883",
"name": "",
"topic": "services/homeassistant/reboot",
"qos": "0",
"datatype": "auto-detect",
"broker": "200f284a1171f0a8",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 160,
"y": 300,
"wires": [
[
"b98e25d5de4ce89c"
]
]
},
{
"id": "b98e25d5de4ce89c",
"type": "link out",
"z": "91324b2dbbd2a883",
"name": "Home Assistant Reboot",
"mode": "link",
"links": [
"42b8b21e40f8b824",
"67561d51aaa61dfa"
],
"x": 335,
"y": 300,
"wires": []
},
{
"id": "2fe03a09d418699b",
"type": "exec",
"z": "50d1e20d24132c99",
"command": "",
"addpay": "",
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": false,
"oldrc": false,
"name": "",
"x": 370,
"y": 180,
"wires": [
[
"652d9b04c03a88b8"
],
[
"b784a6fd67e1cac0"
],
[
"38d4b39d1405b540"
]
]
},
{
"id": "b114d9e490180bbc",
"type": "inject",
"z": "50d1e20d24132c99",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 200,
"y": 180,
"wires": [
[
"2fe03a09d418699b"
]
]
},
{
"id": "652d9b04c03a88b8",
"type": "debug",
"z": "50d1e20d24132c99",
"name": "stdout",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 530,
"y": 120,
"wires": []
},
{
"id": "b784a6fd67e1cac0",
"type": "debug",
"z": "50d1e20d24132c99",
"name": "stderr",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 530,
"y": 180,
"wires": []
},
{
"id": "38d4b39d1405b540",
"type": "debug",
"z": "50d1e20d24132c99",
"name": "return code",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 550,
"y": 240,
"wires": []
}
]