Tag Archive: devices

One of the actions you can perform in Tasker is the HTTP request action. This action allows you to post information to a specific URL. This post will show you an example of this.

You’ll start by going to the Tasker Web Page, and once you are there you’ll want to create new workspace, and then add a task to it. 

Once you’ve created and named a task for the workspace, you’ll want to add the HTTP request action to the Task. You’ll do this by clicking the add action button, and then selecting the HTTP request action in the Add Action Dialog box.


After you have added the HTTP request action to your Task, you’ll now want to enter the URL you wish to request from which will include the data that we are requesting. For this example, we are going to request a macro from the Cinema application. Here is a link to a post for installing the Cinema application if you don’t have it. This example assumes you’ve created a macro in the support tool called ‘pulse_output_1’, but the URL can include the name of any macro you have. Also the URL we are about to enter will use the IP address of 10.0.0.131, but this value should be of YOUR JNIOR’s IP address when doing a URL request to Cinema or the IP of whatever device you would be doing a HTTP request to. Lastly, the URL will include 8090 because that is the port Cinema listens on for macros. With this in mind, we’ll set the URL field to http://10.0.0.131:8090/macro?name=pulse_output_1.

You can then execute this task and Cinema will activate the macro included in the URL, which based off its name would have pulsed output 1 showing you have successfully sent a HTTP request!

A username:password@ can be provided prior to the IP Address for those HTTP requests the require login.

Note: This functionality will require at least Tasker version 3.9

There are times when we want to log a temperature.  To do this we need to select a time interval between samples.  This interval can either be too short or too long.  Very rarely can we get the perfect interval.  A short interval leads to redundant data where the temperature doesn’t change often and several samples log the same temperature in a row.  A long interval can hide valid temperature changes.

So we ask ourselves, what do we really want?  The answer is usually that we want to know when the temperature changes.  Using the setup below, we can achieve the desired functionality. 

Configuration

The following image shows how we can set up a Task with Variables and Logic to only Log when the temperature changes.  The global variables make sure the current temperature values that are used in the logic are used when making the log entry.

Tasker Logging workspace

This screenshot shows how to configure the Logger to use the global variables.

Loggers in Tasker

This screenshot shows configuring the schedule to call the Task with a short interval.  The logic within the Task is responsible for making sure the log entries only occur when there is a valid temperature change.

Scheduled Log Tasks in Tasker

Result

Here is the result of a the functioning configuration over the past 15 minutes.  You’ll notice that the temperature changes, but it tends to bounce back and forth between two or three values.  We can handle that in another article!

Logged Temperature values

As long as the device you are sending to can create TCP or serial connections, the JNIOR should be able to send commands to it.

If you are starting from scratch with a JNIOR, you’ll want to download the JNIOR Support Tool. This application allows you to update JNIOR’s with INTEG software that you’ll need to let you send the text command.

Once you’ve downloaded the JNIOR Support Tool, you’ll need to download two update projects from our site and update them to your JNIOR. The first update project is the Series 4 All-In-One update project. Its recommended for any new Series 4 JNIOR, as the update project gives JNIORs the most recent OS, along with some basic applications. The second update project is the Cinema update project. This is the application you’ll use to execute a macro, which will send a command from the JNIOR to a device.

To update your JNIOR with an update project, here is a link to a post on our site that shows how to install Cinema. NOTE: Though the post shows how to install Cinema, its recommended you install the Series 4 All-In-One first, using the steps in that post.

Once the update projects have been published to your JNIOR, we’ll now need to create a device in the support tool to send to. In the support tool, you’ll go to the device tab and select add. You can select the device and rename it. After that you’ll now configure the settings of the device so we can send macros to it. To start you’ll select your device type, and if you see the device you want to send to there you’ll select it. If not you’ll select Raw Ethernet for a TCP connection or Raw Serial for a serial connection. You’ll then set the rest of the device configuration according to the device’s TCP or serial settings.

Once you finish setting the device information, you’ll then want to save the device file by clicking the Save As button. After that you’ll then publish the file to the JNIOR you are using by clicking the Publish to JNIOR button.

After you’ve done that, we’ll now create the macro that will be sent to the device that will contain the text command. Going back to the support tool, you’ll go to the macro tab.

The first thing we’ll want to do here is click the “Link Devices” button at the top. Here we’ll select the device file we just created, so we can reference it in our action for the macro we are going to create.

