# MS/TP bacnet protocol

**URL:** https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670
**Category:** Industrial
**Created:** [24 October 2021 17:21 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670 "2021-10-24T17:21:18Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![omaraltimary](https://avatars.discourse-cdn.com/v4/letter/o/5f8ce5/32.png) [@omaraltimary](https://discourse.nodered.org/u/omaraltimary)
#### Post date: [24 October 2021 17:21 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670/1 "2021-10-24T17:21:18Z")

</div>

I have controller from Johnson control and I want read signals from it , by using rs485 MS/TP BACnet.  
if there is any way to read .  
BACnet node available for Ethernet only.  
so any help I will be thankfully.

---

<div class="post-metadata">

### Author: ![iiLaw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iilaw/32/14782_2.png) [@iiLaw](https://discourse.nodered.org/u/iiLaw)
#### Post date: [25 October 2021 15:05 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670/2 "2021-10-25T15:05:33Z")

</div>

have search of forum as someone has a way of calling bacpypes MS/TP see

> [@BACnet data read, write, release from Node Red via Rest](https://discourse.nodered.org/t/bacnet-data-read-write-release-from-node-red-via-rest/50068):
>
> Hi, I made a [rest interface with Python and Flask](https://github.com/bbartling/flask-restul-bacnet) to take advantage of the Python based BACnet stacks. The Python based BACnet stacks are well supported and used in industry, versus I think the javascript BACnet stacks are not well supported/maintained and do not support MSTP type BACnet networks. See this git repo for anyone interested in testing this. At the moment I have only tested the Flask rest interface with insomnia. Im still learning to code yum My background is a field technician f…

---

<div class="post-metadata">

### Author: ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)
#### Post date: [25 October 2021 17:57 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670/3 "2021-10-25T17:57:49Z")

</div>

I just updated [the repo](https://github.com/bbartling/bacnet-restapi) on the Python side to include a swagger definition of the restapi endpoints.

Let me know if you have any questions feel free to submit a git issue for getting started. You just need to git clone the repo and run a python web where you can do BACnet read, write, releases with Python BACnet stacks via restapi calls from node red.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [26 October 2021 09:11 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670/4 "2021-10-26T09:11:39Z")

</div>

Hi - just looking at the repo I can't see the swagger yaml or json ? I was going to run it through nodegen [Home · node-red/node-red-nodegen Wiki · GitHub](https://github.com/node-red/node-red-nodegen/wiki) to see if it generated successfully.

---

<div class="post-metadata">

### Author: ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)
#### Post date: [26 October 2021 12:19 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670/5 "2021-10-26T12:19:21Z")

</div>

Let me look into this! Ill post something soon

---

<div class="post-metadata">

### Author: ![omaraltimary](https://avatars.discourse-cdn.com/v4/letter/o/5f8ce5/32.png) [@omaraltimary](https://discourse.nodered.org/u/omaraltimary)
#### Post date: [26 October 2021 19:06 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670/6 "2021-10-26T19:06:41Z")

</div>

I think  
I found a solution but need to check and test.  
by using http request,  
take the full address of point.  
its hopefully work with bacnet router

---

<div class="post-metadata">

### Author: ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)
#### Post date: [26 October 2021 20:01 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670/7 "2021-10-26T20:01:57Z")

</div>

@dceejay I updated my repo for a `swagger` [json file](https://github.com/bbartling/bacnet-restapi/blob/main/swagger_json/testing.json).

Is there any chance you could give me a few tips on how to implement the `nodegen` part? In your link would I just substitute my git URL versus the pet store example?

(1) Generate node using node-red-nodegen command

```auto
node-red-nodegen http://petstore.swagger.io/v2/swagger.json

```

Node-RED users typically import the generated node to the palette of Node-RED flow editor using the following procedures.

(2) Change directory to the generated node's directory

```auto
cd node-red-contrib-swagger-petstore

```

(3) Prepare the symbolic link

```auto
sudo npm link

```

(4) Change current directory to Node-RED home directory (Typically, Node-RED home directory is ".node-red" under the home directory)

```auto
cd ~/.node-red

```

(5) Create a symbolic link

```auto
npm link node-red-contrib-swagger-petstore

```

(6) Start Node-RED

```auto
node-red

```

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [26 October 2021 20:50 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670/8 "2021-10-26T20:50:13Z")

</div>

Hi,  
yes - at most basic you can just run `node-red-nodegen yourSwaggerFile.json` - this will create a directory based off the "info - title" . You can then simply install it by changing to your `.node-red` directory and running `npm i path-to-generated-directory/` (No need to do the link steps any more as the local install will do that for you).

If you want to move the node around you can just run `npm pack` in that directory and then move the created .tgz file and just npm install that.

Then restarting Node-RED and you should have a node with the name in it...  
Of course you can go into the generated directory and then manually edit things in the package.json and other files a per any other node to set colour, name etc etc.

In many ways it's actually very easy to just use the request node as you have done already - but sometimes it's useful to generate a node like this to help users to get it right. (Not the help generation isn't great - but it does try to pick up things from the swagger but it's not obvious which parts make it through the process 🙂

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/8/884ec64d8a471eb32b6725261bfed589cbf318cb.jpeg)

---

<div class="post-metadata">

### Author: ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)
#### Post date: [27 October 2021 19:04 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670/9 "2021-10-27T19:04:43Z")

</div>

@dceejay I updated the [git repo](https://github.com/bbartling/bacnet-restapi) to include the Node Red Function Block building. Any chance you could glance at the README and give me some feedback if it makes sense for the Node Red community? Or if anything is confusing? I am actually a python guy learning javascript and Node Red.

---

<div class="post-metadata">

### Author: ![mtoko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mtoko/32/138_2.png) [@mtoko](https://discourse.nodered.org/u/mtoko)
#### Post date: [28 October 2021 08:52 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670/10 "2021-10-28T08:52:28Z")

</div>

Thanks for this contribution. Just to clarify, the original topic was Bacnet MS/TP serial Rs485 communication to a Bacnet device. The python webap is started with an ip address and port, so no access to the serial port. Can this only be used with a Bacnet Ip to MS/TP router? The ideal solution is a USB Rs485 adapter and serial configuration in the webap to communicate directly with the hardware through the serial port without a router

---

<div class="post-metadata">

### Author: ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)
#### Post date: [28 October 2021 11:54 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670/11 "2021-10-28T11:54:09Z")

</div>

@mtoko yes your right about the original topic here. That would be a cool project of direct USB rs485 BACnet for node red. This [instructables tutorial](https://www.instructables.com/Node-RED-RS485-Raspberry-Pi-Tutorial/) demonstrates that with modbus direct to Node Red without a web app/http requests.

One question I have is if someone replicated the instructables tutorial for BACnet, can Python be used at all to create some sort of Node block for Node Red? Can javascript in Node Red call Python code? Any info on this I am sort of curious, for me there is no better way to learn something than create something in the process. Are there any tutorials for creating Node blocks or Node Red modules/packages? [Is this a good place to start?](https://nodered.org/docs/creating-nodes/)

My original idea behind the web app BACnet restapi is to gather lots of data for IoT applications. Like many devices many points on one restapi call from many different BACnet networks on a LAN, but this idea of serial rs-485 network is different but seems interesting... Thanks for any response!

---

<div class="post-metadata">

### Author: ![omaraltimary](https://avatars.discourse-cdn.com/v4/letter/o/5f8ce5/32.png) [@omaraltimary](https://discourse.nodered.org/u/omaraltimary)
#### Post date: [28 October 2021 18:43 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670/12 "2021-10-28T18:43:33Z")

</div>

can shear video please ?

---

<div class="post-metadata">

### Author: ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)
#### Post date: [18 December 2021 12:54 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670/13 "2021-12-18T12:54:51Z")

</div>

Hi sorry for the late response, what do you mean by a video? Feel free to reach out for questions

---

<div class="post-metadata">

### Author: ![rafadh92](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rafadh92/32/74950_2.png) [@rafadh92](https://discourse.nodered.org/u/rafadh92)
#### Post date: [31 January 2023 13:57 UTC](https://discourse.nodered.org/t/ms-tp-bacnet-protocol/52670/14 "2023-01-31T13:57:37Z")

</div>

Hi. the bacnet router its necessary to enable this config for make possible to read the data?
