robertsLando / node-red-contrib-m-bus

Node-Red node for M-Bus protocol
MIT License
10 stars 6 forks source link

Multiple M-Bus Nodes storing devices #1

Closed compunited closed 5 years ago

compunited commented 6 years ago

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

robertsLando commented 6 years ago

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

Thanks

robertsLando commented 6 years ago

@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.

robertsLando commented 6 years ago

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 :smile:

compunited commented 6 years ago

Your fix seems to work. an other point: how was your plan of handling same sub addresses?

------ Originalnachricht ------ Von: "Daniel Lando" notifications@github.com An: "robertsLando/node-red-contrib-m-bus" node-red-contrib-m-bus@noreply.github.com Cc: "compunited" mk@compunited.eu; "Mention" mention@noreply.github.com Gesendet: 16.07.2018 08:39:08 Betreff: Re: [robertsLando/node-red-contrib-m-bus] Multiple M-Bus Nodes storing devices (#1)

@compunited https://github.com/compunited Just pushed a possible fix, can you test it from the master before I publish it on npm?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/robertsLando/node-red-contrib-m-bus/issues/1#issuecomment-405159739, or mute the thread https://github.com/notifications/unsubscribe-auth/AbbGo7F5nRF7QjjfoU6_J5MvamsXURN2ks5uHDUMgaJpZM4VP_O2.

compunited commented 6 years ago

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

compunited commented 6 years ago

this is the gateway link https://www.relay.de/produkte/m-bus-master/pegelwandler-pw-250/

robertsLando commented 6 years ago

What do you mean with sub addresses?

compunited commented 5 years ago

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...

robertsLando commented 5 years ago

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

robertsLando commented 5 years ago

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

compunited commented 5 years ago

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

robertsLando commented 5 years ago

@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.

robertsLando commented 5 years ago

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

compunited commented 5 years ago

no it's 1001 https://www.relay.de/fileadmin/user_upload/manuals/TCPIP_DE.pdf

robertsLando commented 5 years ago

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.

robertsLando commented 5 years ago

@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.