Continue Flow after API error

Hi all,

I have a subflow that checks several things around my home before the main flow shuts down for the night. This all has been working quite well for sometime. However, now I’m getting API errors for my August lock. In the subflow, I call button press to wake the lock up, get the status, then lock it if needed.

I did that, as in the past if the lock was “asleep” the subflow wasn’t reliable. Now I’m sometimes getting API errors, due to rate limiting of the wake button. It is not an issue with the config or Node Red, as I get the same error if I wake the lock from the August HA integration.

My question is this, is there anyway to continue the flow if I get the API error? Any help would be appreciated.

Thanks!!

The portion of the flow where you get the api error would help. Is it the node that halts or is this a message that is sent with the error?

Sure, here is the part of the flow that fails, and below is a screenshot. You can see it works the first time and I get the debug node output. But the second time I get the API error from the node itself, not the debug node.

[{"id":"967320e6980efc2c","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"8d8f58a1503a4d8c","type":"api-call-service","z":"967320e6980efc2c","name":"Front Door August Lock Wake","server":"aa5c8e36.8844d","version":5,"debugenabled":false,"domain":"button","service":"press","areaId":[],"deviceId":[],"entityId":["button.august_front_door_wake"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":570,"y":260,"wires":[["c1d38fbfa378d4f6"]]},{"id":"e9cc8dce11ea391a","type":"inject","z":"967320e6980efc2c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":300,"y":260,"wires":[["8d8f58a1503a4d8c"]]},{"id":"c1d38fbfa378d4f6","type":"debug","z":"967320e6980efc2c","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":820,"y":260,"wires":[]},{"id":"aa5c8e36.8844d","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

If you look at the debug, the action/call service node is sending the message to the window not the debug node.

image

You can use a delay. If the august goes through, it will clear the delay node. If it fails the delay will continue the flow after the timer expires.

[{"id":"8929a9803361bde6","type":"api-call-service","z":"0a325c35fc29f44e","name":"","server":"","version":6,"debugenabled":false,"action":"light.turn_on","floorId":[],"areaId":[],"deviceId":[],"entityId":["light.bar_main"],"labelId":[],"data":"{\"transition\": 30}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","domain":"light","service":"turn_on","x":410,"y":1080,"wires":[["36fe9076ca4ceefc","d96ce3c7f4b8516c"]]},{"id":"d3d682fde3ded030","type":"inject","z":"0a325c35fc29f44e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":1080,"wires":[["8929a9803361bde6","529786a5ee22001b"]]},{"id":"36fe9076ca4ceefc","type":"debug","z":"0a325c35fc29f44e","name":"next node","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":740,"y":1120,"wires":[]},{"id":"529786a5ee22001b","type":"delay","z":"0a325c35fc29f44e","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":440,"y":1220,"wires":[["36fe9076ca4ceefc"]]},{"id":"d96ce3c7f4b8516c","type":"change","z":"0a325c35fc29f44e","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":1140,"wires":[["529786a5ee22001b"]]}]
1 Like

If the success of an action isn’t crucial, you can place the action node on a separate “branch” and allow the flow to proceed without waiting for its result.

image

However, if you want the flow to continue only when encountering a specific error, like “Rate limited, try again in 25 minutes,” you can use a Catch node connected to a Switch node. This setup will filter the error message before passing it to a Debug node for further handling.

2 Likes

Oh my gosh, thank you guys, such simple options I didn’t even think about!! Thank you both, I appreciate the help. I’ll probably just go with Kermit’s option, as if the lock is awake already and rate limited it won’t matter. I wish there was a way to know if the lock is already awake, but I don’t believe there is.

1 Like