Help with HTTP monitor node

Hi, I currently have some flows setup to monitor ICMP for hosts and activate a GPIO in the event of a host becoming unreachable.

I would like to do the same for a webpage, being frigate. Basically I was to activate the GPIO in the event of the frigate container becoming unhealthy or unresponsive.

Any way I could do this?

My current flows look like this, just multiple of them.

[
    {
        "id": "82df664307dddebe",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "782629be73fc1d1a",
        "type": "switch",
        "z": "82df664307dddebe",
        "name": "Check if found",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gt",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 560,
        "y": 160,
        "wires": [
            [
                "f2c7f815bd6d6233"
            ],
            [
                "72b9d81abf404f96"
            ]
        ]
    },
    {
        "id": "f2c7f815bd6d6233",
        "type": "change",
        "z": "82df664307dddebe",
        "name": "Kermit Up",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 760,
        "y": 120,
        "wires": [
            [
                "8baace6765923d9d"
            ]
        ]
    },
    {
        "id": "72b9d81abf404f96",
        "type": "change",
        "z": "82df664307dddebe",
        "name": "Kermit Down",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 770,
        "y": 200,
        "wires": [
            [
                "8baace6765923d9d"
            ]
        ]
    },
    {
        "id": "8baace6765923d9d",
        "type": "rbe",
        "z": "82df664307dddebe",
        "name": "Filter status changes only",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 1030,
        "y": 160,
        "wires": [
            []
        ]
    },
    {
        "id": "a1568a1929df557c",
        "type": "ping",
        "z": "82df664307dddebe",
        "protocol": "Automatic",
        "mode": "timed",
        "name": "server1",
        "host": "192.168.1.1",
        "timer": "5",
        "inputs": 0,
        "x": 290,
        "y": 160,
        "wires": [
            [
                "782629be73fc1d1a"
            ]
        ]
    }
]

Or, would it be possible to send a MQTT message every minute, like a ping?

Then I can setup a node to capture the MQTT message.

Thanks

Use an inject node to initiate a check of the Frigate API (e.g., /api/version) via an http request node. Pass the result to a switch node that verifies if msg.statusCode == 200. Connect the output of this switch to a trigger node, configured to “wait for” and “extend delay if new message arrives.” This way, a message will only pass from the trigger node if no status code of 200 has been received within the last specified interval (X time).

Damn, ok can you elaborate on this a bit more?

Thanks

I dont get a error 200 when the API is unreachable. Instead I get

"RequestError: connect ECONNREFUSED 192.168.1.1:5002 : http://192.168.1.1:5002/api/version"

Ok here is what I have come up with. I feel like I am close however I just cannot get it to differentiate between true and false based on the state of the HTTP API request.

The HTTP request spits out the version just fine when all is up and running. But when down, it spits out an error (to be expected).

I need to somehow differentiate between the version being true and the error being false. I also dont really want to use the version as a string as every time I update frigate this will need to be changed.

I tried using msg.payload for the version when up, and msg.error for the error when its down, but it appears it does not matter if sending the version string or the error, it reports as msg.payload. I think this is where I am getting confused.

[
    {
        "id": "a962f6295a14250c",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "712bde0315f4267b",
        "type": "change",
        "z": "a962f6295a14250c",
        "name": "frigate Up",
        "rules": [
            {
                "t": "set",
                "p": "string[12]",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 900,
        "y": 440,
        "wires": [
            []
        ]
    },
    {
        "id": "360ff778ddacb2c1",
        "type": "http request",
        "z": "a962f6295a14250c",
        "name": "",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "http://192.168.1.1:5000/api/version",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 430,
        "y": 420,
        "wires": [
            [
                "488e63f72424611e",
                "712bde0315f4267b"
            ]
        ]
    },
    {
        "id": "0c3983513a892915",
        "type": "inject",
        "z": "a962f6295a14250c",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "60",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 430,
        "y": 340,
        "wires": [
            [
                "360ff778ddacb2c1"
            ]
        ]
    },
    {
        "id": "7c3125d4e30c5cf0",
        "type": "rbe",
        "z": "a962f6295a14250c",
        "name": "Filter status changes only",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload:string[91]",
        "topi": "topic",
        "x": 1190,
        "y": 380,
        "wires": [
            [
                "c6cc49afefbe3bec"
            ]
        ]
    },
    {
        "id": "488e63f72424611e",
        "type": "change",
        "z": "a962f6295a14250c",
        "name": "frigate Down",
        "rules": [
            {
                "t": "set",
                "p": "payload:string[91]",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 910,
        "y": 380,
        "wires": [
            [
                "7c3125d4e30c5cf0"
            ]
        ]
    },
    {
        "id": "c6cc49afefbe3bec",
        "type": "debug",
        "z": "a962f6295a14250c",
        "name": "debug 7",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1500,
        "y": 420,
        "wires": []
    },
    {
        "id": "a12ed1c1d81e0631",
        "type": "rbe",
        "z": "a962f6295a14250c",
        "name": "Filter status changes only",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 1190,
        "y": 440,
        "wires": [
            []
        ]
    }
]

[{"id":"0c3983513a892915","type":"inject","z":"a962f6295a14250c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":390,"y":512,"wires":[["360ff778ddacb2c1"]]},{"id":"360ff778ddacb2c1","type":"http request","z":"a962f6295a14250c","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.1.1:5000/api/version","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":566,"y":512,"wires":[["d8ea8154a4ab4d37"]]},{"id":"d8ea8154a4ab4d37","type":"switch","z":"a962f6295a14250c","name":"","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":718,"y":512,"wires":[["140cc3089c756d77"]]},{"id":"140cc3089c756d77","type":"trigger","z":"a962f6295a14250c","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"1","extend":true,"overrideDelay":false,"units":"hr","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":866,"y":512,"wires":[["779ef46c77f63c9a"]]},{"id":"779ef46c77f63c9a","type":"debug","z":"a962f6295a14250c","name":"do stuff server hasn't respond in an hour","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1124,"y":512,"wires":[]}]