After completing that, at the bottom left corner of the macro view and you’ll select add/macro. A new macro should populate the macro view, and you can then click on it and rename it. I’m going to name it ExampleMacro.

Once you’ve done that you’ll now go to the action view and select the add button there. A new action should appear in the action view. You can rename this if you’d like, and then we’ll want to select the device we previously created in the Support Tool to send to. Lastly, in the data field you’ll want to enter the text command you wish to send to the device. If you are using a Raw Serial/Raw Ethernet device, make sure you include the termination string at the end of your text command for the device you are sending to.

Once that is finished, make sure you add the action we created to the macro we created. You do this by selecting the macro, then the action, followed by the arrow between the macro and action view.

Lastly, like we did with the device file, we’ll save this using the Save As button, followed by publishing it to the correct JNIOR using the Publish to JNIOR button.

Macro tab for JNIOR Support Tool

Now the JNIOR has a macro created that will send the text command to your specified device!

One of the useful things about Tasker, is that it can include communicating with other devices within its tasks. This is possible by including a networks action, but before those actions can be used devices need to be added to a Tasker application. This post will explain how to create devices to be used in actions for tasks.

To start, we’ll begin by going to the devices tab of the Tasker application.

Device tab in Tasker

Here we can select the “Add Device” button which brings up a dialog box to add a device to the current workspace. 

Device dialog box in Tasker

In this dialog, two things need to be defined to create the device. This first value needed is the name of the device. The second value needed is the device type, which can either be an Ethernet or SNMP Device. Depending which Device type you choose changes the what information you can configure for the device after creating it.

Creating an Ethernet Device

If the Ethernet Device type was selected, the configurable option for the created device should look like this:

Ethernet Device example in Tasker

Two values of the Ethernet Device need configured in order to use it in a Task action, the IP Address and the TCP Port values. These need to be set to the IP Address and TCP Port values on the device, so that when they are used in actions, the JNIOR can properly communicate with the device. Another post has an example of using a TCP Send with an Ethernet Device.

Creating an SNMP Device

If the SNMP Device type was selected, the configurable option for the created device should look like this:

SNMP Device example in Tasker

Three values of the SNMP Device need configured in order to use it in a  Task action which are, the IP Address, the UDP Port, and the Community Name. These are needed for the JNIOR to connect to the SNMP Device and you obtain them from the SNMP Device. A different post shows how to use a SNMP Device with an SNMP Trap.

With this, you should have created devices in Tasker that can be implemented in actions.

This feature is available in Tasker v3.1 and later.

The SNMP application offers built-in Traps when the digital inputs and relay outputs change. Tasker takes this further allowing you to send a SNMP Trap as a part of a Task. The value of the Trap can be custom and dynamic based on the message building rules of Tasker. An example of using a custom SNMP message in Tasker is below.

The first thing we need to do is make sure that SNMP is running. The feature covered in this post is available in SNMP v2.6 and greater. Once we know that SNMP is running we can Create or Open a Tasker Workspace.

To send a SNMP Trap we will need to add the SNMP Trap action to a Task. You can create a new Task for this action or add it to an already existing Task. The action will ask for the SNMP OID (Object Identifier), the message to send and the device to send the Trap to. The device to receive the Trap can be the built-in Trap Host that is defined in the SNMP application or a new one can be defined in the Devices Tab.

Upon selecting the SNMP Trap action you will be presented with the following

Send SNMP Trap empty

Here is what it will look like after entering some information

Send SNMP Trap example

Without defining a SNMP Device, the Trap will be sent to the Trap Host that is defined in the SNMP application. You can optionally define a new Trap Host by clicking + Add Device in the Devices Tab.

Tasker Add Device Action

You will be presented with a Dialog asking for a Device Name and the Device Type. Enter any name and select SNMP Device from the Device Type drop down.

Tasker Create New Device dialog

Now you can enter the Trap Host information as shown here.

Device tab in Tasker

Now back in our Task Action we will see this Device as an option.

SNMP Trap Action with Device in Tasker

Save the Workspace in the File menu and your Custom Trap will be able to be sent!

Advanced Usage

You can send a dynamic message. A dynamic message is one that has different data based on our message building rules. Here we will send the current temperature.

SNMP Trap Action Example

