Issue with a switch

#1

Hi, first time using node-red and enjoying it.

I'm following this idea, and I'm trying to add features. Namely having status lights.

I want a stand-by LED and a Failure LED to light up when appropriate. The first when there is nothing going on, meaning from start until the plate js node is done. The second I'm placing on the bottom of the switch node.

I'm using a R.Pi 3, and an RGB keys module.

Problems: On success it lights both Green and Blue, on failure, it lights up nothing, even with a new added Delay node.

Suggestions?

#2

Add debug nodes along your flow to allow you to check the logic and where the result departs from what you expect. You can also add
inject nodes to inject a messsage along the flow to save having to actually trigger a flow

#3

It's not helping much, seems to be as it should be.

I tried using injects but they were either timed or through a button, neither good options for this use.

#4

If you look at the debug your function node errors when it receives the error_code:400 message this is something you need to fix.

#5

I now know what's going on with that 400 error. It happens anytime the camera can't quite pick up the plate. I checked the image and I'd have a hard time making out the plate myself.

#6

But thats not the issue with your code.
An error is a reasonable response and your following function needs to be able to cope with that. The problem comes in that your "Identify Car" function node cannot cope with a message that is
{error_code:400 , error:"invalid_image-data"} so the function stops and no messages are passed on to nodes further down the flow. This is one reason why your lights don't light up at all on a failure

#7

Got it working, thanks.Got it working by setting the msg.payload.