# WISE 4060 (advantech) to node red

**URL:** <https://discourse.nodered.org/t/wise-4060-advantech-to-node-red/33547>\
**Category:** General\
**Created:** [30 September 2020 08:31 UTC](https://discourse.nodered.org/t/wise-4060-advantech-to-node-red/33547 "2020-09-30T08:31:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ron10](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@Ron10](https://discourse.nodered.org/u/Ron10)\
**Post date:** [30 September 2020 08:31 UTC](https://discourse.nodered.org/t/wise-4060-advantech-to-node-red/33547/1 "2020-09-30T08:31:08Z")

</div>

Hello,

i'am using Node red to receive the massage from my wise 4060 using modbus tcp . it works wen i instal de modbus tcp with the wise 4060 as modbus server and link to a debug note. i get the following message

Wise : msg.payload : array[8]  
[false, false, false, false, false, false, false, false]

Wen i klik on this link i get

Wise : msg.payload : array[8]  
array[8]  
0: false  
1: false  
2: false  
3: false  
4: false  
5: false  
6: false  
7: false

is there away to split this array string so i can give a action to 1 if this status chance to true

thanks Ron

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [30 September 2020 17:55 UTC](https://discourse.nodered.org/t/wise-4060-advantech-to-node-red/33547/2 "2020-09-30T17:55:12Z")

</div>

Hi Ron,

you can use the power of javascript and convert and split the array of Booleans and send each modbus status to seperate output. Im not exactly sure if this what you need but here it goes :

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/5/15f97c68d68585211a9ae9ca4a0626d8a7d2daa4.png)

```auto
let arr = msg.payload;
let binary = arr.map(el => el ? {payload: 1} : {payload: 0})

return binary;

```

**Test flow :**

```auto
[{"id":"7b2ea4f4.08c55c","type":"inject","z":"4d675784.11e12","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[false, true, false, true, true, false, false, false]","payloadType":"jsonata","x":380,"y":800,"wires":[["e7a930e0.6897d8","c01d20cc.bd17c"]]},{"id":"e7a930e0.6897d8","type":"function","z":"4d675784.11e12","name":"","func":"\nlet arr = msg.payload;\n\nlet binary = arr.map(el => el ? {payload: 1} : {payload: 0})\n\n//return [binary[0], binary[1], binary[2], binary[3], binary[4], binary[5], binary[6], binary[7]];\nreturn binary;","outputs":8,"noerr":0,"initialize":"","finalize":"","x":560,"y":800,"wires":[["dd1bcd50.4ee92"],["c2b571a8.0c2198"],["71bef607.0c3af8"],["d37938ef.23d718"],["56483803.b5933"],["1bcd9bfe.040c44"],["461219b3.7b703"],["51ac1099.d8d65"]]},{"id":"dd1bcd50.4ee92","type":"debug","z":"4d675784.11e12","name":"output 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":680,"wires":[]},{"id":"c2b571a8.0c2198","type":"debug","z":"4d675784.11e12","name":"output 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":720,"wires":[]},{"id":"71bef607.0c3af8","type":"debug","z":"4d675784.11e12","name":"output 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":760,"wires":[]},{"id":"d37938ef.23d718","type":"debug","z":"4d675784.11e12","name":"output 4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":800,"wires":[]},{"id":"56483803.b5933","type":"debug","z":"4d675784.11e12","name":"output 5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":840,"wires":[]},{"id":"1bcd9bfe.040c44","type":"debug","z":"4d675784.11e12","name":"output 6","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":880,"wires":[]},{"id":"461219b3.7b703","type":"debug","z":"4d675784.11e12","name":"output 7","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":920,"wires":[]},{"id":"51ac1099.d8d65","type":"debug","z":"4d675784.11e12","name":"output 8","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":960,"wires":[]},{"id":"c01d20cc.bd17c","type":"debug","z":"4d675784.11e12","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":455,"y":700,"wires":[],"l":false}]

```

[More info on array map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)

---

<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:** [29 November 2020 17:55 UTC](https://discourse.nodered.org/t/wise-4060-advantech-to-node-red/33547/3 "2020-11-29T17:55:18Z")

</div>

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