Sunrise and Sunset in Tasker April 9, 2020

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.

By | On April 9, 2020 11:32 am | No Comments | Categorized in: