MicroOcpp icon indicating copy to clipboard operation
MicroOcpp copied to clipboard

StatusNotification error severity mechanism & report resolved errors

Open matth-x opened this issue 1 year ago • 0 comments

This adds the error severity field to the MO error reporting mechanism. The severity can be used to avoid that less important errors are being reported to the server while still being in a highly severe error condition. If the most severe error is resolved, then MO reports the next most severe error. This behavior is useful for some backend systems.

See this example for changing the severity:

addErrorDataInput([] () -> ErrorData {
    if (/* error condition */) {
        ErrorData error = "OtherError";
        error.severity = 2; //increase severity to `2` (default is `1`)
        return error;
    }
    return nullptr;
});

The new build option MO_REPORT_NOERROR=1 applies to errors which don't lead to the Faulted status, i.e. where error.isFaulted == false (for example, the charger reports the WeakSignal error while remaining Available). If all of these errors are resolved, then MO sends a further StatusNotification message with the error code NoError.

matth-x avatar Jun 27 '24 14:06 matth-x