Sending Commands to an External Device in Tasker

Written by Anthony Pavia on Jun 3, 2025 11:48 am

A key feature of Tasker is being able to send commands to external devices on your network using Tasks. The only requirement is knowing the settings for how the device listens on the network. This post will go over creating a device configuration for a TCP device in Tasker and then using it in a Task to send to it.

Create the Device Configuration

Before we create a task to send to our external device, we first need to define the device within Tasker. To do this, we navigate to the Devices Tab in our workspace. Once there, we’ll select the ‘+ Add Device’ option, and a dialog box will open for us to create a new device configuration.

Different devices can communicate in different ways, and need to be defined as such when creating a device configuration in Tasker. In our example, we’ll use an Ethernet device called ‘TCPDevice’. Once created, it will have two fields and a pair of radio buttons. The first field will be for the device’s IP address, the second will be for its port number, and the radio buttons will allow the device to toggle between being a UDP or TCP device. In our example we’ll use the IP 10.0.0.100, the port number 5555, and we’ll set the device to TCP. 

Once those values are set, we can then begin creating the task that will send to this device.

Create the Task to Send to the Device

Moving now to the Tasker tab, we’ll click the ‘+ Add Task’ button. A menu will open to name the task being created. For our example we’ll name it ‘TCP_Device_Send’. Once the task is created, inside will be a ‘+ Add Action’ button. Select that, and another dialog will open with a menu for different types of actions that can be used in tasks. At the bottom should be the communication group, and inside we’ll select the ‘Device Send’ action. This will be the task that will send to our device.

Once added, our task will have two fields and a checkbox available. The first field is a dropdown menu, where you can select devices created in the device tab as the target to be sent to. The second field is the text you wish to send to the device. The checkbox under it allows for a response to be returned from the device we are sending to, which we’ll cover more in the next section. In our example, we selected our ‘TCPDevice’ we created, and we are going to send the text ‘Test Data’ to it.

Once these fields are set, save your changes, and now any time you execute your task, it will send the text ‘Test Data’ to the Device you defined in Tasker!

Listening For a Response After Sending

When selecting the ‘Listen for Response’ checkbox under the ‘Device Send’ action, for 2 seconds Tasker will listen for a response from that device. You can use other Task actions to interact with what gets returned from the device by using the syntax ‘DEVICENAME_buffer’. From our example, since the device name is ‘TCPDevice’, the syntax for interacting with what gets returned would be ‘TCPDevice_buffer’.

There are two formats that the response from the device can be in: either text or hex. To format the response to be in hex, you’ll use the syntax ‘hex.utils.bytestohex()’. To convert the response from our example device to hex, you’d use the syntax ‘hex.utils.bytestohex(TCPDevice_buffer)’. To convert the response to text, you’ll use the syntax ‘string.frombytes()’. Using our example device with this, the syntax would be ‘string.frombytes(TCPDevice_Buffer)’.

NOTE: When using syntax values, make sure they are encompassed by double squiggly braces {{ }}.

Below is an example using our previous device send action, along with additional actions to interact with the response from the device after sending. The log action will log the response to a file as hex, and the user alert action with display a pop-up message with the response as text.

On this page
Tags