# Is there a way to pipe commands into bluetoothctl through node-red?

**URL:** <https://discourse.nodered.org/t/is-there-a-way-to-pipe-commands-into-bluetoothctl-through-node-red/10479>\
**Category:** General\
**Created:** [23 April 2019 20:42 UTC](https://discourse.nodered.org/t/is-there-a-way-to-pipe-commands-into-bluetoothctl-through-node-red/10479 "2019-04-23T20:42:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rando](https://avatars.discourse-cdn.com/v4/letter/r/0ea827/32.png) [@rando](https://discourse.nodered.org/u/rando)\
**Post date:** [23 April 2019 20:42 UTC](https://discourse.nodered.org/t/is-there-a-way-to-pipe-commands-into-bluetoothctl-through-node-red/10479/1 "2019-04-23T20:42:56Z")

</div>

I have a node-red project where I test the throughput of a bluetooth device, and this part is working fine. However when the test is concluded, I want to remove the device under test from blutoothctl, and have been running into problems getting this to work through node-red. Currently I have a function node that passes the payload "remove [device MAC]" to an exec node running bluetoothctl in spawn mode. This does not remove the device. This makes sense, because if I manually run the command "bluetoothctl remove [device MAC]" it doesn't get removed either.

I am able to successfully remove the device manually from the command line by running the following commands in succession:  
1.) bluetoothctl  
2.) remove [device MAC]

I can't imagine I'm the first person trying to do this...is there a way to pipe commands into bluetoothctl through node-red?

Here is what my exec node currently looks like:

 ![bluetoothctl](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/8d2520bf6a3d735ee27b0022627d0310912b54f4.png)

Thanks!

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [23 April 2019 22:02 UTC](https://discourse.nodered.org/t/is-there-a-way-to-pipe-commands-into-bluetoothctl-through-node-red/10479/2 "2019-04-23T22:02:06Z")

</div>

You're not the only one who wants to use it [programmatically](https://stackoverflow.com/questions/17580347/programmatically-removing-all-bluetooth-devices-on-the-linux-command-line).

Unless you _need_ to use bluetoothctl, different tools can be used. Else you will have to write a script that uses `expect` to handle commandline interaction.
