Skip to content

Instantly share code, notes, and snippets.

@johnny2678
Created November 3, 2020 12:32
Show Gist options
  • Save johnny2678/fc9fceaec0f64d1d50755056181cda71 to your computer and use it in GitHub Desktop.
Save johnny2678/fc9fceaec0f64d1d50755056181cda71 to your computer and use it in GitHub Desktop.
Hubitat Performance Monitor
[
{
"id": "f355fe72.0ca2b",
"type": "subflow",
"name": "Power Cycle Hub",
"info": "",
"category": "",
"in": [
{
"x": 50,
"y": 30,
"wires": [
{
"id": "aad3d74c.c196c8"
}
]
}
],
"out": [
{
"x": 1220,
"y": 100,
"wires": [
{
"id": "1a48569f.030b29",
"port": 0
}
]
}
],
"env": [],
"color": "#DDAA99"
},
{
"id": "aad3d74c.c196c8",
"type": "change",
"z": "f355fe72.0ca2b",
"name": "Set Off Cmd",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "false",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 190,
"y": 100,
"wires": [
[
"f850a08f.7a008"
]
]
},
{
"id": "f850a08f.7a008",
"type": "kasa",
"z": "f355fe72.0ca2b",
"name": "TPLink Hub",
"device": "192.168.x.x",
"interval": 60000,
"eventInterval": 15000,
"payload": "getInfo",
"payloadType": "info",
"debug": false,
"x": 370,
"y": 100,
"wires": [
[
"b78c2c45.6530f"
]
]
},
{
"id": "b78c2c45.6530f",
"type": "delay",
"z": "f355fe72.0ca2b",
"name": "",
"pauseType": "delay",
"timeout": "15",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 550,
"y": 100,
"wires": [
[
"18cc25bf.9ec9ca"
]
]
},
{
"id": "18cc25bf.9ec9ca",
"type": "change",
"z": "f355fe72.0ca2b",
"name": "Set On Cmd",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "true",
"tot": "str"
},
{
"t": "set",
"p": "unresponsives",
"pt": "flow",
"to": "0",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 730,
"y": 100,
"wires": [
[
"d4846954.01f508"
]
]
},
{
"id": "d4846954.01f508",
"type": "kasa",
"z": "f355fe72.0ca2b",
"name": "TPLink Hub",
"device": "192.168.x.x",
"interval": 60000,
"eventInterval": 15000,
"payload": "getInfo",
"payloadType": "info",
"debug": false,
"x": 910,
"y": 100,
"wires": [
[
"1a48569f.030b29"
]
]
},
{
"id": "1a48569f.030b29",
"type": "delay",
"z": "f355fe72.0ca2b",
"name": "",
"pauseType": "delay",
"timeout": "180",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 1090,
"y": 100,
"wires": [
[]
]
},
{
"id": "616e8b3e.ef8494",
"type": "subflow",
"name": "Check Mem",
"info": "",
"category": "",
"in": [
{
"x": 50,
"y": 30,
"wires": [
{
"id": "29c4fe6e.9a1b02"
}
]
}
],
"out": [
{
"x": 820,
"y": 280,
"wires": [
{
"id": "d3a6e20c.751ad",
"port": 0
}
]
}
],
"env": [],
"color": "#DDAA99"
},
{
"id": "fc461677.f63088",
"type": "http request",
"z": "616e8b3e.ef8494",
"name": "Get Free Mem",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 360,
"y": 100,
"wires": [
[
"8f22b4ea.f28858"
]
]
},
{
"id": "29c4fe6e.9a1b02",
"type": "function",
"z": "616e8b3e.ef8494",
"name": "Build Free Memory URL",
"func": "msg.url = \"http://\" + flow.get(\"$parent.hubIP\") + \"/hub/advanced/freeOSMemory\"\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 150,
"y": 100,
"wires": [
[
"fc461677.f63088"
]
]
},
{
"id": "d3a6e20c.751ad",
"type": "change",
"z": "616e8b3e.ef8494",
"name": "Add freeMemValue",
"rules": [
{
"t": "set",
"p": "freeMemValue",
"pt": "msg",
"to": "payload",
"tot": "msg"
},
{
"t": "set",
"p": "test",
"pt": "msg",
"to": "false",
"tot": "bool"
},
{
"t": "delete",
"p": "url",
"pt": "msg"
},
{
"t": "delete",
"p": "headers",
"pt": "msg"
},
{
"t": "delete",
"p": "responseUrl",
"pt": "msg"
},
{
"t": "delete",
"p": "redirectList",
"pt": "msg"
},
{
"t": "delete",
"p": "responseCookies",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 810,
"y": 100,
"wires": [
[]
]
},
{
"id": "8f22b4ea.f28858",
"type": "switch",
"z": "616e8b3e.ef8494",
"name": "Did we get a value > 0?",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "gt",
"v": "0",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 570,
"y": 100,
"wires": [
[
"d3a6e20c.751ad"
]
]
},
{
"id": "d8551028.eed36",
"type": "subflow",
"name": "Log File",
"info": "",
"category": "",
"in": [
{
"x": 60,
"y": 100,
"wires": [
{
"id": "17136cfb.b28533"
}
]
}
],
"out": [],
"env": []
},
{
"id": "2d8212.dbe6cdee",
"type": "switch",
"z": "d8551028.eed36",
"name": "Are We Testing?",
"property": "test",
"propertyType": "msg",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 380,
"y": 100,
"wires": [
[
"85885c8b.d866f"
],
[
"a0ddc508.155198"
]
]
},
{
"id": "17136cfb.b28533",
"type": "function",
"z": "d8551028.eed36",
"name": "Inject State",
"func": "msg.clears = flow.get(\"$parent.clears\");\nmsg.warnings = flow.get(\"$parent.warnings\");\nmsg.criticals = flow.get(\"$parent.criticals\");\nmsg.lastReboot = flow.get(\"$parent.lastReboot\");\nmsg.lowmemwarn = flow.get(\"$parent.lowmemwarn\");\nmsg.lowmemcrit = flow.get(\"$parent.lowmemcrit\");\nmsg.unresponsives = flow.get(\"$parent.unresponsives\");\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 200,
"y": 100,
"wires": [
[
"2d8212.dbe6cdee"
]
]
},
{
"id": "a0ddc508.155198",
"type": "flogger",
"z": "d8551028.eed36",
"name": "Prod Log",
"logfile": "rebooter-fprod.json",
"inputchoice": "fullmsg",
"inputobject": "payload",
"inputobjectType": "msg",
"inputmoustache": "Recieved payload {{payload}} and topic {{topic}}",
"loglevel": "INFO",
"logconfig": "c3a8959.8aabf68",
"sendpane": "",
"x": 560,
"y": 120,
"wires": [
[]
]
},
{
"id": "85885c8b.d866f",
"type": "flogger",
"z": "d8551028.eed36",
"name": "Test Log",
"logfile": "rebooter-ftest.json",
"inputchoice": "fullmsg",
"inputobject": "payload",
"inputobjectType": "msg",
"inputmoustache": "Recieved payload {{payload}} and topic {{topic}}",
"loglevel": "INFO",
"logconfig": "c3a8959.8aabf68",
"sendpane": "",
"x": 560,
"y": 80,
"wires": [
[]
]
},
{
"id": "c3a8959.8aabf68",
"type": "config-log",
"z": "d8551028.eed36",
"logname": "Full UTC Rotate Logging",
"logdir": "/data/log",
"stamp": "utc",
"stampFormat": "YYYY/MM/DD HH:mm:ss",
"logstyle": "plain",
"logrotate": true,
"logcompress": false,
"logrotatecount": "5",
"logsize": "100",
"logtopic": false,
"logsource": true
},
{
"id": "a86ab5fe.e6c388",
"type": "subflow",
"name": "Check Time",
"info": "",
"category": "",
"in": [
{
"x": 40,
"y": 100,
"wires": [
{
"id": "1ceda0dc.78cf1f"
}
]
}
],
"out": [
{
"x": 1050,
"y": 100,
"wires": [
{
"id": "ef27295a.16e6f8",
"port": 0
}
]
}
],
"env": []
},
{
"id": "1ceda0dc.78cf1f",
"type": "time-range-switch",
"z": "a86ab5fe.e6c388",
"name": "Am I Awake?",
"lat": "27.405422",
"lon": "-82.381216",
"startTime": "07:00",
"endTime": "23:00",
"startOffset": 0,
"endOffset": 0,
"x": 180,
"y": 100,
"wires": [
[
"41ddc9e2.f5f938"
],
[
"3f9c6bc.ba93694"
]
]
},
{
"id": "d2ead9b2.5535f8",
"type": "time-range-switch",
"z": "a86ab5fe.e6c388",
"name": "Maintenance Window?",
"lat": "27.405492",
"lon": "-82.381235",
"startTime": "02:00",
"endTime": "03:00",
"startOffset": 0,
"endOffset": 0,
"x": 550,
"y": 100,
"wires": [
[
"af3d1cc2.c4c81"
],
[
"1ffb66c5.393f79"
]
]
},
{
"id": "af3d1cc2.c4c81",
"type": "change",
"z": "a86ab5fe.e6c388",
"name": "Yes",
"rules": [
{
"t": "set",
"p": "inMaintenance",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 750,
"y": 50,
"wires": [
[
"ef27295a.16e6f8"
]
]
},
{
"id": "1ffb66c5.393f79",
"type": "change",
"z": "a86ab5fe.e6c388",
"name": "No",
"rules": [
{
"t": "set",
"p": "inMaintenance",
"pt": "msg",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 750,
"y": 150,
"wires": [
[
"ef27295a.16e6f8"
]
]
},
{
"id": "41ddc9e2.f5f938",
"type": "change",
"z": "a86ab5fe.e6c388",
"name": "Yes",
"rules": [
{
"t": "set",
"p": "awake",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 350,
"y": 50,
"wires": [
[
"d2ead9b2.5535f8"
]
]
},
{
"id": "3f9c6bc.ba93694",
"type": "change",
"z": "a86ab5fe.e6c388",
"name": "No",
"rules": [
{
"t": "set",
"p": "awake",
"pt": "msg",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 350,
"y": 150,
"wires": [
[
"d2ead9b2.5535f8"
]
]
},
{
"id": "ef27295a.16e6f8",
"type": "change",
"z": "a86ab5fe.e6c388",
"name": "Adjust Fields",
"rules": [
{
"t": "delete",
"p": "headers",
"pt": "msg"
},
{
"t": "delete",
"p": "starttime",
"pt": "msg"
},
{
"t": "delete",
"p": "endtime",
"pt": "msg"
},
{
"t": "delete",
"p": "redirectList",
"pt": "msg"
},
{
"t": "delete",
"p": "responseCookies",
"pt": "msg"
},
{
"t": "delete",
"p": "topic",
"pt": "msg"
},
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "set",
"p": "reboot",
"pt": "msg",
"to": "false",
"tot": "bool"
},
{
"t": "delete",
"p": "url",
"pt": "msg"
},
{
"t": "delete",
"p": "responseUrl",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 930,
"y": 100,
"wires": [
[]
]
},
{
"id": "498af3cc.e4ea3c",
"type": "subflow",
"name": "Check Page",
"info": "",
"category": "",
"in": [
{
"x": 40,
"y": 80,
"wires": [
{
"id": "b11c6280.db382"
}
]
}
],
"out": [
{
"x": 1150,
"y": 80,
"wires": [
{
"id": "d46e34af.a18168",
"port": 0
}
]
}
],
"env": [],
"color": "#DDAA99"
},
{
"id": "c392d05e.d501",
"type": "http request",
"z": "498af3cc.e4ea3c",
"name": "Get App List",
"method": "GET",
"ret": "bin",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"authType": "basic",
"x": 500,
"y": 80,
"wires": [
[
"32c8e03d.c755c"
]
]
},
{
"id": "32c8e03d.c755c",
"type": "change",
"z": "498af3cc.e4ea3c",
"name": "Add endtime",
"rules": [
{
"t": "set",
"p": "endtime",
"pt": "msg",
"to": "",
"tot": "date"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 670,
"y": 80,
"wires": [
[
"cf4f1754.ab98c8"
]
]
},
{
"id": "b11c6280.db382",
"type": "change",
"z": "498af3cc.e4ea3c",
"name": "Add starttime",
"rules": [
{
"t": "set",
"p": "starttime",
"pt": "msg",
"to": "",
"tot": "date"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 170,
"y": 80,
"wires": [
[
"5a789e83.58e91"
]
]
},
{
"id": "d46e34af.a18168",
"type": "function",
"z": "498af3cc.e4ea3c",
"name": "Do Math",
"func": "msg.responseTime = msg.endtime - msg.starttime;\nmsg.responseTime = msg.responseTime / 1000;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1040,
"y": 80,
"wires": [
[]
]
},
{
"id": "cf4f1754.ab98c8",
"type": "change",
"z": "498af3cc.e4ea3c",
"name": "This is not a test.",
"rules": [
{
"t": "set",
"p": "test",
"pt": "msg",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 860,
"y": 80,
"wires": [
[
"d46e34af.a18168"
]
]
},
{
"id": "5a789e83.58e91",
"type": "function",
"z": "498af3cc.e4ea3c",
"name": "Build URL",
"func": "msg.url = \"http://\" + flow.get(\"$parent.hubIP\") + \"/driver/list/data\"\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 340,
"y": 80,
"wires": [
[
"c392d05e.d501"
]
]
},
{
"id": "99b3e998.7a0138",
"type": "tab",
"label": "Hubitat Performance (WWW)",
"disabled": false,
"info": ""
},
{
"id": "30af454c.005cda",
"type": "inject",
"z": "99b3e998.7a0138",
"name": "1 mins.",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "60",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 180,
"y": 60,
"wires": [
[
"7d1aa0b2.32f54"
]
]
},
{
"id": "bb2cbef6.9903d",
"type": "http request",
"z": "99b3e998.7a0138",
"name": "Reboot Hub",
"method": "POST",
"ret": "obj",
"paytoqs": "ignore",
"url": "http://192.168.x.x/hub/reboot",
"tls": "",
"persist": false,
"proxy": "",
"authType": "basic",
"x": 1410,
"y": 920,
"wires": [
[
"324e773a.3cde88"
]
]
},
{
"id": "e31794bf.463be8",
"type": "pushover api",
"z": "99b3e998.7a0138",
"keys": "ab2cd206.94609",
"title": "Hubitat Watchdog",
"name": "Alert",
"x": 1290,
"y": 680,
"wires": []
},
{
"id": "66be9e7d.a4718",
"type": "delay",
"z": "99b3e998.7a0138",
"name": "YES: 1x/Hour",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "hour",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 1000,
"y": 640,
"wires": [
[
"d9499c3e.568d5"
]
]
},
{
"id": "6bf0a9dd.47d2f8",
"type": "delay",
"z": "99b3e998.7a0138",
"name": "NO: Only Once",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "9",
"rateUnits": "hour",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 1000,
"y": 680,
"wires": [
[
"d9499c3e.568d5"
]
]
},
{
"id": "74749af3.00e334",
"type": "config",
"z": "99b3e998.7a0138",
"name": "Configuration",
"properties": [
{
"p": "criticalsForReboot",
"pt": "flow",
"to": "2",
"tot": "num"
},
{
"p": "criticalsForRebootDuringMaintenance",
"pt": "flow",
"to": "3",
"tot": "num"
},
{
"p": "hubIP",
"pt": "flow",
"to": "192.168.x.x",
"tot": "str"
},
{
"p": "thresholdWarning",
"pt": "flow",
"to": "5",
"tot": "num"
},
{
"p": "thresholdCritical",
"pt": "flow",
"to": "15",
"tot": "num"
},
{
"p": "supportsMemCheck",
"pt": "flow",
"to": "1",
"tot": "str"
},
{
"p": "lowMemForReboot",
"pt": "flow",
"to": "4",
"tot": "num"
},
{
"p": "memThresholdWarning",
"pt": "flow",
"to": "300000",
"tot": "num"
},
{
"p": "memThresholdCritical",
"pt": "flow",
"to": "280000",
"tot": "num"
},
{
"p": "unresponsivesForReboot",
"pt": "flow",
"to": "4",
"tot": "num"
}
],
"active": true,
"x": 200,
"y": 20,
"wires": []
},
{
"id": "ee2159e3.5ca8c8",
"type": "change",
"z": "99b3e998.7a0138",
"name": "Log Auto Reboot",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "CRITICAL! Rebooting Hub!",
"tot": "str"
},
{
"t": "set",
"p": "rebootType",
"pt": "msg",
"to": "automatic",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 820,
"y": 860,
"wires": [
[
"8ce94764.41a9a8"
]
]
},
{
"id": "cc804411.8f9ed8",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Crit",
"func": "flow.set(\"criticals\", flow.get(\"criticals\") + 1);\nmsg.severity = \"crit\";\n\nmsg.payload = \"Response time above CRITICAL threshold.\";\n\n\nif (msg.inMaintenance) {\n msg.critsNeeded = flow.get(\"criticalsForRebootDuringMaintenance\");\n} else {\n msg.critsNeeded = flow.get(\"criticalsForReboot\");\n}\n\nif (flow.get(\"criticals\") >= msg.critsNeeded) {\n msg.reboot = true;\n flow.set(\"lastReboot\", Date.now());\n return msg;\n} else {\n return null;\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 600,
"y": 700,
"wires": [
[
"ee2159e3.5ca8c8",
"b9d7a376.c5c3c",
"ebf5ea8e.097aa8"
]
]
},
{
"id": "a0211c57.4a274",
"type": "switch",
"z": "99b3e998.7a0138",
"name": "Response Time Severity",
"property": "responseTime",
"propertyType": "msg",
"rules": [
{
"t": "lt",
"v": "thresholdWarning",
"vt": "flow"
},
{
"t": "lt",
"v": "thresholdCritical",
"vt": "flow"
},
{
"t": "gte",
"v": "thresholdCritical",
"vt": "flow"
}
],
"checkall": "false",
"repair": false,
"outputs": 3,
"x": 370,
"y": 660,
"wires": [
[
"76bbf689.256a78"
],
[
"668fa13d.8718d"
],
[
"cc804411.8f9ed8"
]
]
},
{
"id": "85e3a9d2.ffac28",
"type": "inject",
"z": "99b3e998.7a0138",
"name": "Manually Reboot Now",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 240,
"y": 920,
"wires": [
[
"c83bc2f.20dd24"
]
]
},
{
"id": "7d1aa0b2.32f54",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Initialize",
"func": "if (typeof flow.get(\"criticals\") == 'undefined') {\n flow.set(\"criticals\", 0);\n}\nif (typeof flow.get(\"warnings\") == 'undefined') {\n flow.set(\"warnings\", 0);\n}\nif (typeof flow.get(\"clears\") == 'undefined') {\n flow.set(\"clears\", 0);\n}\nif (typeof flow.get(\"lowmemwarn\") == 'undefined') {\n flow.set(\"lowmemwarn\", 0);\n}\nif (typeof flow.get(\"lowmemcrit\") == 'undefined') {\n flow.set(\"lowmemcrit\", 0);\n}\nif (typeof flow.get(\"unresponsives\") == 'undefined') {\n flow.set(\"unresponsives\", 0);\n}\nflow.set(\"lastRun\", new Date());\n//flow.set(\"criticalsForReboot\", 2);\n//flow.set(\"criticalsForRebootDuringMaintenance\", 3);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 180,
"y": 100,
"wires": [
[
"3f3f439e.34d58c"
]
]
},
{
"id": "668fa13d.8718d",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Warn",
"func": "flow.set(\"warnings\", flow.get(\"warnings\") + 1);\nmsg.severity = \"warn\";\nmsg.payload = \"Response time above warning threshold.\";\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 600,
"y": 660,
"wires": [
[
"f76db427.a54da8",
"ebf5ea8e.097aa8"
]
]
},
{
"id": "c83bc2f.20dd24",
"type": "change",
"z": "99b3e998.7a0138",
"name": "Log Manual Reboot",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "MANUALLY REBOOTING HUB",
"tot": "str"
},
{
"t": "set",
"p": "rebootType",
"pt": "msg",
"to": "manual",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 820,
"y": 920,
"wires": [
[
"8ce94764.41a9a8"
]
]
},
{
"id": "7ba9fe23.d0026",
"type": "inject",
"z": "99b3e998.7a0138",
"name": "OK",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 190,
"y": 770,
"wires": [
[
"86deb845.451958"
]
]
},
{
"id": "a23d81aa.8db2d",
"type": "inject",
"z": "99b3e998.7a0138",
"name": "Warn",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 190,
"y": 800,
"wires": [
[
"7ef5bdfd.dcae54"
]
]
},
{
"id": "68697bf.1e83084",
"type": "inject",
"z": "99b3e998.7a0138",
"name": "Critical",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 190,
"y": 830,
"wires": [
[
"8f708cef.287a2"
]
]
},
{
"id": "86deb845.451958",
"type": "change",
"z": "99b3e998.7a0138",
"name": "",
"rules": [
{
"t": "set",
"p": "responseTime",
"pt": "msg",
"to": "$flowContext('thresholdWarning') / 2",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 265,
"y": 770,
"wires": [
[
"167f7f25.19df01"
]
],
"l": false
},
{
"id": "7ef5bdfd.dcae54",
"type": "change",
"z": "99b3e998.7a0138",
"name": "",
"rules": [
{
"t": "set",
"p": "responseTime",
"pt": "msg",
"to": "($flowContext('thresholdWarning') + $flowContext('thresholdCritical')) / 2",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 265,
"y": 800,
"wires": [
[
"167f7f25.19df01"
]
],
"l": false
},
{
"id": "8f708cef.287a2",
"type": "change",
"z": "99b3e998.7a0138",
"name": "",
"rules": [
{
"t": "set",
"p": "responseTime",
"pt": "msg",
"to": "$flowContext('thresholdCritical')",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 265,
"y": 830,
"wires": [
[
"167f7f25.19df01"
]
],
"l": false
},
{
"id": "3f3f439e.34d58c",
"type": "subflow:498af3cc.e4ea3c",
"z": "99b3e998.7a0138",
"name": "Check Page",
"env": [],
"x": 190,
"y": 140,
"wires": [
[
"c5e816eb.891b48"
]
]
},
{
"id": "c5e816eb.891b48",
"type": "subflow:a86ab5fe.e6c388",
"z": "99b3e998.7a0138",
"name": "Check Time",
"env": [],
"x": 190,
"y": 180,
"wires": [
[
"e82cc91b.4d3128"
]
]
},
{
"id": "f71dea1b.9e6678",
"type": "comment",
"z": "99b3e998.7a0138",
"name": "Test Injects",
"info": "",
"x": 180,
"y": 740,
"wires": []
},
{
"id": "76bbf689.256a78",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Info",
"func": "flow.set(\"warnings\", 0);\nflow.set(\"criticals\", 0);\nflow.set(\"lowmem\", 0);\nmsg.severity = \"info\";\nmsg.payload = \"All Clear\";\nflow.set(\"unresponsives\", 0);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 600,
"y": 620,
"wires": [
[
"ebf5ea8e.097aa8"
]
]
},
{
"id": "f2dce4e7.029488",
"type": "inject",
"z": "99b3e998.7a0138",
"name": "Simulate Hub Reboot",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 530,
"y": 980,
"wires": [
[
"cfd230f5.6b8f6"
]
]
},
{
"id": "167f7f25.19df01",
"type": "change",
"z": "99b3e998.7a0138",
"name": "Init",
"rules": [
{
"t": "set",
"p": "test",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "reboot",
"pt": "msg",
"to": "false",
"tot": "bool"
},
{
"t": "set",
"p": "inMaintenance",
"pt": "msg",
"to": "false",
"tot": "bool"
},
{
"t": "set",
"p": "awake",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 315,
"y": 800,
"wires": [
[
"a0211c57.4a274"
]
],
"l": false
},
{
"id": "f76db427.a54da8",
"type": "switch",
"z": "99b3e998.7a0138",
"name": "Awake?",
"property": "awake",
"propertyType": "msg",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 790,
"y": 660,
"wires": [
[
"66be9e7d.a4718"
],
[
"6bf0a9dd.47d2f8"
]
]
},
{
"id": "e78e520d.52452",
"type": "delay",
"z": "99b3e998.7a0138",
"name": "YES: 1x/Hour",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "hour",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 1000,
"y": 740,
"wires": [
[
"d9499c3e.568d5"
]
]
},
{
"id": "52c18884.f20c38",
"type": "delay",
"z": "99b3e998.7a0138",
"name": "NO: Only Once",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "9",
"rateUnits": "hour",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 1000,
"y": 780,
"wires": [
[
"d9499c3e.568d5"
]
]
},
{
"id": "cfd230f5.6b8f6",
"type": "change",
"z": "99b3e998.7a0138",
"name": "Log Reboot Sim.",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "CRITICAL! Simulating Hub Rebooting!",
"tot": "str"
},
{
"t": "set",
"p": "test",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 820,
"y": 980,
"wires": [
[
"8ce94764.41a9a8"
]
]
},
{
"id": "8d115420.783478",
"type": "subflow:d8551028.eed36",
"z": "99b3e998.7a0138",
"name": "",
"env": [],
"x": 1090,
"y": 960,
"wires": []
},
{
"id": "221998c2.93a108",
"type": "subflow:d8551028.eed36",
"z": "99b3e998.7a0138",
"name": "",
"env": [],
"x": 1440,
"y": 680,
"wires": []
},
{
"id": "e4478c96.b9e86",
"type": "change",
"z": "99b3e998.7a0138",
"name": "Log Sent Alert",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Alert sent!",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1320,
"y": 730,
"wires": [
[
"221998c2.93a108",
"f754ed1f.935a9"
]
]
},
{
"id": "d9499c3e.568d5",
"type": "no-op",
"z": "99b3e998.7a0138",
"name": "",
"x": 1175,
"y": 710,
"wires": [
[
"e31794bf.463be8",
"e4478c96.b9e86"
]
],
"l": false
},
{
"id": "8ce94764.41a9a8",
"type": "no-op",
"z": "99b3e998.7a0138",
"name": "",
"x": 975,
"y": 920,
"wires": [
[
"8d115420.783478",
"9720202c.7915f",
"264d5f13.ff931"
]
],
"l": false
},
{
"id": "223790f0.0c8af",
"type": "comment",
"z": "99b3e998.7a0138",
"name": "Log Memory to Influx",
"info": "",
"x": 120,
"y": 1100,
"wires": []
},
{
"id": "add12006.7170b",
"type": "delay",
"z": "99b3e998.7a0138",
"name": "1/hr",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "hour",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 1250,
"y": 920,
"wires": [
[
"bb2cbef6.9903d",
"38ffd8cb.624848"
]
]
},
{
"id": "b9d7a376.c5c3c",
"type": "switch",
"z": "99b3e998.7a0138",
"name": "Awake?",
"property": "awake",
"propertyType": "msg",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 790,
"y": 760,
"wires": [
[
"e78e520d.52452"
],
[
"52c18884.f20c38"
]
]
},
{
"id": "38ffd8cb.624848",
"type": "pushover api",
"z": "99b3e998.7a0138",
"keys": "ab2cd206.94609",
"title": "Hubitat Watchdog",
"name": "Alert",
"x": 1390,
"y": 880,
"wires": []
},
{
"id": "9720202c.7915f",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Not Testing?",
"func": "if (msg.test) {\n return null;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1100,
"y": 920,
"wires": [
[
"add12006.7170b"
]
]
},
{
"id": "264d5f13.ff931",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Testing?",
"func": "if (msg.test) {\n return msg;\n}\n\nreturn null;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1090,
"y": 880,
"wires": [
[
"38ffd8cb.624848",
"f754ed1f.935a9"
]
]
},
{
"id": "1c5e075b.49e3a9",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Set Influx Data",
"func": "var v = {\n 'value' : Number(msg.value),\n 'isBinary' : false\n};\n\nmsg.payload = [\n {\n measurement: msg.name,\n fields: {\n value: v.value,\n },\n tags:{\n hub: msg.hubId ? msg.hubId : \"15620he\",\n deviceId: msg.deviceId,\n displayName: msg.displayName,\n unit: msg.unit\n },\n timestamp: new Date()\n }\n]\n\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 540,
"y": 440,
"wires": [
[
"606f04b5.9814dc"
]
]
},
{
"id": "606f04b5.9814dc",
"type": "influxdb batch",
"z": "99b3e998.7a0138",
"influxdb": "a3ef5e72.e2e1",
"precision": "",
"retentionPolicy": "",
"name": "",
"x": 730,
"y": 440,
"wires": []
},
{
"id": "97a347d7.8d5128",
"type": "change",
"z": "99b3e998.7a0138",
"name": "Format",
"rules": [
{
"t": "set",
"p": "name",
"pt": "msg",
"to": "responseTime",
"tot": "str"
},
{
"t": "set",
"p": "value",
"pt": "msg",
"to": "responseTime",
"tot": "msg"
},
{
"t": "set",
"p": "deviceId",
"pt": "msg",
"to": "1",
"tot": "str"
},
{
"t": "set",
"p": "displayName",
"pt": "msg",
"to": "Hubitat Apps Page",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 380,
"y": 440,
"wires": [
[
"1c5e075b.49e3a9"
]
]
},
{
"id": "3aac439b.864a2c",
"type": "config",
"z": "99b3e998.7a0138",
"name": "Initial State - Do Not Edit",
"properties": [
{
"p": "clears",
"pt": "flow",
"to": "0",
"tot": "num"
},
{
"p": "warnings",
"pt": "flow",
"to": "0",
"tot": "num"
},
{
"p": "criticals",
"pt": "flow",
"to": "0",
"tot": "num"
},
{
"p": "lastReboot",
"pt": "flow",
"to": "",
"tot": "date"
},
{
"p": "lowmemwarn",
"pt": "flow",
"to": "0",
"tot": "num"
},
{
"p": "lowmemcrit",
"pt": "flow",
"to": "0",
"tot": "num"
},
{
"p": "unresponsives",
"pt": "flow",
"to": "0",
"tot": "num"
}
],
"active": true,
"x": 440,
"y": 20,
"wires": []
},
{
"id": "ebf5ea8e.097aa8",
"type": "subflow:d8551028.eed36",
"z": "99b3e998.7a0138",
"d": true,
"name": "",
"env": [],
"x": 790,
"y": 560,
"wires": []
},
{
"id": "f754ed1f.935a9",
"type": "debug",
"z": "99b3e998.7a0138",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1390,
"y": 830,
"wires": []
},
{
"id": "46a03855.4959b8",
"type": "subflow:616e8b3e.ef8494",
"z": "99b3e998.7a0138",
"name": "",
"env": [],
"x": 470,
"y": 1180,
"wires": [
[
"9fd2163.a8d2de8",
"2c0f56bd.c2baea"
]
]
},
{
"id": "79bbd0ff.8bb87",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Set Influx Data",
"func": "var v = {\n 'value' : Number(msg.value),\n 'isBinary' : false\n};\n\nmsg.payload = [\n {\n measurement: msg.name,\n fields: {\n value: v.value,\n },\n tags:{\n hub: flow.get(\"hubName\"),\n deviceId: flow.get(\"deviceId\"),\n displayName: msg.displayName,\n unit: msg.unit\n },\n timestamp: new Date()\n }\n]\n\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 680,
"y": 1180,
"wires": [
[
"c11fc5fc.4745b8",
"f5f92fc.eabfcd"
]
]
},
{
"id": "c11fc5fc.4745b8",
"type": "influxdb batch",
"z": "99b3e998.7a0138",
"influxdb": "a3ef5e72.e2e1",
"precision": "",
"retentionPolicy": "",
"name": "",
"x": 890,
"y": 1180,
"wires": []
},
{
"id": "9fd2163.a8d2de8",
"type": "change",
"z": "99b3e998.7a0138",
"name": "Format",
"rules": [
{
"t": "set",
"p": "name",
"pt": "msg",
"to": "freeMem",
"tot": "str"
},
{
"t": "set",
"p": "value",
"pt": "msg",
"to": "freeMemValue",
"tot": "msg"
},
{
"t": "set",
"p": "deviceId",
"pt": "msg",
"to": "1",
"tot": "str"
},
{
"t": "set",
"p": "displayName",
"pt": "msg",
"to": "Free Memory",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 620,
"y": 1140,
"wires": [
[
"79bbd0ff.8bb87"
]
]
},
{
"id": "7b5f8567.feab8c",
"type": "delay",
"z": "99b3e998.7a0138",
"name": "5s delay ",
"pauseType": "delay",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 320,
"y": 1180,
"wires": [
[
"46a03855.4959b8"
]
]
},
{
"id": "f5f92fc.eabfcd",
"type": "debug",
"z": "99b3e998.7a0138",
"name": "Mem Check (Main)",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 890,
"y": 1140,
"wires": []
},
{
"id": "6192f22b.c42c6c",
"type": "switch",
"z": "99b3e998.7a0138",
"name": "Supports Mem Check? (>2.2.3)",
"property": "supportsMemCheck",
"propertyType": "flow",
"rules": [
{
"t": "gte",
"v": "1",
"vt": "num"
}
],
"checkall": "false",
"repair": false,
"outputs": 1,
"x": 370,
"y": 1140,
"wires": [
[
"7b5f8567.feab8c"
]
]
},
{
"id": "e82cc91b.4d3128",
"type": "switch",
"z": "99b3e998.7a0138",
"name": "Responsive?",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "200",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 210,
"y": 280,
"wires": [
[
"a9f1d5cb.7d1cf8"
],
[
"fade13a.4f6b8f",
"97a347d7.8d5128"
]
]
},
{
"id": "bd47bd3e.3ff7c",
"type": "http request",
"z": "99b3e998.7a0138",
"name": "Reboot Hub",
"method": "POST",
"ret": "obj",
"paytoqs": "ignore",
"url": "http://192.168.x.x/hub/reboot",
"tls": "",
"persist": false,
"proxy": "",
"authType": "basic",
"x": 1170,
"y": 1640,
"wires": [
[
"a3b8157f.4c6848"
]
]
},
{
"id": "b938c29b.7a20f",
"type": "pushover api",
"z": "99b3e998.7a0138",
"keys": "ab2cd206.94609",
"title": "Hubitat Watchdog",
"name": "Alert",
"x": 1050,
"y": 1400,
"wires": []
},
{
"id": "9e63bb34.9b2948",
"type": "delay",
"z": "99b3e998.7a0138",
"name": "YES: 1x/Hour",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "hour",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 800,
"y": 1360,
"wires": [
[
"d473a919.f9dd58"
]
]
},
{
"id": "cd8be57.fad0218",
"type": "delay",
"z": "99b3e998.7a0138",
"name": "NO: Only Once",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "9",
"rateUnits": "hour",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 800,
"y": 1400,
"wires": [
[
"d473a919.f9dd58"
]
]
},
{
"id": "a44d466e.47c758",
"type": "change",
"z": "99b3e998.7a0138",
"name": "Log Auto Reboot",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "OS MEMORY CRITICAL! Rebooting Hub!",
"tot": "str"
},
{
"t": "set",
"p": "rebootType",
"pt": "msg",
"to": "automatic",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 650,
"y": 1580,
"wires": [
[
"6b8c6f8a.84f28"
]
]
},
{
"id": "d6354cfd.6b8bf",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Crit",
"func": "flow.set(\"lowmemcrit\", flow.get(\"lowmemcrit\") + 1);\nmsg.severity = \"crit\";\nmsg.payload = \"OS memory below CRITICAL threshold.\";\n\nmsg.memCritsNeeded = flow.get(\"lowMemForReboot\");\n\n\nif (flow.get(\"lowmemcrit\") >= msg.memCritsNeeded) {\n msg.reboot = true;\n flow.set(\"lastReboot\", Date.now());\n return msg;\n} else {\n return null;\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 450,
"y": 1420,
"wires": [
[
"a44d466e.47c758",
"ceb7d60a.beccf8",
"b021bd2d.78523"
]
]
},
{
"id": "2c0f56bd.c2baea",
"type": "switch",
"z": "99b3e998.7a0138",
"name": "Mem Severity",
"property": "freeMemValue",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "memThresholdWarning",
"vt": "flow"
},
{
"t": "btwn",
"v": "memThresholdCritical",
"vt": "flow",
"v2": "memThresholdWarning",
"v2t": "flow"
},
{
"t": "lt",
"v": "memThresholdCritical",
"vt": "flow"
}
],
"checkall": "false",
"repair": false,
"outputs": 3,
"x": 280,
"y": 1380,
"wires": [
[
"99cceea8.83fad"
],
[
"ac500b13.00d588"
],
[
"d6354cfd.6b8bf"
]
]
},
{
"id": "ac500b13.00d588",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Warn",
"func": "flow.set(\"lowmemwarn\", flow.get(\"lowmemwarn\") + 1);\nmsg.severity = \"warn\";\nmsg.payload = \"Free OS memory below warning threshold.\";\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 450,
"y": 1380,
"wires": [
[
"c1208804.6a7a78",
"b021bd2d.78523"
]
]
},
{
"id": "99cceea8.83fad",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Info",
"func": "flow.set(\"lowmemcrit\", 0);\nflow.set(\"lowmemwarn\", 0);\nmsg.severity = \"info\";\nmsg.payload = \"Mem is All Clear\";\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 450,
"y": 1340,
"wires": [
[
"b021bd2d.78523"
]
]
},
{
"id": "c1208804.6a7a78",
"type": "switch",
"z": "99b3e998.7a0138",
"name": "Awake?",
"property": "awake",
"propertyType": "msg",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 620,
"y": 1380,
"wires": [
[
"9e63bb34.9b2948"
],
[
"cd8be57.fad0218"
]
]
},
{
"id": "d0a5df2c.b8e3d",
"type": "delay",
"z": "99b3e998.7a0138",
"name": "YES: 1x/Hour",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "hour",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 800,
"y": 1460,
"wires": [
[
"d473a919.f9dd58"
]
]
},
{
"id": "6463daec.68a684",
"type": "delay",
"z": "99b3e998.7a0138",
"name": "NO: Only Once",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "9",
"rateUnits": "hour",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 800,
"y": 1500,
"wires": [
[
"d473a919.f9dd58"
]
]
},
{
"id": "6b9d9723.81d7f8",
"type": "subflow:d8551028.eed36",
"z": "99b3e998.7a0138",
"name": "",
"env": [],
"x": 850,
"y": 1680,
"wires": []
},
{
"id": "239303ad.e9358c",
"type": "subflow:d8551028.eed36",
"z": "99b3e998.7a0138",
"name": "",
"env": [],
"x": 1240,
"y": 1450,
"wires": []
},
{
"id": "7b07ae66.97361",
"type": "change",
"z": "99b3e998.7a0138",
"name": "Log Sent Alert",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Alert sent!",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1080,
"y": 1450,
"wires": [
[
"239303ad.e9358c"
]
]
},
{
"id": "d473a919.f9dd58",
"type": "no-op",
"z": "99b3e998.7a0138",
"name": "",
"x": 935,
"y": 1430,
"wires": [
[
"b938c29b.7a20f",
"7b07ae66.97361"
]
],
"l": false
},
{
"id": "6b8c6f8a.84f28",
"type": "no-op",
"z": "99b3e998.7a0138",
"name": "",
"x": 735,
"y": 1640,
"wires": [
[
"6b9d9723.81d7f8",
"2f0cd54d.73b27a",
"9b942c3.b5bdfd"
]
],
"l": false
},
{
"id": "a07d1e3f.64917",
"type": "delay",
"z": "99b3e998.7a0138",
"name": "1/hr",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "hour",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 1010,
"y": 1640,
"wires": [
[
"bd47bd3e.3ff7c",
"47ea1852.f9e448"
]
]
},
{
"id": "ceb7d60a.beccf8",
"type": "switch",
"z": "99b3e998.7a0138",
"name": "Awake?",
"property": "awake",
"propertyType": "msg",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 620,
"y": 1480,
"wires": [
[
"d0a5df2c.b8e3d"
],
[
"6463daec.68a684"
]
]
},
{
"id": "47ea1852.f9e448",
"type": "pushover api",
"z": "99b3e998.7a0138",
"keys": "ab2cd206.94609",
"title": "Hubitat Watchdog",
"name": "Alert",
"x": 1150,
"y": 1600,
"wires": []
},
{
"id": "2f0cd54d.73b27a",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Not Testing?",
"func": "if (msg.test) {\n return null;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 860,
"y": 1640,
"wires": [
[
"a07d1e3f.64917"
]
]
},
{
"id": "9b942c3.b5bdfd",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Testing?",
"func": "if (msg.test) {\n return msg;\n}\n\nreturn null;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 850,
"y": 1600,
"wires": [
[
"47ea1852.f9e448",
"3acdd507.701e3a"
]
]
},
{
"id": "b021bd2d.78523",
"type": "subflow:d8551028.eed36",
"z": "99b3e998.7a0138",
"name": "",
"env": [],
"x": 620,
"y": 1320,
"wires": []
},
{
"id": "3acdd507.701e3a",
"type": "debug",
"z": "99b3e998.7a0138",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1170,
"y": 1550,
"wires": []
},
{
"id": "e170347c.3bf598",
"type": "pushover api",
"z": "99b3e998.7a0138",
"keys": "ab2cd206.94609",
"title": "Hubitat Watchdog",
"name": "Alert",
"x": 1130,
"y": 300,
"wires": []
},
{
"id": "d6a3f2c7.03b88",
"type": "subflow:d8551028.eed36",
"z": "99b3e998.7a0138",
"name": "",
"env": [],
"x": 1360,
"y": 340,
"wires": []
},
{
"id": "6a00f1fe.cda31",
"type": "no-op",
"z": "99b3e998.7a0138",
"name": "",
"x": 975,
"y": 340,
"wires": [
[
"e170347c.3bf598",
"11b1e6a6.5d6079",
"8765743e.bc4248"
]
],
"l": false
},
{
"id": "a9f1d5cb.7d1cf8",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Unresponsive",
"func": "flow.set(\"unresponsives\", flow.get(\"unresponsives\") + 1);\nmsg.severity = \"crit\"\n\nmsg.payload = \"Hub has become unresponsive. ECONNREFUSED. Will Reboot if connection is not restored in \" + flow.get(\"unresponsivesForReboot\") + \" mins.\";\n\nmsg.critsNeeded = flow.get(\"unresponsivesForReboot\");\n\nreturn msg;\n\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 460,
"y": 280,
"wires": [
[
"dde94289.85743",
"f13d4db4.52597",
"aaa36ff0.ccb75"
]
]
},
{
"id": "11b1e6a6.5d6079",
"type": "subflow:f355fe72.0ca2b",
"z": "99b3e998.7a0138",
"name": "",
"env": [],
"x": 1170,
"y": 380,
"wires": [
[]
]
},
{
"id": "dde94289.85743",
"type": "subflow:d8551028.eed36",
"z": "99b3e998.7a0138",
"name": "",
"env": [],
"x": 660,
"y": 220,
"wires": []
},
{
"id": "aaa36ff0.ccb75",
"type": "function",
"z": "99b3e998.7a0138",
"name": "Power Cycle Sequence",
"func": "if (flow.get(\"unresponsives\") >= flow.get(\"unresponsivesForReboot\")) {\n msg.reboot = true;\n flow.set(\"lastReboot\", Date.now());\n msg.payload = \"Hub is unresponsive. Rebooting.\";\n return msg;\n} else {\n return null;\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 710,
"y": 340,
"wires": [
[
"6a00f1fe.cda31"
]
]
},
{
"id": "f13d4db4.52597",
"type": "delay",
"z": "99b3e998.7a0138",
"name": "1x/5mins",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "5",
"rateUnits": "minute",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 660,
"y": 160,
"wires": [
[
"a3a64654.d225b8"
]
]
},
{
"id": "a3a64654.d225b8",
"type": "pushover api",
"z": "99b3e998.7a0138",
"keys": "ab2cd206.94609",
"title": "Hubitat Watchdog",
"name": "Alert",
"x": 830,
"y": 160,
"wires": []
},
{
"id": "8765743e.bc4248",
"type": "change",
"z": "99b3e998.7a0138",
"name": "Reset unresponsives",
"rules": [
{
"t": "set",
"p": "unresponsives",
"pt": "flow",
"to": "0",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1180,
"y": 340,
"wires": [
[
"d6a3f2c7.03b88"
]
]
},
{
"id": "d37cbef3.8394f",
"type": "comment",
"z": "99b3e998.7a0138",
"name": "Log Response TImes to Influx",
"info": "",
"x": 440,
"y": 400,
"wires": []
},
{
"id": "1f0a6d95.3c12d2",
"type": "comment",
"z": "99b3e998.7a0138",
"name": "Check for Low Memory Conditions - Reboot if Necessary",
"info": "",
"x": 230,
"y": 1300,
"wires": []
},
{
"id": "1c7c1b78.e871e5",
"type": "comment",
"z": "99b3e998.7a0138",
"name": "Power Cycle Hub if Unresponsive",
"info": "",
"x": 150,
"y": 240,
"wires": []
},
{
"id": "a470bd03.6631d",
"type": "comment",
"z": "99b3e998.7a0138",
"name": "Check for High Response Time Conditions - Reboot if Necessary",
"info": "",
"x": 250,
"y": 600,
"wires": []
},
{
"id": "a3b8157f.4c6848",
"type": "delay",
"z": "99b3e998.7a0138",
"name": "",
"pauseType": "delay",
"timeout": "180",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 1360,
"y": 1640,
"wires": [
[]
]
},
{
"id": "324e773a.3cde88",
"type": "delay",
"z": "99b3e998.7a0138",
"name": "",
"pauseType": "delay",
"timeout": "180",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 1610,
"y": 920,
"wires": [
[]
]
},
{
"id": "fade13a.4f6b8f",
"type": "no-op",
"z": "99b3e998.7a0138",
"name": "",
"x": 35,
"y": 320,
"wires": [
[
"4fc43d33.6685b4",
"2f88fed8.b58802"
]
],
"l": false
},
{
"id": "4fc43d33.6685b4",
"type": "no-op",
"z": "99b3e998.7a0138",
"name": "",
"x": 55,
"y": 1140,
"wires": [
[
"6192f22b.c42c6c"
]
],
"l": false
},
{
"id": "2f88fed8.b58802",
"type": "no-op",
"z": "99b3e998.7a0138",
"name": "",
"x": 75,
"y": 660,
"wires": [
[
"a0211c57.4a274"
]
],
"l": false
},
{
"id": "ab2cd206.94609",
"type": "pushover-keys",
"z": "",
"name": ""
},
{
"id": "a3ef5e72.e2e1",
"type": "influxdb",
"z": "",
"hostname": "192.168.x.x",
"port": "8086",
"protocol": "http",
"database": "hubitatLogging",
"name": "InfluxDB - hubitat",
"usetls": false,
"tls": ""
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment