Scan code automatization

hello all, i'm starting to use Node-Red and i would like to compare a number code ( 123456 ) that is in an email, between a code in input (barcode 123456) and than do something.
I'm doing this for a school project like scan code for a parking automatization.
I've already set the pluggin for read the email but i don't really know how to compare it between an arduino input (numbercode 123456).

if you have arduino code available in node red flow already , then you can simply use a switch node to control the flow. Or alternatively if you want do something fancy, use function node.

Cattura2|690x388

i'm not very good at it. i don't really know what you mean with "control the flow"
i try someting (schrenshoot) but it doesn't work.
i've not already the scan code available because i order the usb module for arduino today...

Hi. You would do well to spend 30m with this playlist.

Many of the concepts you need to accomplish this are covered. And there are a ton of top tips that will help you're understanding.

Ps, one clue on why your flow doesn't work - those 2 flows are not connected and a msg only travels down connected nodes.

i see that playlist, i think i'm close but at the same time far away ahah.
the things that i didn't know is how to compare 2 inputs in a function block.
example : if the first input (email) that contains multiple msg.payload( 12345678910 & 10987654321 .....) contains the second input ( 12345678910) then say "RIGHT".

the second input isn't the same all the time, it change because it's a barcode scanner...

if(msg.x === msg.y){
  //they are the same
} else {
  //they are different
}

the key to this is getting both values into the same msg so that you can use them in a function.

  1. Have you done the join?

  2. What does your flow look like now?

  3. What do the debug messages look like? (set debug to show complete msg and expand the debug elements fully then screenshot)

  4. paste your function code

    ```
    like this - between backticks
    ```

2

DEBUG:
msg : Object
object
payload: "RIGHT"
topic: "y"
date: "2020-05-20T14:31:40.000Z"
header: object
from: "andrea.belotti.email@gmail.com"
attachments: array[0]
_msgid: "ba276700.296478"
20/5/2020, 16:33:42node: 85823265.ba4ab
x : msg : Object
object
payload: "RIGHT"
topic: "x"
date: "2020-05-20T14:31:40.000Z"
header: object
from: "andrea.belotti.email@gmail.com"
attachments: array[0]
_msgid: "8f78161a.446218"

i see that the topic of the email il the subject of the email so i send the email with the subject "y" and the code "12345678910 ", but the debug say RIGHT also if the input string "x" is different (1234567891099)

Where in your screen shot of the debug msg do you see msg.x or msg.y? I need to see them.

  1. Put a debug BEFORE the function (i.e. before you destroy the payload - your current debug screen shot is fairly useless to us)
  2. Then expand .x and .y to show us where the 2 things you want to compare

lastly, if you had watched those videos, you would see how to get the correct path by copying it from the debug output.

And again, watch that play list - all the info you need is in them.

PS: Please only send smaller screen shots (re-arrange the flow) - we dont need to see 80% white space or the browser title bar or the pallete on the left.

i didn't see msg.x or msg.y i see this in my payload debug :
{"y":"10987654321\n","x":"1234567891099"}

i have been seen the videos but i didn't understan...
the project is to compare a code in a email (123456)with a code that take arduino and than if the code of arduino is the same of the email then do something. i don't use javascript in arduino so i don't know how to do this things in nodered....

well if you dont put a DEBUG before (with show complete mesage set) you wont.

the join node takes the 2 inputs and puts them into the msg based on the topic (in your case msg.x and msg.y)

but as you havent put a debug before the function node - we cant see whats in the msg.

Try again.

Put a DEBUG set to "Show Complete Message" BETWEEN the SPLIT and the FUNCTION node (and one after the function too).

Press your inject button

Inspect the debug window & fully expand every thing you see - screenshot it (not the whole web page)

Nearly there. Adjust the join node. Read it's info.

Clue - the 2 is in the wrong place. Move the 2 to the count box (not the timeout box) and screenshot again

So now you have the strings in msg.payload.x & msg.payload.y - you can compare them.

7
the things is that he say "WRONG" also if the string of "x" and "y" are the same