A defined Signal could also be used here instead of temp[1].f and a Trigger could be used to cause the Trap to get sent as described in the using signals and triggers post.

The Tasker application has been made to handle lots of different types of functionality. This post will go over an example that looks into different actions in Tasker such as a While Loop, If Statement, TCP Send and Set Variable action. It will also create devices in Tasker that would be sent to. The example should monitor output 1’s state, and when it turns on it will send string commands out to devices we declared. 

Actions In Example

The Set Variable Action

Tasker Set Variable Action

The Set Variable Action allows you to create a variable in the first value field of the action, and then assign it a value in the second value field.

The If Statement Action

An If Block Action creates a condition using a variable, that activates other actions when the condition is meet.

The While Loop Action

The While Loop Action makes actions within it reiterate until the conditional in the value field is met. 

The TCP Send Action

The TCP Send Action allows you to select a device created in the device tab, and send it the info you define. The device value created in the device tab uses an IP address and port number of the device. This is used to create the TCP connection you send on.

Device Example

Note: Values in this example will most likely differ from your. Information you enter here depends on what settings your Ethernet device listens on.

In this Example, before we create the Tasks, we need to create the devices that will receive commands we send, like shown above. To start, go to the device tab and click the “Add Device” button. Add as many devices you plan to send to. Each device you’ll enter its IP address, and TCP Port number.

After creating the devices to send macros to, you’ll start creating the task. It starts with the Set Variable action. This action is used to define the variable of the while loop to know when to end the Task. We set this variable to true so the while loop never stops until we set the variable to false. Once this value is defined, a while loop is added to the task. We’ll set this loop to check the conditional of the variable we created. After that, we add an if block and set the conditional of it.  This evaluates output 1 on the JNIOR, and if the output’s state is on, then if begins doing the actions inside the if block. When output 1 does go high, it sends the devices we created the string ‘test’ using TCP Send actions. It also sets the conditional for the while loop to false, so the task no longer loops, and ends.

With this, you should have a task that constantly monitors output 1 on the JNIOR. If output 1 goes high, it sends the string ‘test’ to all the defined devices.

Analog Presets is an application that lets you control and automate expansion modules such as 4-20ma Module, the 10v Module, or the 3 channel LED module. To get started, you’ll want to download the analog presets application from the all downloads page on integpg.com. After updating your JNIOR with the application, you’ll want to go to the URL containing the IP of your JNIOR with /analogpresets after it to access the application on your JNIOR. Here you can add levels containing different commands you want to create for your modules. You can name the command, what you want it to do, how long it should last, and if you want other commands to start once it starts or finishes. You can also use these as macros by defining a port number and termination string on the general tab.

To send a macro to the analog presets application, first we’ll configure the analog presets application. Here is an example using the 3 Channel LED Dimmer. We’ll start by adding a new level at the bottom middle of the first tab in analog presets, and giving it a name. (For this example we named ours MacroTest) Once that is added, we’ll want to go to setting level and add the brightness of each output we want set. For this example, since the 3 Channel LED Dimmer has 3 outputs, we’ll set each of them to 100 by typing in the field 100,100,100. We’ll also want to go the 3 Channel LED Output Channel field and type 1,2,3 to represent the channels we want to set the brightness of. If in the setting level field we set the brightness to 50,75,100, and the 3 Channel LED Output Channel was still 1,2,3, then channel 1’s brightness would 50, 2’s would be 75, and 3’s would be 100. For this example though, we’ll set them all to 100. If you have the 3 Channel LED Dimmer plugged into your JNIOR and the 3 Channel LED Output Channel field is still grayed out, then reboot your JNIOR and it then should be configurable.

We’ll then click on the General tab of the Analog Presets application. Here we can set the TCP port that the macro will send to. (In this example we have 9700) Make sure the Termination string is \r\n.

After that you’ll need the cinema application. You’ll download the Cinema.jar application and using the update tab in the support tool load it onto your JNIOR. Once its on your JNIOR, we’ll want to go to the support tool and create a device in the device tab. We need to do this so that the macro will know what information to send. At the bottom of the Device tab, click add Device. From there, we’ll want to name our device (You can name it anything), set the device type to RAW ETHERNET, set the IP Address to the JNIOR you are using, and the port number to the one you set above in the analog presets application. (Mine for this example is 9700).

