maddox / harmony-api

🗼 A simple server allowing you to query/control multiple local Harmony Home Hubs over HTTP or MQTT
MIT License
393 stars 115 forks source link

Hub constistenly getting lost #68

Open johnpez opened 7 years ago

johnpez commented 7 years ago

I just installed harmony-api on a raspberry pi, amazing work...thank you.

My raspberry pi is connected via WIFI, my harmony hub never seems to have any issues, but it seems to be dropped pretty regularly from harmony-api, at which point harmony-api stops updating.

I don't see anyone else having this issue, any idea what might be going on and how I can fix it?

An example of the log:

Hub discovered: Harmony Hub at 192.168.1.58.
Updating state for harmony-hub
Updating state for harmony-hub
Updating state for harmony-hub
Hub discovered: undefined at undefined.
Updating state for harmony-hub
Updating state for harmony-hub
Hub lost: Harmony Hub at 192.168.1.58
NemoN commented 7 years ago

yesterday i had several problems with my hubs too. maybe something on the Logitech server side was broken.

johnpez commented 7 years ago

EDIT: Back down again, the same issue continues for me

You may well be right, funny timing that I decided to get it running and test it yesterday...I've been running for a couple of hours this morning without issue which I wasn't able to do yesterday

RoelVG commented 7 years ago

Having the same issue here since a week or so: Hub will get lost after a while after which harmony-api has to be restarted to bring it back.

ftz commented 7 years ago

