dirkjanfaber / node-red-contrib-victron-vedirect-usb

Node-RED node for connecting to Victron equipment via a VE.Direct USB cable.
4 stars 1 forks source link

Serial list dropdown is not populated. #1

Closed KidrashVr closed 1 year ago

KidrashVr commented 1 year ago

In version 0.1.1 the dropdown menu not get populated. I'm using 3 original VE.Direct cables.

deunan@victron-lab:~$ ls -ls /dev/ttyUSB*
0 crw-rw-rw- 1 root dialout 188, 0 Mar 20 09:20 /dev/ttyUSB0
0 crw-rw-rw- 1 root dialout 188, 1 Mar 20 09:20 /dev/ttyUSB1
0 crw-rw-rw- 1 root dialout 188, 2 Mar 20 09:20 /dev/ttyUSB2

0|node-red  | TypeError: bindings.list is not a function
0|node-red  |     at /home/deunan/.node-red/node_modules/node-red-contrib-victron-vedirect-usb/src/nodes/vedirect-usb.js:61:14
0|node-red  |     at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
0|node-red  |     at next (/usr/lib/node_modules/node-red/node_modules/express/lib/router/route.js:144:13)
0|node-red  |     at Route.dispatch (/usr/lib/node_modules/node-red/node_modules/express/lib/router/route.js:114:3)
0|node-red  |     at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
0|node-red  |     at /usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:284:15
0|node-red  |     at Function.process_params (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:346:12)
0|node-red  |     at next (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:280:10)
0|node-red  |     at expressInit (/usr/lib/node_modules/node-red/node_modules/express/lib/middleware/init.js:40:5)
0|node-red  |     at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
0|node-red  | TypeError: bindings.list is not a function
0|node-red  |     at /home/deunan/.node-red/node_modules/node-red-contrib-victron-vedirect-usb/src/nodes/vedirect-usb.js:61:14
0|node-red  |     at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
0|node-red  |     at next (/usr/lib/node_modules/node-red/node_modules/express/lib/router/route.js:144:13)
0|node-red  |     at Route.dispatch (/usr/lib/node_modules/node-red/node_modules/express/lib/router/route.js:114:3)
0|node-red  |     at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
0|node-red  |     at /usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:284:15
0|node-red  |     at Function.process_params (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:346:12)
0|node-red  |     at next (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:280:10)
0|node-red  |     at expressInit (/usr/lib/node_modules/node-red/node_modules/express/lib/middleware/init.js:40:5)
0|node-red  |     at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
dirkjanfaber commented 1 year ago

I updated your issue for readability. What is the rest of your hardware + OS version?

FYI: My testing was done on a laptop running Ubuntu 22.04 and on a Cerbo GX running Venus 3.0~22.

KidrashVr commented 1 year ago

I'm using a VM under proxmox deunan@victron-lab:~$ cat /etc/os-release NAME="Linux Mint" VERSION="21.1 (Vera)" The 3 devices appear correctly in the Victronconnect app. They appear 2 times cause the serial and bluetooth connection. Before the 0.1.0 update all was working correctly, it was my first node-red flow. After few minutes all was messed up, i think i update to 0.1.0 without knowing.

KidrashVr commented 1 year ago

That's intresting. I modified directly the usb serial port in the flow source code and it connected. But again when i double click for the configuration, the error is trown.

dirkjanfaber commented 1 year ago

I am able to reproduce the problem. Working on solving it.

dirkjanfaber commented 1 year ago

Can you give it another try? Just updated to 0.1.2.

dirkjanfaber commented 1 year ago

Background of the updates and introduced problem is that I tried to switch to the latest version of SerialPort as the used @serialport/bindings has been renamed. I had expected it to be a @serialport/bindings-cpp drop in replacement, but it turned out the listing of the serial ports moved as well.

KidrashVr commented 1 year ago

It's working, great job!!!! I have a question. Since sometimes Linux messes up the ttyUSB list i use an udev rule like SUBSYSTEM=="tty", ATTRS{idProduct}=="6001", ATTRS{idVendor}=="0403", SYMLINK+="ttyUSB_BMS". If i create a such rule for the Victron cables, they will appear also with the symlink name in the dropdown menu?

dirkjanfaber commented 1 year ago

The code here adds ports to the array of the dropdown. It does filter on the manufacturer name to be 'VictronEnergy BV'. You can see the detected ports by directing your browser to https://venus.local:1881/victron/vedirect-ports (maybe change the name and port to the node-red instance that you use) . That is what the ajax call uses for building the dropdown in the edit panel too.

If the symlink also reports the manufacturer, then I guess it will be added to the dropdown. But not completely sure that it does. You could manually change the used path in the flow.json file to point to the symlinked path though. I am quite sure that that will work.

Note that my cable here uses idProduct 6015 and not 6001.

I'll close this issue now as the dropdown now at least is filling. For new issues or feature requests, please open a new one.