Once you have set this up, you’ll want to click “publish to JNIOR” and it will prompt you to save the device configuration as a file. Once this is done, select the JNIOR you are using as the one to publish to. Once its published, you’ll then go to the Macro tab. The first thing we’ll do here is click “link devices”, and select the device file we previously created. After this we will go to the Action view and add a new action. Here you’ll name your action (It can have any name), the device we’ll set the to the one we previously created, the action should be send, and the data should be formatted as follows:

trigger “Name of level from analog presets application”\r\n.

Once this is done, we will then add a Macro in the Macro view. First we name the macro and then we can add the action to this macro, by selecting the Macro we created, the action we created, and then clicking <- button.

Once you have done this, you’ll want to click “publish to JNIOR” like we did previously for the device tab, and create a macro file. Once that is created select the JNIOR you are using as the one to publish to. Now to test this, we’ll want to go to the tools tab of the support tool and click command line.

Once the command line is open, we need to configure the command line to create the right connection, at the bottom of the command line we’ll set the values to our IP and then the TcpPort value in our JNIOR’s Registry. You’d find this by opening the JNIOR’s web page in beacon, and then after going to the registry tab look for the path: AppData/Cinema/CinemaServerClient/TcpPort

Make sure that the value is not -1 like it is above. If it is, change that registry key. (An example value to change it to is 5000). Once you find this value, set it as the port number next to the IP address at the bottom your command line. The IP address should be the one your JNIOR has.

Also, go the options drop down list and check each option.

Now all you should have to do is click the connect button at the bottom right and type:

run “Name of macro from support tool”

This will run the macro you wanted to send to the 3 Channel LED Dimmer!

The iBoot device from dataprobe is a Web Enabled Power Switch. We can command the devices by issuing HTTP Requests. To do this we will add an iBoot device to the Devices file and add “Power On” and “Power Off” actions to the Macro file. We then associate the actions with macros. We might want separate macros for power on, power off and power cycle.

To create the iBoot device in the devices file go to the Devices tab in the JNIOR Support Tool. Then in the lower left click ‘Add’. Then fill out the information as follows. This device can be added to an existing devices file or a new one. We are going to use the HTTP Request device type.

Then click over to the Macro tab and click on Link Devices. This will link the devices file so that the configured devices are available to create macro actions.

Now click ‘Add’ below the Macro Action View. You can rename the action. Click in the Device column for the new Action and scroll to the bottom to select your linked device. Select the iBoot device. Now click on Action and select “GET”. In the data field enter the resource portion of the URL””. It should look like this… Remember to enter the username and password if needed.

You can now add the action to any macro by selecting both the macro you wish to add it to and the new iBoot action.s Then use the <- button between the two views like this…

We can command the Nagra myCinema player to start playing its content. To do this we will add a myCinema device to the Devices file and a “Play” action to the Macro file. We then associate the “Play” Action with a macro. It’s that easy!

To create the myCinema device in the devices file go to the Devices tab in the JNIOR Support Tool. Then in the lower left click ‘Add’. Then fill out the information as follows. This device can be added to an existing devices file or a new one. We are going to use a RAW ETHERNET device so that we can send any command we want. The command is a simple text string.

Then click over to the Macro tab and click on Link Devices. This will link the devices file so that the configured devices are available to create macro actions. Now click ‘Add’ below the Macro Action View. You can rename the action. Click in the Device column for the new Action and scroll to the bottom to select your linked device. Select the myCinema device. Now click on Action and select Send. In the data field enter “play”. It should look like this…

You can now add the action to any macro by selecting both the macro you wish to add it to and the new myCinema action. Then use the <- button between the two views like this…

You can use the Cinema application to execute DMX scripts. Those scripts can be on the same JNIOR or on another JNIOR. Both situations require making a TCP or Raw Ethernet connection to port 10000.

To execute a script once you will send go SCRIPTNAME\r\n

To execute a script a certain number of times you will send the same command but with a repeat parameter. For example, to execute 3 times we would send go SCRIPTNAME -r 3\r\n

To execute a script and have it repeat forever, until you abort it or reboot the JNIOR, you will send the -f parameter. For example, go SCRIPTNAME -f\r\n

Create a DMX device to use in the Macro

Create a Macro to call a DMX script with the Device we just created

Macro tab of the JNIOR Support Tool