question

elvistherv avatar image
elvistherv asked

External Node Red on Ubuntu connecting to CCGX

Struggeling to set this up I have:

Ubuntu VM with a bridged adaptor on the same network as the CCGX.

I can ping the CCGX

Installed Node Red (https://nodered.org/docs/getting-started/raspberrypi ) got it running as a service and can view the flow editor.

Installed node-red-contrib-victron by doing steps 1,2 & 3 (https://github.com/victronenergy/node-red-contrib-victron#installation-and-usage)
Now I can see the Victron Energy tab


A CCGX with Modbus/TCP and MQTT turned.

Root password set and SSH'd into.

Carried out Step 4. (https://github.com/victronenergy/node-red-contrib-victron#installation-and-usage) - rebooted

Back on the Ubuntu VM

export NODE_RED_DBUS_ADDRESS=192.168.1.4:78 (the IP of the CCGX)

restarted node-red

But can't seem to see anything in the node-red editor.


What am i doing wrong? Do I need to generate the node specification file? (https://github.com/victronenergy/node-red-contrib-victron#generating-the-node-specification-file-developers)


Where do i get 2 .csv files from, I've tried just running (after installing csv-parse and gar via npm)

node parse-services.js --append

but it throws an error:

Please make sure that the files ./csv/dataAttributeEnums.csv and ./csv/dataAttributes.csv exist.


CCGX Color ControlNode-RED
node-red1.png (23.8 KiB)
node-red2.png (7.1 KiB)
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

elvistherv avatar image elvistherv commented ·

I'm running "Latest release" on the CCGX, should I be running the "Latest release candidate"?

0 Likes 0 ·
7 Answers
elvistherv avatar image
elvistherv answered ·

OK I have finally found the solution I think:


If you are running node-red as a service (on Ubuntu/Deb and presumably RaspberryPi at least) you need to add

Environment="NODE_RED_DBUS_ADDRESS=192.168.1.9:78"


to /lib/systemd/system/nodred.service.



2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

mvader (Victron Energy) avatar image
mvader (Victron Energy) answered ·

Hi @ElvisTheRV, the nodered plugins you’re using require the dbus interface of Venus OS to be available on TCP. When running node red on the GX Device itself, ie in/on Venus OS, then thats not necessary.

But since you run node-red on another box (rpi) it is.

Instructions on how to do that are here:

https://github.com/victronenergy/node-red-contrib-victron -> installation.


Careful! This is beyond what people normally do and you might end up bricking the unit. Or perhaps not bricking, but then at least rendering it in a state that there are very little people that know how to get it out.


Matthijs


3 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

elvistherv avatar image elvistherv commented ·

I've done this on the CCGX:

  1. enable d-bus over tcp in your Venus device if you want to use dbus over TCP, otherwise skip this step. Edit /etc/dbus-1/system.conf and add the following directly above <policy context="default">:
  <listen>tcp:host=0.0.0.0,port=78</listen>
  <auth>ANONYMOUS</auth>
  <allow_anonymous/>

Is there anything else that needs to be done on the CCGX CLI, because that page suggests there isn't but I must be missing something.

I've turned Modbus/TCP on in the menus:

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ elvistherv commented ·

Hi, ok; sorry but then I really don't know what the issue could be.

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ mvader (Victron Energy) ♦♦ commented ·

ps: the next thing to do is look into the log files of node-red.

0 Likes 0 ·
Scott Bender avatar image
Scott Bender answered ·

Hi @ElvisTheRV

My first guess is that the NODE_RED_DBUS_ADDRESS env variable is not actually getting to the node red process.

If you’re just setting that via the command line and then running node red via the system commands, then it won’t pick it up

How exactly are you setting NODE_RED_DBUS_ADDRESS and then how are you running node red?


2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

elvistherv avatar image elvistherv commented ·

I've added:

NODE_RED_DBUS_ADDRESS=192.168.1.9:78

to /etc/environment

on the Node-Red server.


I've changed the logging level on the console in settings.json to trace but that doesn't seem to show much:


0 Likes 0 ·
nr-logs.png (83.6 KiB)
elvistherv avatar image elvistherv elvistherv commented ·

Just to reiterate I've not done the steps to generate the nodes (https://github.com/victronenergy/node-red-contrib-victron#generating-the-node-specification-file-developers) as

  1. I'm (presumably) not a developer.
  2. I don't have the .CSV files.


I have however tried

node parse-services.json ./additionalPaths.json --append

But this didn't seem to have any effect.

0 Likes 0 ·
elvistherv avatar image
elvistherv answered ·

So should I try the node generation process?

Where can I get the .csv files?


Should I be running the RC Venus OS on the CCGX?

10 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Scott Bender avatar image Scott Bender commented ·

I’m not sure, I haven’t actually tried this yet. Tried to get it setup today, but I’m having trouble with my GX at home. I’m going to go down to the boat tomorrow and try to get it working there. I’ll let you know what I find...

0 Likes 0 ·
Show more comments
elvistherv avatar image
elvistherv answered ·

Some more info:

dbus-monitor --address "tcp:host=192.168.1.9,port=78"

on the Node Red box results is seeing CCGX/BMV/Quattro data so the Node Red server can definetly see data from the CCGX over dbus, so it looks like a Node-red and/or node-red-contrib-victron issue.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

elvistherv avatar image
elvistherv answered ·

OK trying a new tack, installing a new VM with Node-Red, this is the result of th install, anything to worry about?


elvis@Node-Red2:~/.node-red$ npm install https://github.com/victronenergy/node-red-contrib-victron

> abstract-socket@2.1.1 install /home/elvis/.node-red/node_modules/abstract-socket
> node-gyp rebuild

make: Entering directory '/home/elvis/.node-red/node_modules/abstract-socket/build'
  CXX(target) Release/obj.target/bindings/src/abstract_socket.o
In file included from ../src/abstract_socket.cc:5:
../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../../nan/nan.h:2298:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
 2298 |     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
      |                                                              ^
In file included from ../../nan/nan.h:54,
                 from ../src/abstract_socket.cc:5:
../src/abstract_socket.cc: At global scope:
/home/elvis/.cache/node-gyp/12.13.0/include/node/node.h:560:43: warning: cast between incompatible function types from ‘void (*)(v8::Local<v8::Object>)’ to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
  560 |       (node::addon_register_func) (regfunc),                          \
      |                                           ^
/home/elvis/.cache/node-gyp/12.13.0/include/node/node.h:594:3: note: in expansion of macro ‘NODE_MODULE_X’
  594 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
      |   ^~~~~~~~~~~~~
../src/abstract_socket.cc:181:1: note: in expansion of macro ‘NODE_MODULE’
  181 | NODE_MODULE(abstract_socket, Initialize)
      | ^~~~~~~~~~~
In file included from /home/elvis/.cache/node-gyp/12.13.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/abstract_socket.cc:5:
/home/elvis/.cache/node-gyp/12.13.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/elvis/.cache/node-gyp/12.13.0/include/node/node_object_wrap.h:84:78:   required from here
/home/elvis/.cache/node-gyp/12.13.0/include/node/v8.h:10004:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
10004 |                reinterpret_cast<Callback>(callback), type);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/elvis/.cache/node-gyp/12.13.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../nan/nan_object_wrap.h:65:61:   required from here
/home/elvis/.cache/node-gyp/12.13.0/include/node/v8.h:10004:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
  SOLINK_MODULE(target) Release/obj.target/bindings.node
  COPY Release/bindings.node
make: Leaving directory '/home/elvis/.node-red/node_modules/abstract-socket/build'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

+ node-red-contrib-victron@1.2.0
added 46 packages from 81 contributors and audited 64 packages in 12.68s

5 packages are looking for funding
  run `npm fund` for details

found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
elvis@Node-Red2:~/.node-red$


6 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

elvistherv avatar image elvistherv commented ·

I've added DEBUG=node-red-contrib-victron* to /etc/environment

and set logging to trace in settings.js

After running node-red restart I get

As you can see the Victron Node-red is connecting to the CCGX D-Bus.

0 Likes 0 ·
nr-logs2.png (39.0 KiB)
elvistherv avatar image elvistherv elvistherv commented ·

OK at this point can someone just send me the .csv files and I can try generating a services.json as clearly something isn't right and I'm running out of ideas to try.

0 Likes 0 ·
Scott Bender avatar image Scott Bender elvistherv commented ·

Take a look at those last couple of error messages. Seems like you have two node-red processes running.

0 Likes 0 ·
elvistherv avatar image elvistherv Scott Bender commented ·

Just one:

elvis@Node-Red2:~/.node-red/node_modules/node-red-contrib-victron$ ps -ax | grep node-red
  560 ?        SNsl   0:03 node-red
 1710 pts/0    S+     0:00 grep --color=auto node-red


Anyone able to send me the .CSVs?

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ elvistherv commented ·

I'm 99% sure that you don't need the CSVs, and @Scott Bender can probably confirm that with 100% certainty.

0 Likes 0 ·
Scott Bender avatar image Scott Bender elvistherv commented ·

If you’re still getting that “Unable to listen” error, then you have an issue that needs to be addressed. If you don’t fix that, then nothing else you try will make this work.

0 Likes 0 ·
mbosys avatar image
mbosys answered ·

Hi Scott just loaded your new 1.3.0 version but does not load the pallets in node-red and now broken

I am also trying to get previous versions working on hassio node red container install but no service issue on any loaded icons have dbus connected in log, but will not function.

Do not get the ms speed shown on some pic's here

if anyone can help? seems the same issue as elvistherv was having, did anyone get to the bottom of the issues from an external node red system using the TCP 78 port on an venus GX?


Thanks



3 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ commented ·

Hi @mbosys, answer wrt 1.3.0 version & pallets loading is here:

https://github.com/victronenergy/node-red-contrib-victron/issues/56

(and solved).


And could you pls next time put a link back and forth when posting in two places?

Thanks! Matthijs

0 Likes 0 ·
mbosys avatar image mbosys commented ·

Cheers mvader, think this is 2 issues really, so will post the connecting issues to venus here and leave the pallet install issues on here github https://github.com/victronenergy/node-red-contrib-victron/issues/56

Hoping below is the fix for mine but I dont have the file name below on my system as is a container on debian through hassio, so possibly in another location?

ElvisTheRV

answered · Dec 09 at 8:05 PM · ACCEPTED ANSWER

OK I have finally found the solution I think:


If you are running node-red as a service (on Ubuntu/Deb and presumably RaspberryPi at least) you need to add

        
                          
  1. Environment="NODE_RED_DBUS_ADDRESS=192.168.1.9:78"


to /lib/systemd/system/nodred.service.





0 Likes 0 ·
vic2.jpg (308.2 KiB)
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ mbosys commented ·

Hi @mbosys ok thanks. Note that this time I've converted your new answer to a comment, to keep it a bit sequential.

Wrt the file you don't have, you mean this file: /lib/systemd/system/nodered.service ?

The solution will be to find out how to define an environment variable in our install (a container on debian through hassio). I'm not familiar with those, so hopefully someone else and or google can help.

all the best! Matthijs

0 Likes 0 ·