robertsLando/node-red-contrib-m-bus

Multiple M-Bus Nodes storing devices

compunited opened this issue · 16 comments

Hi Daniel,
excellent work so far
One issue: My scenario has 5 M-Bus Master connected to the Node Red machine. It seems that there is no way of having a device list for each of the nodes. And there is no command on the mbus controller for ResetDeviceList

You right, I have always tested it with just one configuration, I will fix this asap.

Thanks

@compunited Just pushed a possible fix, can you test it from the master before I publish it on npm?

  1. Clone this repo git clone https://github.com/robertsLando/node-red-contrib-m-bus
  2. Link the node to node-red modules:

go to the downloaded directory cd node-red-contrib-m-bus and run sudo npm link.
in your node-red user directory (usually ~/.node-red) run: npm link node-red-contrib-m-bus.

About the "ResetDevicesList" feature, I have not placed it as when you start a scan the old devices list will be overwritten once the scan is successfully done.

Tips:

I have developed this node to be "plug and play" as much as I can using automatic scan and automatic cyclic uptades of each device found by the scan but my suggestion is to do the scan "manually" using primary ids and disable the autoscan flag on the m_bus client configuration (you can find the "manually" primary ids scan on the flow provided at the end of Readme.md). You can also manually edit the mbus_devices.json file placed in ~/.node-red dir and add there an array with the primary ids of the devices you want to read. (Will update the node to make this less complicated)

I have tested my node in very large enviroments and seems that sometimes there are conflict on secondary ids. This doesn't depends on my node but it depends on the libmbus library that is the C lib I use to read M-Bus.

Can you also provide me the name and the url of your M-Bus gateway? I will add it to the list of tested gateways, thanks 😄

my scenarios are about 600 meters. currently i'm using 5 old DR003 from relay. we are going to change one against the new one PW250 with virtual com port over ethernet since the USB serial change their IDs if one usb is pulled. And maybe we will test HD67030-B2-250 from adfweb

What do you mean with sub addresses?

i had some address collisions shown as error.
But the biggest problem right now is that the new version doesn't install:

node-mbus@0.5.3 install /root/.node-red/node_modules/node-mbus
node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/8.11.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp"
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/root/.node-red/node_modules/node-mbus/build'
gyp ERR! System Linux 4.4.50-rt66-v7+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/.node-red/node_modules/node-mbus
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-mbus@0.5.3 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-mbus@0.5.3 install script.
npm ERR! This is probably not a probl...

This is not a problem related to this node like your log says at the end

To fix this try to install/update the node using --unsafe-perm option

npm install node-red-contrib-m-bus --unsafe-perm

Address collisions happens when reading using secondary adresses like I told you in previous comments, use primary addresses instead to fix this

Ok, it is running again. thank you for you help.
Concerning TCP/ip Relay is using port 1001 but we still have some defective meters on the bus so i can't read at the moment..
But there is some strange behavior in the gui
3notproperconfigured
2tcpredframe
1screenshottcp

@compunited That is because the field serial port is set as required in the node configuration, you have used tcp and so that field is empty (if you want to remove the error just set the serial port to some value). I have noticed this error too, I will fix this asap anyone if you deploy the node works without any problem.

The port used is 10001 (maybe you have missed a '0') I will also change this as default instead of 2000

You right, my TCP device uses the port 10001 so I thought you typed it wrong. I have already fix the error with the empty port, I will set it to a default value.

I'm thinking about adding a feature to the controller to manually set the devices array with the ids to read, as I told you in prev comments seems that the scan/read using secondary ids is not so good as there are lot conflict in wide enviroments. When reading devices using primary ids everything works correctly.

ATM I'm manually creating the mbus_devices_<clientName>.json inside .node-red directory with an array of the primary ids of the devices I want to read.

@compunited Just published on NPM version 1.2.2 with some bug fix and the new feature on controller:

setDevices to manually set the array of devices to read. Import the flow on readme to see how it works.

Just send to mbus_controller a msg with an Array of Strings/Numbers as msg.payload and 'setDevices' as msg.topic.