Serial && status node on boot / start


On boot of my raspberry and node red i want to know if my serial port is connected to my arduino.
So i connected the status node to the serial port and to mqtt, but no output
Then i connected the debug to the status node to see if i get feedback on boot but also no result.
If i pull later my usb from the board i get an output.
So it works but not on boot :frowning:
Is there a way to get the node status on boot?




You will only get output if whatever the serial port is connected to actually sends you something.

If Node-RED cannot connect to a serial port on startup, it will give an error in the log.

If you are on a LINUX based machine, you can check the status of a serial port using dmesg - I think there should also be something on one of the /proc pseudo folders but you'd have to look that up I'm afraid. On Windows there should also be a command - probably part of wmic - but it escapes me off the top of my head.



Its on a linux machine, i will try to fix it with that thanks.
But the node has a status on boot like connected if the arduino is connected
Was hoping that i could use that message



If your serial node is showing the status message "connected", you can simple use a status node to look for that message, and trigger another flow whenever it changes... is this what you are looking for?



Exactly that is what i did. But that only works after starting NR
So if NR is running and the status changes it works.
But when it starts the first status is not transmitted



Well ... it is transmitted... but at start time - as node.js is asynchronous - the actual start order and timing of all the nodes is not 100% deterministic (although tab one generally gets started before tab 2 etc) - so the message has probably been and gone before the status node is ready.



ok clear, should it be possible to save it to a flow variable?
or is there any other solution to get the status?