Automatic unfault of inverters after battery is recharged

I have an off-grid system, and when the battery gets too depleted overnight the inverters can get stuck in a faulted state. This bit of node-red code catches the fault state and waits until the battery has been recharged a bit before pushing reset on the ve.net bus. As a side effect, it also keeps me informed of the changing state of the inverter via email (which is in a subflow so as to not leak my password).

[
    {
        "id": "dee8d18ffbf0732c",
        "type": "tab",
        "label": "Inverter",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "b63b052d47b018fa",
        "type": "victron-input-vebus",
        "z": "dee8d18ffbf0732c",
        "service": "com.victronenergy.vebus/274",
        "path": "/State",
        "serviceObj": {
            "service": "com.victronenergy.vebus/274",
            "name": "Inverter"
        },
        "pathObj": {
            "path": "/State",
            "type": "enum",
            "name": "VE.Bus state",
            "enum": {
                "0": "Off",
                "1": "Low Power",
                "2": "Fault",
                "3": "Bulk",
                "4": "Absorption",
                "5": "Float",
                "6": "Storage",
                "7": "Equalize",
                "8": "Passthru",
                "9": "Inverting",
                "10": "Power assist",
                "11": "Power supply",
                "252": "External control"
            }
        },
        "initial": "",
        "name": "",
        "onlyChanges": true,
        "x": 120,
        "y": 100,
        "wires": [
            [
                "c55a57f88fa739cb"
            ]
        ]
    },
    {
        "id": "3ca9a81c7f1c98fe",
        "type": "victron-output-vebus",
        "z": "dee8d18ffbf0732c",
        "service": "com.victronenergy.vebus/274",
        "path": "/SystemReset",
        "serviceObj": {
            "service": "com.victronenergy.vebus/274",
            "name": "Inverter"
        },
        "pathObj": {
            "path": "/SystemReset",
            "type": "enum",
            "name": "VE.Bus Reset",
            "enum": {
                "0": "No",
                "1": "Yes"
            },
            "mode": "output"
        },
        "name": "VE.Bus Reset",
        "onlyChanges": false,
        "x": 900,
        "y": 180,
        "wires": []
    },
    {
        "id": "df982f5e409e6043",
        "type": "change",
        "z": "dee8d18ffbf0732c",
        "name": "1",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "1",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 750,
        "y": 180,
        "wires": [
            [
                "3ca9a81c7f1c98fe"
            ]
        ]
    },
    {
        "id": "a3509ec24b5209e2",
        "type": "link call",
        "z": "dee8d18ffbf0732c",
        "name": "",
        "links": [
            "f8d22ae699f4f7c2"
        ],
        "linkType": "static",
        "timeout": "30",
        "x": 930,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "a8453fbc920ab0e2",
        "type": "change",
        "z": "dee8d18ffbf0732c",
        "name": "# Description",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$number(payload) & \":\" & textvalue",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 670,
        "y": 380,
        "wires": [
            [
                "abd38eef9c93dbf5"
            ]
        ]
    },
    {
        "id": "6ac20979539afe67",
        "type": "switch",
        "z": "dee8d18ffbf0732c",
        "name": "battery >= 5%",
        "property": "victronenergy.battery._512.Soc",
        "propertyType": "global",
        "rules": [
            {
                "t": "gte",
                "v": "5",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 400,
        "y": 180,
        "wires": [
            [
                "006dbef965ce4401"
            ]
        ]
    },
    {
        "id": "9cd53ddbf522d810",
        "type": "comment",
        "z": "dee8d18ffbf0732c",
        "name": "Attempts to reset inverter when it is stuck in a fault condition after a low voltage failure.",
        "info": "",
        "x": 320,
        "y": 40,
        "wires": []
    },
    {
        "id": "0e7f710db3b14781",
        "type": "rbe",
        "z": "dee8d18ffbf0732c",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 910,
        "y": 260,
        "wires": [
            [
                "a8453fbc920ab0e2"
            ]
        ]
    },
    {
        "id": "f85e6dd615c7fee0",
        "type": "change",
        "z": "dee8d18ffbf0732c",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "RESET INVERTER",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 760,
        "y": 120,
        "wires": [
            [
                "a3509ec24b5209e2"
            ]
        ]
    },
    {
        "id": "c55a57f88fa739cb",
        "type": "switch",
        "z": "dee8d18ffbf0732c",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "1",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "2",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "3",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "4",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "5",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "6",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "7",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "8",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "9",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "10",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "11",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "244",
                "vt": "num"
            },
            {
                "t": "istype",
                "v": "number",
                "vt": "number"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "false",
        "repair": false,
        "outputs": 15,
        "x": 110,
        "y": 300,
        "wires": [
            [
                "0e7f710db3b14781"
            ],
            [
                "0e7f710db3b14781"
            ],
            [
                "0e7f710db3b14781",
                "6ac20979539afe67"
            ],
            [
                "3185298a25763b9d"
            ],
            [
                "3185298a25763b9d"
            ],
            [
                "3185298a25763b9d"
            ],
            [
                "3185298a25763b9d"
            ],
            [
                "3185298a25763b9d"
            ],
            [
                "3185298a25763b9d"
            ],
            [
                "0e7f710db3b14781"
            ],
            [
                "0e7f710db3b14781"
            ],
            [
                "0e7f710db3b14781"
            ],
            [
                "a9ae3cb8eb8fa7db"
            ],
            [
                "cd45d4c5ccfd5aae"
            ],
            [
                "a009ec83ecb59ef2"
            ]
        ]
    },
    {
        "id": "3185298a25763b9d",
        "type": "change",
        "z": "dee8d18ffbf0732c",
        "name": "Charging or Passthru",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "3",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "textvalue",
                "pt": "msg",
                "to": "charging or passthru",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 340,
        "y": 280,
        "wires": [
            [
                "0e7f710db3b14781"
            ]
        ]
    },
    {
        "id": "006dbef965ce4401",
        "type": "delay",
        "z": "dee8d18ffbf0732c",
        "name": "",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "5",
        "rateUnits": "minute",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": true,
        "allowrate": false,
        "outputs": 1,
        "x": 580,
        "y": 180,
        "wires": [
            [
                "df982f5e409e6043",
                "f85e6dd615c7fee0"
            ]
        ]
    },
    {
        "id": "86167f1101257778",
        "type": "comment",
        "z": "dee8d18ffbf0732c",
        "name": "Fault",
        "info": "",
        "x": 310,
        "y": 160,
        "wires": []
    },
    {
        "id": "a9ae3cb8eb8fa7db",
        "type": "change",
        "z": "dee8d18ffbf0732c",
        "name": "244 = Sustain",
        "rules": [
            {
                "t": "set",
                "p": "textvalue",
                "pt": "msg",
                "to": "sustain",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 340,
        "y": 360,
        "wires": [
            [
                "0e7f710db3b14781"
            ]
        ]
    },
    {
        "id": "abd38eef9c93dbf5",
        "type": "link call",
        "z": "dee8d18ffbf0732c",
        "name": "",
        "links": [
            "f8d22ae699f4f7c2"
        ],
        "linkType": "static",
        "timeout": "30",
        "x": 850,
        "y": 440,
        "wires": [
            []
        ]
    },
    {
        "id": "cd45d4c5ccfd5aae",
        "type": "change",
        "z": "dee8d18ffbf0732c",
        "name": "Unknown #",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "\"Unknown: \" & $number(payload) & \":\" & textvalue",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 330,
        "y": 400,
        "wires": [
            [
                "c26a1e48b5de47d8"
            ]
        ]
    },
    {
        "id": "a009ec83ecb59ef2",
        "type": "change",
        "z": "dee8d18ffbf0732c",
        "name": "Not #",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "\"Not numeric: \" & payload & \":\" & textvalue",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 310,
        "y": 440,
        "wires": [
            [
                "c26a1e48b5de47d8"
            ]
        ]
    },
    {
        "id": "c26a1e48b5de47d8",
        "type": "rbe",
        "z": "dee8d18ffbf0732c",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 650,
        "y": 440,
        "wires": [
            [
                "abd38eef9c93dbf5"
            ]
        ]
    }
]

The restart parameter on the inverter should do all that automatically.

If the inverter determines the DC voltage is too low, it will turn off, and then turn back on when the DC voltage rises to the restart value. However, there is a separate scenario where the inverter goes into a fault state due to either repeated low voltage events or a more serious brown out while on. There is no automatic restart after this fault state, it’s completely stuck. It may be possible to avoid that fault state by raising the voltages for off and on, but the goal in this case is to reliably restart the inverter after the battery has gotten charged back up enough to not immediately start bouncing on/off again.

I’ve since reworked this code to be even a bit simpler.