Automations

Introduction

An automation performs one or more actions based on a condition.  

The types of conditions that may be defined are: Schedule, Sunrise/Sunset, Device State, and Scene.   The Schedule condition allows you to trigger an action based on the current date/time reaching a particular set of date/time values (all relative to a specified time zone).   A Sunrise/Sunset condition triggers an action when the time before/after sunrise/sunset occurs according to a set of week days, at a specific geographic location.   The Device State triggers an action based on the value of a Datastream.   The Scene option allows you to manually trigger an automation action from the Blynk.App mobile app or the Blynk.Console web app.  

One or more actions may be executed sequentially when a condition's requirement has been met.   The types of actions include a mobile app notification, an email, a delay, and setting a Datastream value.  

Note that the value of a Datastream may be used by a condition, and an action can be configured to set a Datastream to a new value.   Using widgets on the Blynk.Console and/or Blynk.App, you can visualize and change the values of Datastreams.   You may also access Datastreams within the firmware of an IoT device, and by using the Blynk.Cloud HTTPS API.  

 

Creating an Automation

Automations are created per organization and are only available for users with permission for it.   By default, the first user in the Organization becomes a Developer and has sufficient permissions to create an Automation.   Enable automation permissions for other users by visiting the Blynk.Console, click on the 'Settings' option on the sidebar, access the 'Roles and permissions' menu option, expand the 'Organizations' section and find the 'Automations' permissions.   Set the user's create/edit/view/delete/execute/manage permissions as appropriate for the user.  

Blynk Automation user permissions

You may create an Automation in both the Blynk.Console and the Blynk.App.   Creating an Automation in one app will cause it to be accessible in the other app (you may need to refresh the app).   Make sure the Developer Mode is turned on within the Blynk.Console or Mobile.App you are working within.

The 'Automations' icon in both the Blynk.App and the Blynk.Console will not be visible until at least one Datastream listed in the Template has a condition or action option turned on.   From the Blynk.Console, click on the sidebar icon for 'Templates'.   Choose a template from the list that appears.   At the top, choose the 'Automations' tab.   A list of Datastreams for the Template will appear, with columns labeled 'Condition' and 'Action' that each have an enable/disable switch for each Datastream.   At the top right of the screen, click the 'Edit' button.  

Blynk Automation user permissions

Enable at least one 'Condition' or 'Action' for a Datastream and then click the 'Save And Apply' button at the top right of the screen.   Refresh the browser window (CTRL-F5), and the 'Automations' icon will be visible in the Blynk.Console sidebar.   Restart the Blynk.App, and the 'Automations' icon will be visible at the bottom of the screen in between the 'Devices' and 'Notifications' icons.  

 

Create Automation With Blynk.Console

From the Blynk.Console, click on the 'Automations' icon.  

Choose a condition from the options of:

  • Schedule allows you to trigger an action based on the current date/time reaching a particular set of date/time values (all relative to a specified time zone).  
  • Sunrise/Sunset triggers an action when the time before/after sunrise/sunset occurs according to a set of week days, at a specific geographic location.  
  • Device State triggers an action based on the value of a Datastream.  
  • Scene is a manual trigger of an Automation directly from the 'Automations' page in the Blynk.Cloud or Blynk.App.  

After you have the 'When' condition defined, the next step is to configure one or more 'To this' actions.   The choices are:

  • Control Device - select a specific Device to control by setting a Datastream value.  
  • Send E-Mail will send an email to one or more Users with optional details about the Organization, Template name, Device name, and/or Datastream value included (availability of each depends on the Datastream data type and type of automation).  
  • Send In-App Notifications to the one or more Users's Blynk.App with optional details about the Organization, Template name, Device name, and/or Datastream value included (availability of each depends on the Datastream data type and type of automation).  
  • Wait, Then Do Something - delay until a specific time of the day is reached (in a specified timezone), or until a timer between 1 sec and 24 hours elapses.  
  • Send SMS will send a text message to one or more Users's Blynk.App with optional details about the Organization, Template name, Device name, and/or Datastream value included (availability of each depends on the Datastream data type and type of automation).   This option is available only to BUSINESS subscribers.  

The 'NAME' and 'COVER' should also be configured for the new automation.   If the Automation has a Device State condition defined, then an option of 'LIMIT PERIOD' is available and should be configured.   The limit period prevents multiple executions of an Automation within the limit period duration, beginning from when the last trigger occurred.  