I`m having the same issues :-(

ctrlaltdylan commented 7 years ago

Same boat, it's like its stuck on updating state

cfort69 commented 6 years ago

Has anybody found a solution for this? It keeps loosing the hub

jonhanford commented 6 years ago

I'm using the api with node-red - for whatever its worth, I solved (okay, well, wrote around) this issue by periodically polling the activity. If the response contains "No" (As in ""No hubs available") the flow runs systemctl stop harmony-api-server.service, waits 20 seconds and then runs systemctl start harmony-api-server.service.

It also does the same if it gets "ECONNREFUSED" like if the api crashed.

It's been pretty rock solid that way for months.

hufftheweevil commented 6 years ago

I think I found a very simple solution to this issue. The underlying XMPP client seems to disconnect after about 62 seconds. All that's needed is to set reconnect: true when creating this client. I've created a PR for harmonyhub-client to address this: https://github.com/swissmanu/harmonyhubjs-client/pull/42

tresby commented 6 months ago

I'm using the api with node-red - for whatever its worth, I solved (okay, well, wrote around) this issue by periodically polling the activity. If the response contains "No" (As in ""No hubs available") the flow runs systemctl stop harmony-api-server.service, waits 20 seconds and then runs systemctl start harmony-api-server.service.

It also does the same if it gets "ECONNREFUSED" like if the api crashed.

It's been pretty rock solid that way for months.

Hey mate,

Could you share your flow for this?

Never tinkered with node-red so not really sure where to start.

Thanks

jonhanford commented 6 months ago

Hey mate,

Could you share your flow for this?

Never tinkered with node-red so not really sure where to start.

Thanks

I was about to comment "wow, I did the same thing" and realized - that was my comment from 6 years ago.

So with the caveat that this is janky work I did years ago, but the note that - I'm still using it exactly like this just fine - this is my "harmony probe" subflow. I'm using it in a flow that connects custom control panels with illuminated status indicators to their relevant appliances. This subflow is polled whenver a panel requests the current system status, and it returns some weirdly named parameters that something later interprets what light to turn on, and if it doesn't detect the hub, or connection is refused, it kills the process and respawns it.

I think, this might not be the right way to do this because I might have had to run node-red as root to do this? Which is really something to avoid. think I had to add nodered user to sudoers which, is possibly inadvisable. I had no idea what I was doing.

So - strictly as a starting point here's my subflow, you'll need to specify the api IP and hub name of your setup.


    {
        "id": "d5d40326.4ca4f",
        "type": "subflow",
        "name": "Harmony-Probe",
        "info": "",
        "in": [
            {
                "x": 58.571428298950195,
                "y": 888.5714874267578,
                "wires": [
                    {
                        "id": "5f8f09c1.2a0b18"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 1421.8571395874023,
                "y": 890.2855060100555,
                "wires": [
                    {
                        "id": "b4bba93e.d8a9d8",
                        "port": 0
                    }
                ]
            },
            {
                "x": 1480.0000686645508,
                "y": 937.9999301433563,
                "wires": [
                    {
                        "id": "12073f57.1e6611",
                        "port": 0
                    }
                ]
            },
            {
                "x": 1481.6747093200684,
                "y": 1000.2379760742188,
                "wires": [
                    {
                        "id": "daa9b85.ebcaf48",
                        "port": 0
                    }
                ]
            }
        ]
    },
    {
        "id": "5f8f09c1.2a0b18",
        "type": "http request",
        "z": "d5d40326.4ca4f",
        "name": "Harmony",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "http://[HARMONY-API-IP-GOES-HERE]/hubs/harmony-hub/status",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "credentials": {},
        "x": 240.00000762939453,
        "y": 965.9999768733978,
        "wires": [
            [
                "96eaf6a.8847d08",
                "6d27df60.58e0a",
                "5a9a8889.ac76e8"
            ]
        ]
    },
    {
        "id": "58ef6d6d.164cc4",
        "type": "switch",
        "z": "d5d40326.4ca4f",
        "name": "Is the TV On?",
        "property": "payload.off",
        "propertyType": "msg",
        "rules": [
            {
                "t": "false"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "outputs": 2,
        "x": 556.9047546386719,
        "y": 942.7300243377686,
        "wires": [
            [
                "ecb51d23.3b5a3"
            ],
            [
                "daa9b85.ebcaf48"
            ]
        ]
    },
    {
        "id": "ecb51d23.3b5a3",
        "type": "switch",
        "z": "d5d40326.4ca4f",
        "name": "Whats The Activity",
        "property": "payload.current_activity.slug",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "watch-tv",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "watch-roku",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "outputs": 2,
        "x": 864.8571701049805,
        "y": 946.2857491970062,
        "wires": [
            [
                "b4bba93e.d8a9d8"
            ],
            [
                "12073f57.1e6611"
            ]
        ]
    },
    {
        "id": "b4bba93e.d8a9d8",
        "type": "change",
        "z": "d5d40326.4ca4f",
        "name": "Ok, TV it is. ",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "TEEVEE",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1271.8571395874023,
        "y": 890.2855060100555,
        "wires": [
            []
        ]
    },
    {
        "id": "12073f57.1e6611",
        "type": "change",
        "z": "d5d40326.4ca4f",
        "name": "I guess it's Roku then. ",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "ROKEEE",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1300.0000686645508,
        "y": 937.9999301433563,
        "wires": [
            []
        ]
    },
    {
        "id": "daa9b85.ebcaf48",
        "type": "change",
        "z": "d5d40326.4ca4f",
        "name": "Television is a wasteland. ",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "BULLSHIT",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1302.8571243286133,
        "y": 986.8571412563324,
        "wires": [
            []
        ]
    },
    {
        "id": "b06467c9.7497d8",
        "type": "comment",
        "z": "d5d40326.4ca4f",
        "name": "Yes",
        "info": "",
        "x": 704.7142333984375,
        "y": 951.1428229808807,
        "wires": []
    },
    {
        "id": "c228b8f6.a87048",
        "type": "comment",
        "z": "d5d40326.4ca4f",
        "name": "No",
        "info": "",
        "x": 704.7142944335938,
        "y": 985.4286410808563,
        "wires": []
    },
    {
        "id": "2f38360a.90e91a",
        "type": "comment",
        "z": "d5d40326.4ca4f",
        "name": "msg cntains \"watch-tv\"",
        "info": "",
        "x": 1068.2857208251953,
        "y": 892.5714123249054,
        "wires": []
    },
    {
        "id": "5747c21f.c9344c",
        "type": "comment",
        "z": "d5d40326.4ca4f",
        "name": "msg ctns \"watch-roku\"",
        "info": "",
        "x": 1081.1428909301758,
        "y": 939.7143838405609,
        "wires": []
    },
    {
        "id": "96eaf6a.8847d08",
        "type": "switch",
        "z": "d5d40326.4ca4f",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "ECONNREFUSED ",
                "vt": "str"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "outputs": 2,
        "x": 289.78570556640625,
        "y": 887.4285278320312,
        "wires": [
            [
                "972b9223.21b3f"
            ],
            [
                "58ef6d6d.164cc4"
            ]
        ]
    },
    {
        "id": "78d58146.b91c7",
        "type": "debug",
        "z": "d5d40326.4ca4f",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 547.0396537780762,
        "y": 983.4127655029297,
        "wires": []
    },
    {
        "id": "972b9223.21b3f",
        "type": "exec",
        "z": "d5d40326.4ca4f",
        "command": "/usr/bin/sudo",
        "addpay": false,
        "append": "systemctl stop harmony-api-server.service",
        "useSpawn": "",
        "timer": "",
        "name": "Stop-Harmony",
        "x": 355.28570556640625,
        "y": 1031.7144165039062,
        "wires": [
            [
                "13b261ca.e353de"
            ],
            [
                "13b261ca.e353de"
            ],
            [
                "13b261ca.e353de"
            ]
        ]
    },
    {
        "id": "db35537f.99d05",
        "type": "exec",
        "z": "d5d40326.4ca4f",
        "command": "/usr/bin/sudo",
        "addpay": false,
        "append": "systemctl start harmony-api-server.service",
        "useSpawn": "",
        "timer": "",
        "name": "Start-Harmony",
        "x": 634.5714073181152,
        "y": 1092.7143211364746,
        "wires": [
            [
                "21e8f856.94e998"
            ],
            [
                "21e8f856.94e998"
            ],
            [
                "21e8f856.94e998"
            ]
        ]
    },
    {
        "id": "13b261ca.e353de",
        "type": "delay",
        "z": "d5d40326.4ca4f",
        "name": "",
        "pauseType": "delay",
        "timeout": "20",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "outputs": 1,
        "x": 290.6785888671875,
        "y": 1099.500207901001,
        "wires": [
            [
                "b526a47f.4fde28"
            ]
        ]
    },
    {
        "id": "a849a4da.915538",
        "type": "delay",
        "z": "d5d40326.4ca4f",
        "name": "",
        "pauseType": "delay",
        "timeout": "45",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "outputs": 1,
        "x": 768.5714416503906,
        "y": 1040.464267730713,
        "wires": [
            [
                "5f8f09c1.2a0b18"
            ]
        ]
    },
    {
        "id": "6d27df60.58e0a",
        "type": "debug",
        "z": "d5d40326.4ca4f",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 529.2857142857142,
        "y": 701.4285714285713,
        "wires": []
    },
    {
        "id": "b526a47f.4fde28",
        "type": "delay",
        "z": "d5d40326.4ca4f",
        "name": "",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "5",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": true,
        "outputs": 1,
        "x": 447.85713195800776,
        "y": 1098.5713558197021,
        "wires": [
            [
                "db35537f.99d05"
            ]
        ]
    },
    {
        "id": "21e8f856.94e998",
        "type": "delay",
        "z": "d5d40326.4ca4f",
        "name": "",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "5",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": true,
        "outputs": 1,
        "x": 592.8571510314941,
        "y": 1040.0000343322754,
        "wires": [
            [
                "a849a4da.915538"
            ]
        ]
    },
    {
        "id": "5a9a8889.ac76e8",
        "type": "switch",
        "z": "d5d40326.4ca4f",
        "name": "",
        "property": "payload.message",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "No",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "outputs": 1,
        "x": 293.3333053588867,
        "y": 841.6665992736816,
        "wires": [
            [
                "78d58146.b91c7",
                "972b9223.21b3f"
            ]
        ]
    },
    {
        "id": "694e9f66.48f01",
        "type": "split",
        "z": "d5d40326.4ca4f",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": 1,
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 326.5,
        "y": 255,
        "wires": [
            []
        ]
    }
]```
tresby commented 6 months ago

