Node-red-node-serialport, can't get data, only connected

I have a Raspbery pi3+ with debian 11. I want to connect with the P1 port of the smartmeter over USB port, so I tried with node-red-contrib-smartmeter package to connect with smartmeter. But it didn't work what so ever. So then I tried to read with node-red-node-serialport Here I can do more settings I thought and see what happens. But all I get here is a connected status when I use /dev/ttyAMA0 or /dev/serial0 But no data from the node whatsoever.

I know my USB to serial cable is OK, because I have a standard smartmeter programm on an sd-card, If I remove sd card with node red, and put this card in, it works very well. So no problem with the cable I would think.

I read many articles about this subject, but none of them gave me a way out of this problem. Maybe @knolleary or @dceejay you guys have one or more hints? Would appreciate that :slight_smile:

can you talk to it from the pi without node-red ? eg using picocom or another serial port command line ? Have you got the speed set correctly ? Does it just send data or do you have to send a command first ? If so have you terminated the command correctly (usually "\r" or "\n") ? etc

AMA0 and serial0 are not USB ports.. they usually show up as /dev/ttyUSB0 and so on.

The speed is correct 115200 baud. 8N1. As far as I know the smartmeter gives a data telegram every second, so I only have to listen, I think.

I don't get connected with /dev/ttyUSB0.

I will try talk/listen with picocom.

@dceejay Ok I get readings from minicom.

minicom -b 115200 -D /dev/ttyUSB0

That looks correct.

But why not from serial node then?

Every time I start minicom I get 5 to 10, mostly broken messages now, and then it just stops.

Does it start automatically or do you need some kind of initiating command?

How is the serial node configured, when is the node supposed to return data. On character or after a timeout?

set the split input to be on char \n or \r rather than time 50mS

@PiMo131 It start automatically. The smartmeter spits out a message about every sec.
I think I only have to listen.


And sometimes (after deploy) I get this report in debug window:

that error usually means something else is already talking to that port... did you close minicom first ?

@dceejay Yes, I did. I think nothing else is talking to that port, as far as I know.
But I have several communications via eth0 running.

If I stop Node-RED. And let only minicom run on command:

minicom -b 115200 -D /dev/ttyUSB0

Then minicom works perfectly.

@PiMo131 @dceejay
Well unbelievable. I restarted Node-RED again. And now all over sudden it is connected and running!!!!

I didn't do anything else!!! :upside_down_face:

1 Like

well whatever was making Node-RED think the port was in use presumably went away on reboot.

1 Like

I think my fault was using /dev/ttyAMA0 and /dev/ttyserial0 as they produced a connect status. After restart node-red it is running now.
I also tried node-red-contrib-smartmeter, but this node I didn't get to run, but I am happy node node-red-node-serialport is running, I can work from there.

So thanks, you guys @dceejay and @PiMo131 for all your help.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.