After the Automation is configured, it will appear in the 'Automations' list as a labeled rectangle shape with the Automation name, the count of actions defined, and the last date/time that the Automation was executed.   If the condition of type 'Scene' was chosen, a 'Execute automation' button will also be available within the rectangle, otherwise a 'Disable automation' button will be available.  

 

Create Automation With Blynk.App

From the Blynk.App home screen, click on the 'Automations' icon at the bottom of the screen.  

Automations are configured in detail using the Blynk.App mobile app.   An Automation requires a Datastream of data type double, integer, or enumerable that has already been configured.   In order for the 'Automations' option to be available in the Blynk.App mobile app, the 'Condition' option must be enabled for the device template under 'Automations' in the Blynk.360 web console.   Go to your Blynk.360 web console, edit an existing device template and click on the 'Automations' tab at the top of the page.   The existing Datastreams configured in the device template will be listed in a table, along with basic information about each Datastream.   Click on the 'Condition' switch to turn it on (switch in right position).   Switching one or more Datastream 'Condition' switches on will make the Automations option available in the Blynk.App mobile app.  

In the Blynk.App mobile app with 'Developer Mode' turned on, the 'Automations' option should be visible at the bottom of the screen while the Blynk.App is running the app (displaying widgets and data).   If the 'Automations' option is not visible, close the Blynk.App and re-load it.   Click on the 'Automations' option at the bottom of the Blynk.App screen.   If no automations have been configured, then the screen will say "No automations yet" and have a '+ Add Automation' button available.   Click on the '+ Add Automation' button and the 'New Automation' dialog will appear with the options of 'Schedule', 'Sunset/Sunrise', 'Device state', and 'Scene'.  

Choose the option of 'Device state'.   A list of devices will appear.   Select a device, and the Datastreams that have the 'Condition' turned on will appear in a list.   Select a Datastream, and the following options will appear: 'is any', 'has changed', 'is equal to ...', 'is not equal to ...', 'is greater than ...', 'is greater than or equal to ...', 'is lower than ...', 'is lower than or equal to ...', 'is between ... and ...', and 'is not between ... and ...'.   Note: You may need to scroll screen up to see all of the options.   Choose the option 'has changed', and then click the 'Done' option at the top right of the screen.  

A new page will appear that shows the 'When' option of '[virtual pin name] has changed'.   In the section labeled 'Do this:', click the 'Add action' button to add an action.   A dialog will appear with the 'Choose condition' options of: 'Send an email', 'Send in-app notification', and 'Wait, then do something'.   Choose the 'Wait, then do something' option and the 'Add Wait' options of 'Timer' and 'Wait until ...'. will appear.   Choose the option of 'Timer', and then configure 'Set the time' to 10 seconds'.   Click the 'Done' at the top right of the dialog when finished.   In the 'Add Wait' dialog, click the 'Done' option at the top right of the screen.  

The 'Automation' dialog will appear again, but this time the action 'Wait for 10sec' will appear under 'Do this:'.   Add another action to be performed next by clicking on the '+' button under 'Do this:'.   Choose the option 'Send in-app notification', and then configure the 'TO', 'TITLE', and 'MESSAGE' options.   Set the MESSAGE to say something like "The value for the IoT device '{DEVICE_NAME}' has changed 10 sec ago to a new value of {TRIGGER_VALUE}.   ({DEVICE_NAME} and {TRIGGER_VALUE} are placeholders).   Click the 'Done' at the top right of the dialog when finished.  

The two actions listed under 'Do this:' should be visible as shown in the screen image below. &nbps;

Configure the 'Automation' dialog options for 'NAME AND COVER'.  

Configure the 'Automation' dialog 'LIMIT PERIOD' option to '5 minutes'.  

Click the 'Done' at the top right of the 'Automation' dialog to save the automation settings and exit.  

To diable the Automation, click on the switch shown in the Blynk.App.  

 

TBD

Placeholders

{ORG_NAME} - name of the organization the device is assigned to.

{PRODUCT_NAME - name of the Template used.

{DEVICE_NAME} - device name

{TRIGGER_VALUE} - if a Device State trigger was used, this will be the value of the trigger.

 

 


Do you need help developing or customizing a IoT product for your needs?   Send me an email requesting a free one hour phone / web share consultation.  

 

The information presented on this website is for the author's use only.   Use of this information by anyone other than the author is offered as guidelines and non-professional advice only.   No liability is assumed by the author or this web site.  

Projects

January 2023

Gateway + Nodes


January 2023

Pre-Designed Solutions