Tasker

Tasker allows control over many different aspects of the JNIOR, including expansion modules. This post will explain how and what you use Tasker to control the Control Panel.

To start, you’ll want to make sure that your Control Panel is properly connected to the JNIOR. You’ll start by plugging the Control Panel into the JNIOR using the sensor port. Once the Control Panel is plugged in, you’ll then access the JNIOR WebUI and go to the Console Tab. There you’ll login into the JNIOR and type extern -r. This will remove any previously connected expansion modules from the JNIOR so only the connected Control Panel will be a recognized external device on the JNIOR.

Once that is done, we’ll now open the Task application. Once on Tasker’s web page, if you don’t already have a workspace created, you’ll want to create one. After you have a workspace, you’ll want to add a Task to the workspace, which Tasker will promptly ask you to name. Once the Task is created, you’ll then want to add an action to the Task, which once you click the add action button the action dialog will appear. Here we find the Control Panel actions.

Here we can add Control Panel actions to the Task, so that when its executed it can control different parts of the Control Panel. Currently in Tasker there are three different Control Panel actions, Set LED, Play Alarm, and Silence Alarm. The first action, Set LED, allows you to change the status of the LED next to a switch on the Control Panel. The options for the LED are off, slow, medium, fast, and on. The next action, Play Alarm, allows you to activate the alarm on the Control Panel. The actions lets you control the sound, duration, and interval of the alarm. The last action, Silence Alarm, simply silences an alarm on the Control Panel if an alarm is active at that time, and doesn’t require any addtional values.

Example Actions

Tasker is an add-on application. This means that Tasker is not loaded on the JNIOR before we ship it. This may change in the future.

To load Tasker you will need to get the JNIOR Support Tool and the Tasker update project.

Once you have installed the JNIOR Support Tool, open it and go to the Update tab. Here we will open the Tasker update project that was downloaded. Do not unzip the update project file. You should see the following…

This image shows the Update project for Tasker version 3.1 from May 5th 2020
This image shows the Update project for Tasker version 3.1 from May 5th 2020

Click Publish and select the JNIOR or JNIORs that you wish the load the Tasker Application on to. The Update project will run until all of the selected JNIORs have been updated.

Once complete, you can go to the Tasker Web Application in your browser. Simply go to http://JNIOR_IP_ADDRESS/tasker.

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.

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

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:

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:

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.

Schedules add functionality to task created in Tasker because it gives them the ability to place a time for when the tasks should occur. This post will explain the different types of schedules that can be created, and how they can configured.

Creating a Schedule

To start, we’ll go to the Schedule tab of the Tasker application in order to create a schedule.

After going to the Schedule tab, the first thing to do is add a schedule in the Schedule tab. After giving it a name, the new schedule will have 3 parts to it, the name, the rules, and the task to be executed from it.

The Name section already has the name you gave it when it was created, but that section also gives you the options to edit the name, have the schedule enabled or not by checking the checkbox, or delete the schedule.

The Task Name section allow you to select a task from a drop down list or manual enter the name of a task that will execute at when the schedule is set.

Adding Rules to a Schedule

The Schedule Rules section is what allows the schedule to determine the times that which the Task selected in the Task Name section will execute. Clicking the “Add Rule” button opens the rules dialog box.

When adding rules to a schedule, there are 4 types of rules you can add, reboot, sunrise, sunset, and schedule. The first three are similar, where you simply click on the Schedule Type and select sunrise, sunset, or reboot from the drop down list. This will make it so that the task you set with that schedule will run at either sunrise, sunset, or on reboot, depending on which one you picked and no other options need to be selected. 

Picking the Schedule option in the Schedule Type, lets you set the custom options for creating a schedule. The first option after the Schedule Type is the Start On option. This lets you select what day the schedule will begin to activate. Once the date reaches the day you selected it will run that schedule from then on. 