Hey mate, Could you share your flow for this? Never tinkered with node-red so not really sure where to start. Thanks

I was about to comment "wow, I did the same thing" and realized - that was my comment from 6 years ago.

So with the caveat that this is janky work I did years ago, but the note that - I'm still using it exactly like this just fine - this is my "harmony probe" subflow. I'm using it in a flow that connects custom control panels with illuminated status indicators to their relevant appliances. This subflow is polled whenver a panel requests the current system status, and it returns some weirdly named parameters that something later interprets what light to turn on, and if it doesn't detect the hub, or connection is refused, it kills the process and respawns it.

I think, this might not be the right way to do this because I ~might have had to run node-red as root to do this? Which is really something to avoid.~ think I had to add nodered user to sudoers which, is possibly inadvisable. I had no idea what I was doing.

So - strictly as a starting point here's my subflow, you'll need to specify the api IP and hub name of your setup.

    {
        "id": "d5d40326.4ca4f",
        "type": "subflow",
        "name": "Harmony-Probe",
        "info": "",
        "in": [
            {
                "x": 58.571428298950195,
                "y": 888.5714874267578,
                "wires": [
                    {
                        "id": "5f8f09c1.2a0b18"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 1421.8571395874023,
                "y": 890.2855060100555,
                "wires": [
                    {
                        "id": "b4bba93e.d8a9d8",
                        "port": 0
                    }
                ]
            },
            {
                "x": 1480.0000686645508,
                "y": 937.9999301433563,
                "wires": [
                    {
                        "id": "12073f57.1e6611",
                        "port": 0
                    }
                ]
            },
            {
                "x": 1481.6747093200684,
                "y": 1000.2379760742188,
                "wires": [
                    {
                        "id": "daa9b85.ebcaf48",
                        "port": 0
                    }
                ]
            }
        ]
    },
    {
        "id": "5f8f09c1.2a0b18",
        "type": "http request",
        "z": "d5d40326.4ca4f",
        "name": "Harmony",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "http://[HARMONY-API-IP-GOES-HERE]/hubs/harmony-hub/status",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "credentials": {},
        "x": 240.00000762939453,
        "y": 965.9999768733978,
        "wires": [
            [
                "96eaf6a.8847d08",
                "6d27df60.58e0a",
                "5a9a8889.ac76e8"
            ]
        ]
    },
    {
        "id": "58ef6d6d.164cc4",
        "type": "switch",
        "z": "d5d40326.4ca4f",
        "name": "Is the TV On?",
        "property": "payload.off",
        "propertyType": "msg",
        "rules": [
            {
                "t": "false"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "outputs": 2,
        "x": 556.9047546386719,
        "y": 942.7300243377686,
        "wires": [
            [
                "ecb51d23.3b5a3"
            ],
            [
                "daa9b85.ebcaf48"
            ]
        ]
    },
    {
        "id": "ecb51d23.3b5a3",
        "type": "switch",
        "z": "d5d40326.4ca4f",
        "name": "Whats The Activity",
        "property": "payload.current_activity.slug",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "watch-tv",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "watch-roku",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "outputs": 2,
        "x": 864.8571701049805,
        "y": 946.2857491970062,
        "wires": [
            [
                "b4bba93e.d8a9d8"
            ],
            [
                "12073f57.1e6611"
            ]
        ]
    },
    {
        "id": "b4bba93e.d8a9d8",
        "type": "change",
        "z": "d5d40326.4ca4f",
        "name": "Ok, TV it is. ",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "TEEVEE",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1271.8571395874023,
        "y": 890.2855060100555,
        "wires": [
            []
        ]
    },
    {
        "id": "12073f57.1e6611",
        "type": "change",
        "z": "d5d40326.4ca4f",
        "name": "I guess it's Roku then. ",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "ROKEEE",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1300.0000686645508,
        "y": 937.9999301433563,
        "wires": [
            []
        ]
    },
    {
        "id": "daa9b85.ebcaf48",
        "type": "change",
        "z": "d5d40326.4ca4f",
        "name": "Television is a wasteland. ",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "BULLSHIT",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1302.8571243286133,
        "y": 986.8571412563324,
        "wires": [
            []
        ]
    },
    {
        "id": "b06467c9.7497d8",
        "type": "comment",
        "z": "d5d40326.4ca4f",
        "name": "Yes",
        "info": "",
        "x": 704.7142333984375,
        "y": 951.1428229808807,
        "wires": []
    },
    {
        "id": "c228b8f6.a87048",
        "type": "comment",
        "z": "d5d40326.4ca4f",
        "name": "No",
        "info": "",
        "x": 704.7142944335938,
        "y": 985.4286410808563,
        "wires": []
    },
    {
        "id": "2f38360a.90e91a",
        "type": "comment",
        "z": "d5d40326.4ca4f",
        "name": "msg cntains \"watch-tv\"",
        "info": "",
        "x": 1068.2857208251953,
        "y": 892.5714123249054,
        "wires": []
    },
    {
        "id": "5747c21f.c9344c",
        "type": "comment",
        "z": "d5d40326.4ca4f",
        "name": "msg ctns \"watch-roku\"",
        "info": "",
        "x": 1081.1428909301758,
        "y": 939.7143838405609,
        "wires": []
    },
    {
        "id": "96eaf6a.8847d08",
        "type": "switch",
        "z": "d5d40326.4ca4f",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "ECONNREFUSED ",
                "vt": "str"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "outputs": 2,
        "x": 289.78570556640625,
        "y": 887.4285278320312,
        "wires": [
            [
                "972b9223.21b3f"
            ],
            [
                "58ef6d6d.164cc4"
            ]
        ]
    },
    {
        "id": "78d58146.b91c7",
        "type": "debug",
        "z": "d5d40326.4ca4f",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 547.0396537780762,
        "y": 983.4127655029297,
        "wires": []
    },
    {
        "id": "972b9223.21b3f",
        "type": "exec",
        "z": "d5d40326.4ca4f",
        "command": "/usr/bin/sudo",
        "addpay": false,
        "append": "systemctl stop harmony-api-server.service",
        "useSpawn": "",
        "timer": "",
        "name": "Stop-Harmony",
        "x": 355.28570556640625,
        "y": 1031.7144165039062,
        "wires": [
            [
                "13b261ca.e353de"
            ],
            [
                "13b261ca.e353de"
            ],
            [
                "13b261ca.e353de"
            ]
        ]
    },
    {
        "id": "db35537f.99d05",
        "type": "exec",
        "z": "d5d40326.4ca4f",
        "command": "/usr/bin/sudo",
        "addpay": false,
        "append": "systemctl start harmony-api-server.service",
        "useSpawn": "",
        "timer": "",
        "name": "Start-Harmony",
        "x": 634.5714073181152,
        "y": 1092.7143211364746,
        "wires": [
            [
                "21e8f856.94e998"
            ],
            [
                "21e8f856.94e998"
            ],
            [
                "21e8f856.94e998"
            ]
        ]
    },
    {
        "id": "13b261ca.e353de",
        "type": "delay",
        "z": "d5d40326.4ca4f",
        "name": "",
        "pauseType": "delay",
        "timeout": "20",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "outputs": 1,
        "x": 290.6785888671875,
        "y": 1099.500207901001,
        "wires": [
            [
                "b526a47f.4fde28"
            ]
        ]
    },
    {
        "id": "a849a4da.915538",
        "type": "delay",
        "z": "d5d40326.4ca4f",
        "name": "",
        "pauseType": "delay",
        "timeout": "45",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "outputs": 1,
        "x": 768.5714416503906,
        "y": 1040.464267730713,
        "wires": [
            [
                "5f8f09c1.2a0b18"
            ]
        ]
    },
    {
        "id": "6d27df60.58e0a",
        "type": "debug",
        "z": "d5d40326.4ca4f",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 529.2857142857142,
        "y": 701.4285714285713,
        "wires": []
    },
    {
        "id": "b526a47f.4fde28",
        "type": "delay",
        "z": "d5d40326.4ca4f",
        "name": "",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "5",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": true,
        "outputs": 1,
        "x": 447.85713195800776,
        "y": 1098.5713558197021,
        "wires": [
            [
                "db35537f.99d05"
            ]
        ]
    },
    {
        "id": "21e8f856.94e998",
        "type": "delay",
        "z": "d5d40326.4ca4f",
        "name": "",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "5",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": true,
        "outputs": 1,
        "x": 592.8571510314941,
        "y": 1040.0000343322754,
        "wires": [
            [
                "a849a4da.915538"
            ]
        ]
    },
    {
        "id": "5a9a8889.ac76e8",
        "type": "switch",
        "z": "d5d40326.4ca4f",
        "name": "",
        "property": "payload.message",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "No",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "outputs": 1,
        "x": 293.3333053588867,
        "y": 841.6665992736816,
        "wires": [
            [
                "78d58146.b91c7",
                "972b9223.21b3f"
            ]
        ]
    },
    {
        "id": "694e9f66.48f01",
        "type": "split",
        "z": "d5d40326.4ca4f",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": 1,
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 326.5,
        "y": 255,
        "wires": [
            []
        ]
    }
]```

Thanks the reply!

The Length of your reply scared me abit haha, so had one more go at a “simpler” solution.

Ended up finding a way for a Siri shortcut to be constantly running/checking the status of the hub and then running a command via terminal if it detects it not running. Much like your setup.

This is the Siri shortcut if anyone is curious, it possibly could be optimised. https://www.icloud.com/shortcuts/d18cdafbee1448d0940ed811a3156f03