# Use external value for BACnet write node?

**URL:** https://discourse.nodered.org/t/use-external-value-for-bacnet-write-node/42469
**Category:** General
**Created:** [11 March 2021 10:24 UTC](https://discourse.nodered.org/t/use-external-value-for-bacnet-write-node/42469 "2021-03-11T10:24:33Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Graves](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/graves/32/38649_2.png) [@Graves](https://discourse.nodered.org/u/Graves)
#### Post date: [11 March 2021 10:24 UTC](https://discourse.nodered.org/t/use-external-value-for-bacnet-write-node/42469/1 "2021-03-11T10:24:34Z")

</div>

I have been using the `node-red-contrib-bacnet` library and everything is working perfectly, I can read and write values to my BACnet controller without an issue. I do have one problem though, I cant figure out how to use the value from another node like a timestamp as the value that is sent by the BACnet write node.  
When I do it like this it writes the value perfectly:

 ![u1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/8/78bfd1749b6790149ebece14eb2fe9b27f041521.png)  
But it does not work at all when I try to use the `msg.payload` from another node:  
 ![u2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/a/faf768fe8c44b48795baca6146e1249830575f79.png)  
I have tested the `msg.payload` itself and it shows up fine in debug.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [13 March 2021 09:30 UTC](https://discourse.nodered.org/t/use-external-value-for-bacnet-write-node/42469/2 "2021-03-13T09:30:23Z")

</div>

Did you read the built in help?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/4/846dfd58cdb349289c585fff0a5ba9b71dcfbbce.png)

---

<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: [14 March 2021 22:00 UTC](https://discourse.nodered.org/t/use-external-value-for-bacnet-write-node/42469/3 "2021-03-14T22:00:23Z")

</div>

Here is an example of my function node writing a Temperature value to the Present Value of an Analogue Value object

```auto
var temp = parseFloat(msg.payload[Object.keys(msg.payload)[0]].toFixed(1));
msg.payload = {
    objectId: {type: 2, instance: 201}, 
    propertyid: 85,
    values: [{type: 4, value: temp}],
    priority: 8
}
return msg;

// type: 2 = Analog_Value
// Instance: 201
// propertyid: 85 = Present value
// values: [{type: 4, value: temp}] -- type 4 = Real
// wired to BACnet write node

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [13 May 2021 22:01 UTC](https://discourse.nodered.org/t/use-external-value-for-bacnet-write-node/42469/4 "2021-05-13T22:01:19Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