After that is the Start Time option. This allows you to select from the hours and minutes in a 24 hour format when the scheduled task will begin. 

Next is the Repeat Every option, which lets you how often in a time interval you want the task to reoccur. It adds a End Time option once a value has been added to the Repeat Every option. It can be set similar to the Start Time option that will decide when the Task will stop repeating by. 

After that is the Date Selection Type option, which lets you choose between letting the task execute None (Which is one time), Daily, Weekly, or Monthly. Depending on what option you choose, this changes the Recur Every option. Picking the None option  will make the task only run on the Start On date you picked. The Daily option will let you choose how many days between the task should run. The Weekly option will let you choose what days of the week the task should run. The Monthly option will let you choose what days of  month the task should run.

With this, you should be able to assign schedules for any task you have created.

Workspaces are files that contain configuration for Tasker. Tasks, Devices, Loggers, Signals, Triggers, and Schedules are all saved in a Workspace file.

Multiple Workspace files can be loaded on the JNIOR at the same time allowing you to load more complex logic. Using multiple Workspaces allows you to logically group the features together that rely on each other.

Tasker will not have any Workapces loaded when it is first loaded. You will be presented with a screen alerting you to that fact and telling you that you must create a new Workspace.

You can click the green button to Create a new Workspace or use the New option in the File menu.

Once a Workspace is created and saved the screen will appear differently the next time you visit Tasker. Here we have created two Workspaces to illustrate this.

You can now click on of the Workspace files or use the Open option in the File menu.

The above post was a brief explanation covering how to create and open Workspaces in Tasker. If you have any additional questions you can check out the Tasker Knowledgebase.

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

Having the JNIOR send a SNMP Trap is great. 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.

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

Here is what it will look like after entering some information

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.

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.

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

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

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.

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.

To build dynamic messages you will use the text replacer syntax. Using {{ }} will allow the message engine to find the appropriate portion of the text and replace it with the value of the evaluated text that is contained within the {{ }} syntax.

Available Conditionals

Internal I/O

