Node-red-contrib-p1reader error

node-red-contrib-p1reader installed and worked got data to debug node.
Now it give this error and i have no idea how to solve. Reinstall the node,rebooted the pi.Only thing i dit not is turn the pi off as is remote and in a almost unreachable place.

 "Connection to P1 meter failed. Error details: Error: Error Resource temporarily unavailable Cannot lock port"

PS How to contact the maintainer of a node ?

  1. Go to the flows page for the node (node-red-contrib-p1reader (node) - Node-RED)
  2. click the View on GitHub link in the Node Info section of the right column
  3. Open an issue with a question - note you will need a GitHub account

But before opening an issue, did you read the How to Use section and configure your smartmeter?

yes i read ,it worked and it stopped working with that error.And nothing how to solve.

Well I would suggest opening an issue on the GitHub page.

I don't think this is an issue with the node.

Cannot lock port

This means another process is reading (like serial.read) from the port and it is exclusive.

@bakman2 Ok noob here, how to find out what process it is, think it must be his own process that keep running.Only node-red and vncserver run on this pi.
PS merry Christmas to all.

If you reboot does it start working again?

@Colin after a reboot it say connected but ,no data to the debugnode. after a deploy it say disconnected and give the error.

Did you verify if you have access from node-red to the device file ? Depending how you connected the P1 device to your pi and which device file it uses, eg /dev/tty-usbserial, do a ls -l on it check the permissions, usually it can only be accessed by root.

drwxr-xr-x 6 pi pi 4096 Aug 8 11:52 p1-smartmeter
from log [2021-12-25T12:06:48.856Z] Trying to connect to Smart Meter via port: /dev/ttyUSB0 (BaudRate: 115200, Parity: none, Databits: 8, Stopbits: 1) 25 Dec 13:06:48 - [info] Started flows [2021-12-25T12:06:48.876Z] Error emitted: Error: Error Resource temporarily unavailable Cannot lock port
Off to Christmas :slight_smile:

Does that message appear when you deploy for the first time?

If so then it probably is a bug in the node not releasing the port when it is stopped, so that it can connect again when it restarts after the deploy.

[Edit] Sorry, I see you answered the first question already, so it may well be a problem with the node.

Verry helpful reply on github NOT. ** This is a typical serialport issue. It is usually fixed when you restart node-red. (not just the flow, restart node-red entirely). If that doesn't help, it's probably a configuration issue or some kind of conflict. Google is your friend, there is ton of material on this problemt**
Not helpful as there is nothing to configure and get a noting found so STUCK.

Can you do a:

sudo lsof /dev/ttyUSB0

and post the output ?

After reboot

lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
node-red 316   pi   22uW  CHR  188,0      0t0  267 /dev/ttyUSB0

the node say connected but no output to debug.
after a deploy it say disconnected, output lsof stay the same

Did you set the debug node to output the "complete msg object" ?
Could you also add a catch node with a debug node (with complete msg object) and do you get any output ?

I assume you have a P1 reader that is compatible with the library ?

Added the catch and debug then deploy node goes to disconect and the debug gets the data every second NOT the catch debug that gets nothing !
the note give the error .
Fact even if i do not use deploy the org-debug gets data.

edit for new stuff
so made a function node to split the telegram to dashboard and see if it keep running. it get data even the p1 node say disconnected .

Happy New Year.

It keeps running but if i go to the dash it take a very long time to show something.

Slow dash is usually due to one of the following...

  • Trying to display charts with too much data (more data points than the width in pixels is simply a waste of resources)
  • Running dashboard on pi browser (browser is resource hungry)
  • High CPU usage on computer where browser is running
  • High CPU usage on computer where node-red is running

Q Steve-Mcl , Yes it write a lot of data in line chart, so i removed the charts and use mqqt. Yes i hope node-red make a dedicated browser only for node-red use,today browsers are to bloated..