din[#].state din[#].counter din[#].usagemeter
rout[#].state rout[#].usagemeter

Temperature Sensor

temp[#].fahrenheit or temp[#].f for short
temp[#].celsius or temp[#].c for short

Environmental Sensor

env[#].fahrenheit or env[#].f for short
env[#].celsius or env[#].c for short
env[#].humidity

Registry

registry("key_name")or reg("key_name") for short. Just replace key_name with the registry key name.

Date

date.currentmillis where the value is the number of milliseconds since January 1st 1970. date.format("format_string") where the format_string is of the following format:

MM two digit month
dd two digit day
yy two digit year
yyyy four digit year
HH two digit 24 hour
hh two digit 12 hour
mm two digit minute
fff milliseconds
aa am / pm
zzz timezone string

for example. date.format("MM-dd-yyyy HH:mm:ss.fff")

Examples

drop

The Tasker Application has a lot of different functionality built into its actions, but it also can handle logic too. One of those actions that you can create in Tasker is the If block action. This post will create two If blocks in Tasker, one being the If block and the other being the If/else block.

Create an If Block

To start, create a new workspace by going to the File Drop-Down and selecting new. After that, go into the Task tab of Tasker and select the “Add Task” button. Once you name your Task, you’ll click on it and select the “Add Action” button. This will bring up the Action Dialog box. Here we need to select the If block action in the Control Structures section of the Action Dialog box. Once we have our If block in the task, we’ll want to add one more action inside of the If block by selecting the “Add Action” button inside of the If block. Here we’ll also select the Pulse Output Relay action.

Setting the If Block Actions

Now that our actions have been added to the Task, we can now configure them to do what we want. For this example, we are going to configure the if statement to activate when Input 1 goes high. To check if the input is high, for the If block value field we’ll enter din[1].state == 1.

With this, the If block will Pulse Output Relay 1 for 1 second if Input 1 is high.

Create an If/Else Block

In the workspace, go into the Task tab of Tasker and select the “Add Task” button. Once you name your Task, you’ll click on it and select the “Add Action” button. This will bring up the Action Dialog box. Here we need to select the If/else block action in the Control Structures section of the Action Dialog box. Once we have our If block in the task, we’ll want to add two more actions inside of the If/else block by selecting the “Add Action” button inside of the If/else block. Here we’ll select the Pulse Output Relay action inside the conditional part of the If/else block , and the Pulse Output Relay action inside for the “else” part of the If/else block.

Setting the If/Else Block Actions

With the actions being added to the Task, we can now configure them to do what we want. For this example, we are going to configure the If block to Pulse Output Relay 1 when Input 1 goes high, and Pulse Output Relay 2 when Input 1 isn’t high. For the If/else block value field, to check if the input is high we’ll enter din[1].state == 1. For the first Pulse Output Relay, we’ll set the channel to 1, and for the other pulse relay we’ll set the channel to 2.

With this, the If/else block should Pulse Output Relay 1 for 1 second when Input 1 is high, and Pulse Output Relay 2 for 1 second when Input 1 is not high.

The Tasker application has been made to handle lots of different types of functionality. This post will go into looking at the Set Variable action and then a logic example using the set variable to send fire alarm macros to different devices. Doing this example requires the environmental or temperature sensor to be completed.

The 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. This is useful when using other control structure actions, such as loops or if blocks.

Fire Alarm Example

Note: Values in this example will most likely differ from your.

In this Example, before we create the Fire Alarm Task, we need to create the devices that will receive the macro we send for the fire alarm, like shown above. You’ll also need to the have the Cinema application updated to your JNIOR. To start, go to the device tab and click the “Add Device” button. Add as many Devices as you have JNIORs you plan to send a Fire Alarm macro to. Each device you’ll enter its IP address, and TCP Port number from the Cinema Server Client Registry Key. The Registry Key is under AppData/Cinema/CinemaServerClient/TcpPort in the registry tab of the JNIOR’s webpage.

After creating the devices to send macros to, you’ll start creating the task. It starts with the Set Variable actions. These actions are used to define the values of two temperatures received from a temperature sensor or environmental sensor, and the variable used to know when to end the Task. We define the two Temp variables to values our temperature or environmental sensors are picking up, and the other variable will be set to true as our conditional until the macros get sent. Once these values are defined, a while loop is added to the task. This will check if the conditional of the variable we created is true, which is how we set it so that it will always be looping. After that, we add an if block and set the conditional of it.  This is to determine if the movie theater’s screen room is a lot more hotter then the rest of the movie theater, indicating a possible fire. When the temperature difference is above 20 degrees (indicating a possible fire), using as many TCP send actions for devices you have, it sends to those JNIORs to run their FireAlarm macros. 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 the temperatures of two temperature/environmental sensors, and when the difference between them is greater then 20, sends out the fire alarm macros and ends the task.

Signals and Triggers are very useful tools in the Tasker application. Signals are I/O values on either the JNIOR or a compatible expansion module with the JNIOR. Triggers are reactions to when a signal occurs. This post will explain all the parts of the Signal and Trigger tabs in detail.

The Signal Tab

To start, the Signal tab is needed in order to use the Triggers tab, so we’ll start with Signals. Signals are I/O values on either the JNIOR or a compatible expansion module with the JNIOR. Each Signal values has what device the Signal is coming from, the channel number of the value, and then the type of value its getting. These can be used either in a Trigger or to set/evaluate the value of a variable defined in a task.

The Trigger Tab

The Trigger is a reaction to a Signal value. Triggers are made up of first, a Trigger value that watches a Signal to react to, along with what the Signal value needs to be to activate the Trigger. Second, is the Reset value that monitors a Signal like the Trigger value does. The Reset value when activated resets the Trigger so it can activate again. A Trigger won’t activate after it has activated once already, unless the reset value activates. Lastly, a task name is selected as the task to run when the Trigger value is met and the Trigger activates.

These steps show show you how to properly create a Signal and Trigger.

Example

The example below will show you how to make a Trigger activate when Relay output 1 on the JNIOR goes High.

We’ll create two Signals with the first ones values being: Device is the Relay Output states of a JNIOR, the channel 1, and the type being the state. The second ones values would be: Device is the Relay Output states of a JNIOR, the channel 2, and the type being the state.

Afterwards you would begin configuring a Trigger. The Trigger values would be the Example Signal we created, and its trigger value will be high. For the Reset values, we’ll select the Example Signal Reset we created as the Reset value, and its reset value will be high as well. Lastly, we’ll pick whichever task we want to run during the Trigger activation as the Task value. In this example my task I created is Example Task.

When working in Tasker, at some point you might need to move a workspace from one PC to another. You also might want to have the workspaces saved on your PC rather than in the JNIOR. The upload and download functionality in Tasker allows you to save workspaces as JSON files, as well as upload them onto the Tasker application as a workspace.

To start, its good to know what a workspace is. It is configuration settings for the Tasker application. While the current configuration is the one you currently view when accessing the Tasker Web Page, other tasker configurations could have been created and sit in the background. Upload and Download are ways to access these different configurations that have been created and saved.

To download a workspace from Tasker, you’ll want to click on the file tab and in the drop-down select the download option.

When selecting the download option, it immediately begins the download of a JSON file. This is the file that can be uploaded as the chosen JSON file for the current workspace.

To upload a workspace from Tasker, you’ll want to click on the file tab and in the drop-down select the upload option.

Clicking the upload option  will prompt you if you wish to continue. This is because uploading a workspace gets rid of the one you are currently making. Make sure that if you want to keep your current workspace configuration, that you save it before you continue with the upload. Uploading will place the JSON file into the workspace folder inside the Tasker directory on the JNIOR.

It has been a while since Tasker was released. Tasker was a quick attempt at making a replacement for the Task Manager application that has been around for more than a decade, starting on the Series 3.

Ample time has now been taken to create a fully capable application that will be every bit as functional as Task Manager but offer the benefits of a rewrite, using configuration files and the latest web technology.

Some of the changes and new features are as follows:

  • Faster– The tasks are executed much faster and the triggers and schedule are monitored in real-time instead of once every 5 – 10 seconds.
  • Workspaces – Separate configuration logic into multiple workspaces. Then multiple workspaces can be loaded on the JNIOR at the same time.
  • Tasks are now separate from triggers. In Task Manager a Task was created and a Trigger was configured to get the Task to execute. In Tasker 3.0 Tasks are a separate entity that can be executed several different way including manual execution from the configuration page and being requested via an ASCII TCP connection.
  • Tasks can now send data via an Ethernet connection. To do this, a Device must be created so that the action can specify which device to send the data to. Multiple devices can be configured.
  • New Actions – We implemented actions that were previously available in Task Manager but are introducing many new actions like external module control, TCP communication and control structures.
  • Drag n Drop – Drag and Drop functionality makes it easier to design your Task logic.
  • Signals are now created to assign a specific property of a I/O point or sensor a name. The name can then be used in Tasks, Triggers or Loggers.
  • Loggers can be created to define the file name and schema or what data should be logged to that file. Each line in a Logger will be prepended with a timestamp followed by a comma. Loggers also allow you to define the number of files that should be kept with the given naming pattern. Name patterns can include date patterns. This will help you create a file per day for example.
  • Schedule – The schedule has additional options.
  • JSON Configuration files are used now instead of registry keys. Registry keys were limiting in size. The Series 3 could only store 255 characters in a registry key. It is much easier to upload configuration files to other JNIORs to replicate setups.
  • User Interface – The User Interface is now a native HTML application that uses the latest web technology. The latest web technology uses native HTML controls and Web-sockets to communicate with the JNIOR from your browser. This will allow accessibility over remote connections as long as port 80 is available. This is now consistent with the communication method used by the DCP. Task Manager had always used Java Applets. The Java Applets have not been able to launch in browsers for several years as they became frowned upon as security vulnerabilities.

This was just a short list of changes and new features. The documentation for Tasker should explain these topics as well as many others. If there is anything you don’t understand please reach out to us for help. Additionally, if you have any suggestions or need the JNIOR to do something specific for you, please let us know.

For more information go to the Tasker Page

The Tasker application has a lot of different functionality built into its actions, but it also can handle logic. One of those logic actions that you can create in Tasker is the loop action. This post will create two loops in Tasker, one being the for loop and the other being the while loop.

Creating a For Loop

To start, create a new workspace, by going to the File Drop-Down and selecting new. After that, go into the Task tab of Tasker and select the “Add Task” button. Once you name your Task, you’ll click on it and select the “Add Action” button. This will bring up the Action Dialog box. Here we need to select the for loop action in the Control Structures section of the Action Dialog box. Once we have our loop in the task, we’ll want to add two more actions inside of the loop by selecting the “Add Action” button inside of the loop. Here we’ll also select the Pulse Relay action and the Sleep action.

Setting the For Loop Action Values

Now that we have our Task’s actions added, we can configure their values to what we want, which is to have our loop use a variable to pulse relays 1 – 3 for 2 seconds, with a 1 second delay between them. To do this, we’ll start by setting the variable in the first field value of the loop action, which in this example we will make $a. The other loop fields are to set how many times the loop will repeat, and since we want to pulse 3 relays we’ll set the second loop field to 1 and the third to 3.

Next for the Pulse Relays action, the first field will be replaced with the variable we created in the first field of the loop action, $a. After that we’ll want the second field set to 1, since we want it to pulse for 1 seconds. Lastly, we’ll set the sleep action to 2 seconds so that no relay is pulsing at the same time as another, and has 1 second delay between each other.

With this, your loop should be configured properly. Now it will loop through output relays 1 – 3 on your JNIOR, pulsing each relay for 1 second with a 1 second delay between each relay pulsing.

Creating a While Loop

For creating a while loop, in your workspace go into the Task tab of Tasker and select the “Add Task” button. Once you name your Task, you’ll click on it and select the “Add Action” button. This will bring up the Action Dialog box. Here we need to select the while loop action in the Control Structures section of the Action Dialog box. Once we have our loop in the task, we’ll want to add two more actions inside of the loop by selecting the “Add Action” button inside of the loop. Here we’ll also select the Pulse Relay action and the Sleep action.

Setting the While Loop Action Values

Now that we have our Task’s actions added, we can configure their values to what we want, which is to have our loop use a variable to check the state of input 1, and if its high (equal to 1) to pulse output 1 for 1 second with a one second delay between it every time it pulses. To do this, we’ll start by setting the variable in the field value of the loop action to din[1].state == 1 to check if input 1’s state is high. Then we’ll set the pulse output of whichever relay we wish to pulse for 1 second, with a second sleep so it will pulse for 1 second, and then wait 1 second.

Tasker is able to perform many different things, one of which is the ability to log information. Tasker contains a Logger tab that can create Logger profiles to record data. These Loggers tell what needs logged and which file it should be stored in when used in a task. This post will show how to record temperature values from an environmental sensor using Tasker.

In order to setup Tasker to record temperatures from a environmental sensor, there are a few step we need to take:

  1. First we need to create Signals in the Signal Tab. These will be used in the Logger tab to record their values.
  2. Next we create a Logger in the Logger tab. Here we use the Signals to document their values in log files.
  3. After creating the Logger, we now go to the Task tab and create a task that includes the Logger that was just created.
  4. Finally, once the task is created, in the Schedule tab we create a Schedule that runs the task for however often we wish to record the environmental sensor values.

Creating Signals

Signals are Input/Output values from the JNIOR or from expansion modules compatible with the JNIOR. In this example we are using a environmental sensor expansion module to record these values. First we’ll create a new workspace using the File Drop-Down. Then in the Signals tab, After clicking the “Add Signal” button, we’ll create a new signal called Temp_1. After the Signal is created, it has three value fields to fill out. The first one is the Signal drop down value, where you will pick where we are getting the Input/Output values from. As stated previously, we are grabbing these values from a environmental sensor, so we’ll select it from the drop down options. Next is the channel for the environmental sensor. Each channel represents a different environmental sensor. Since we are only using one sensor, we’ll select channel 1. Lastly is the variable type, and while the values you can get are either Celsius, Fahrenheit, or humidity, we are going to be logging the info in Fahrenheit, so that’s what we’ll chose.

Creating a Logger

Now that the Signal is created, we can create a Logger to record those values to a file. We’ll go to the Logger tab and select “Add Logger”. After naming the Logger, three values fields need filled in. The first is the Log File Path, which is the where in the folder directory of the JNIOR the files  recording the Signal information will be saved. In our example, we used the file path /flash/tasker/logging/temps-{{date(YYMMDD)}}.csv. The ending of the filepath is to specify the date as the name of the .csv file being saved. After this is the Columns field which create columns of the recorded information in the log file. This example will just have {{Temp_1}} which will specify the Signal we previously created as the information being logged. Lastly, is the file retention count. All this does is decide how many files of information Logger will create before overwriting previous files, so if the number is set to 10, once Logger has created 10 files of information, next file it create will overwrite the previous 1st Logger file. This example uses 30.

Creating a Task

With the Logger being created, we now need a task that uses our Logger so it will activate and record the data we want. In the Task tab, we’ll select the button “Add Task”. Once the Task is named, click on its name and select “Add Action”. The Action Dialog box will appear which has all the actions a task can perform. Here we’ll select the Log Profile action, which we can use to call the Logger we created in the Task. Once the action is added, the only value to enter is the name of the Logger we just created. This will now make the Task activate the Logger each time its run.

Creating a Schedule

Lastly, having a task activate a Logger is good, but it will only record when you activate it. Adding the task to a schedule will allow us to record these values on a time interval. Going to the Schedule tab, you’ll click on the “Add Schedule” button. After naming the Schedule, there will be two options to fill out. The first one appears by selecting the “Add Rule” button, which will bring up the Rule Dialog box where you can configure when the schedule is timed. For this example we will set the Schedule type to schedule so we have more options rules to pick from. The start on date is  the date for whenever you want the schedule to begin activating the task you set with it. Next is the Start Time, Repeat Every, and End Time options (End Time appears after you edit Repeat Every). We set both the Start and End Time to Midnight so that the interval is always running. Repeat Every is set to 2.5 minutes so that with the Start and End time set, the task will run every 2.5 minutes for an entire day. For the Date Selection type, we used daily in this example so we can set the Recur Every option to 1. This will make the task run every day. Lastly, after completing the Rules for the schedule, we add a task that we want the schedule to activate based off the rules we set for it, which will be the task we created in the Tasks tab.

Once the Schedule is completed, the Logger will now record the Signal values of the environmental sensor as values in a .csv file from a task that is scheduled to run every 2.5 minutes, every day.

Sometimes you may want something to occur at a specific time of day or sometimes you may want something to occur with certain events during the day.  The “events” in this case are the Sunrise and Sunset events.  These events occur at different times during the day based on the time of year and your geographic location.  Tasker grabs the location from the JNIOR registry, and uses it to calculate the time of sunrise and sunset for that day.

We had written a custom application called the SunEquation Application to accomplish the following before implementing the logic in Tasker.  You may ask, “What is the SunEquation application and can Tasker handle the same logic?”  The answer is that Tasker is a heavyweight application that uses more processing power than a simple custom application that was designed to do one thing.  The SunEquation application was written for someone that was already running two other applications and the addition of Tasker might slow those other applications down.  Specifically the DMX application is sensitive to performance and that application is one of the two applications that were in use.

Below is an example to send commands to the Cinema Server Client  in Cinema to run macros. This requires having the support tool downloaded along with the applications Tasker and Cinema updated on to your JNIOR.  There are several steps that will need to be configured to get this to work.

  1. Create Macros in the Support Tool that you wish to have run at Sunrise and Sunset.
  2. Create a Task that will perform the action of requesting that the macros get run in Cinema. The action in these Tasks will depend on a Device object that will need to be created as well.
  3. Create Schedules that will execute the Tasks based on Sunrise and Sunset.

Create the Macros

To start, we need to create the macros in the support tool that will be run in Cinema as requested by Tasker. Opening the Support tool, under the macro tab, we can create a macro for sunrise and sunset, and we’ll rename them to that as well, adding whatever actions the macros should perform. This then needs to be published to the JNIOR.

Create a Device

After creating the macros, we need to create a device in Tasker. We first need to create a new workspace using the File Drop-Down before creating a device. After that we’ll go to the device tab in Tasker, and click on the “Add Device” button. This will add a device in Tasker. Now all you need to do is set the IP Address of the JNIOR and the Tcp port number to the same value as the Cinema Server Client port number registry key under AppData/Cinema/CinemaServerClient.

This is an example picture, the values required differ between JNIORs

Create Tasks

The next thing needed to have the macro request sent to the Cinema application is to create TCP send tasks. To create a task you go to the Task tab in Tasker, and select “Add Task”. Once you’ve named the task, you’ll click on the task and select “Add Action”. This will make the action dialog box appear, which contains all the actions you can make your task perform. There you’ll select the TCP Send action. You will then add the device that was just created, and the message should be “run” followed by the name of the macro that was created in the support tool. The macro names also have an \r\n on the end of them to signal where the end of the command is when its being sent. Since we created two macros in the support tool for sunrise and sunset, we’ll create two tasks for them, one for sunrise, and one for sunset. Both of these tasks will be using the same device.

Create a Schedule

To setup macros to run at sunrise and sunset, you’ll now want to go to the schedule tab of the Tasker application. Once you add a schedule, name it, and select the task to run in that schedule, you’ll want to click on “Add Rule”button . As in the example below, since we previously created two tasks for sunrise and sunset, we’ll want two schedules for those tasks, one for sunrise and one for sunset.

Once you’ve clicked “Add Rule”, the Rule Dialog box will open. Here we’ll want to select the Schedule Type option, which will present 4 options. Two of those options will be Sunrise and Sunset.

After selecting the sunrise option for the sunrise task, and the sunset option for the sunset task, those tasks will now run at those times.

Once this is all done, whenever it is sunrise/sunset for the day, Tasker will send commands to Cinema that will execute the macros created in the support tool.

To monitor the environment you will need 3 things. First, either the envrionmental sensor or the Rugged External Temperature Sensor. Second, the Tasker application that will read that sensor and log the values. Third, the Grapher application to graph the data logged from Tasker.

INTEG resells an environmental sensor from Embedded Data Systems. The sensor itself wont work directly with the JNIOR until it is wired. They have several different models that provide different environmental metrics. Temperature and humidity have been the consistent requests. INTEG also sells a rugged external sensor that tracks just temperature.

NOTE: Only the Environmental Sensor records humidity.

Set Up

The first thing to check when setting up is the sensor module you connect to the JNIOR. In the Console Tab of the JNIOR Web Tool, commands you can use to see what sensor is connected are the extern command to tell you what modules you have connected, and the extern -r command to remove a module on your device that is no longer connected. To tell which sensor module you have connected, look at the ID of the device from the extern command. If it ends with 7E its the Humidity Sensor, if its 28 its the Rugged External Temperature sensor.

After that, you’ll want to make sure that you have the applications to graph the data logged.

Name Version Release Date Size MD5
Tasker v3.3 Jul 30 2020 1 MB 5783b3bda071222b48775e5ffb9e4b3d
Grapher v4.1 Jun 18 2020 788 KB 75e992513636e0c45c7aa7f71d8c1303

You’ll want to do an update project one at a time, publishing these to the JNIOR you have the sensor connected to. After that, to get to the Grapher application, you can either type (JNIOR’s IP)/Grapher into the URL or you can select it under the tools tab of Tasker to take you to the application. There you can create the graph to monitor your Temperature. 

Once on the Grapher application page, you’ll want to go to the Grapher Configuration page to enter settings for creating a graph. To start, you can go down to the Graphs section and add a graph.

At the top, you can define the directory path of the file you want monitored, but keep in mind whatever path and file name is set here should match what you set in the Tasker application. The column values represent the different data points that can be pulled from Log that will be created in Tasker. The Date format can be set to MM-DD-YY HH:mm:ss.SSS. The file count is specified to how many files you want added. After setting this, you can configure the chart data described below that will be monitored for the graph.

Here you can create the chart name, and then set the range of the chart and also the time range being charted. Below that you can create the lines that go into the graph that are tracked. You can add their names, what the units they are measured in are called, and the color of the line. Once this is all set you’ll now want to open the Tasker application by typing in the URL (JNIOR’s IP)/tasker, or by clicking the link for it from the JNIOR Web Page in the applications section of the configure tab.

In the Tasker application, the first thing we’ll want to do is create a Logger using the Logger Tab. Once on the Logger Tab of Tasker, clicking the “add Logger” button will create an empty Logger in the Logger Tab, which you can name. This is where the file will be create that Grapher pulls the data from to graph.

Like in the picture above, you’ll want to set the log file path. The one in the example is called temps-{{date(YYMMDD)}}.csv, just like the one named in the file section in Grapher of this example. (The date.format part of the file name auto inputs the date when creating the file). The columns are defined as separate values that will act as the lines we created in the graph section of Grapher.

For how the column values work, the double squiggly brackets and comma between each value are needed to separate each value. The env_ is what you have to preface each value with in the text if you are using the environmental sensor. Otherwise you’ll use temp to preface each value for the rugged external temperature sensor. The “.fahrenheit” has to be replaced with “.celsius”, “.humidity”, or each words first letter like “.f”, “.c”, or “.h” depending on what type of value you are trying to monitor. The number surrounded by brackets represents which module is getting that value so if you only have on module you’d label every bracket with a 1. An example of the column values from Grapher would be {temp[1].fahrenheit}}, {{temp[1].celsius}}. (These values would get the temperature in Celsius and Fahrenheit from a Rugged External temperature sensor you have plugged in.)

After defining the values for the Logger in Tasker, we’ll now want to create a Task in the Task Tab of Tasker. Once in the Task Tab, we’ll select the “add Task” button. This will add an empty Task to Tasker that you can name. Once we do that, we’ll want to selcet the “add Action” button to add an action to the Task to run the Logger we just created. In the action submenu we’ll want to select the Force Log Profile action. Once its added, we’ll enter the Logger name we created earlier to the action so it’ll run that Logger every time the Task runs.

Once that is done, we’ll now add a schedule that runs every two minutes so the graph is constantly getting more data every two minutes.

Going to the schedule Tab, we’ll click the “add Schedule” button to add an empty schedule to Tasker. We’ll then select the “add Rule” button to open the rule submenu. Here we’ll set the Schedule to run every two minutes, every day, from Midnight to Midnight like shown in the picture below. We’ll also set the schedule to run the Task that activates Logger to every two minutes.

Once this is all set up, going back to the Grapher application should now give you a graph of the logged temperatures!