LogoLogo
GitHubBlynk WebsiteLogin to Blynk.Console
  • Introduction
  • Getting Started
    • Supported Hardware
    • Quickstart
      • Next Steps After Quickstart
      • Quickstart Device: Code Overview
      • Troubleshooting
    • Device Activation Methods
      • Manual Device Activation
      • WiFi provisioning
      • Static Token
    • Template Quick Setup
      • Set Up Datastreams
      • Set Up Web Dashboard
      • Set Up Mobile App Dashboard
      • Prepare Your Code
      • Test your Template
    • Send Data From Hardware To Blynk
    • Control Devices (GPIOs and beyond)
    • Events
    • Notifications (Alerts)
    • Sign Up / Sign In
  • Changelog
  • General Concepts
    • Developer Mode
    • Device
    • Device Template
    • Connection Lifecycle
      • Disconnections And Heartbeat
    • Users
      • Multi-tenancy
    • Organizations
    • Automations
      • Forward Device Data
  • Message Usage
  • Integration Guides
    • Node-RED
    • The Things Stack
      • Getting Started
      • Device Grouping
      • Automated Device Onboarding
      • System DataStreams
    • Blues
    • NCD Industrial Vibration Sensor
    • Particle - monitor with Blynk
    • Particle - control with Blynk
    • AWS IoT Core
  • Myriota
  • OpenWeather
  • Blynk.Console
    • Overview
    • Dashboards
      • Dashboard Widgets
    • Devices
      • Device profile
        • Dashboard
        • Device Info & Metadata
        • Notifications & Events
        • Developer tools
          • General
          • Datastreams
          • Testing
          • Actions Log
      • Actions with devices
      • Segments
      • Filters
      • Notifications Settings
      • Device Sharing
    • Locations
      • Location Profile
      • Assigning Devices to the Locations
    • Organizations
      • Create a Sub-Organization
      • Working with Sub-Organizations
    • Users
      • User Profile
    • Device Templates
      • Working With Templates
      • Info
        • Offline Ignore Period
        • Manufacturer
        • Template ID
        • Categories
        • Hotspot Prefix
      • Datastreams
        • Datastream Settings
          • Name
          • Alias
          • Virtual Pin
          • Color
          • Data Type
          • Min Value
          • Max Value
          • Default Value
          • Save RAW Data
          • Invalidate Value
          • Wait for confirmation from device
          • Sync with latest server value every time device connects to the cloud
          • Expose to Voice Assistants
        • Virtual Pin
        • Location
        • Enumerable
      • Web Dashboard
        • Multiple Dashboard Tabs
      • Metadata
        • Metadata Tutorial
      • Connection Lifecycle
      • Events
        • Custom Events
          • Event Settings
          • How to Send/Log Events
          • Content Events
        • Notifications Settings
          • Custom Sounds and Critical Notifications
      • User Guides
      • Assets
    • Widgets (Console)
      • Switch
      • Slider
      • Number Input
      • Image Button
      • Web Page Image Button
      • LED
      • Label
      • Gauge
      • Chart
      • Map
      • Image Gallery
      • Custom Chart
      • Heatmap Chart
      • Video
      • Bitmask Table
      • Gradient Ramp
      • Terminal
      • Segmented Switch
      • Alarm & Sound Widget
      • Modules
    • Blynk.Air
      • Shipment Details
      • Shipment Management
        • New Shipping
      • Device shipment statuses
      • User-Controlled Shipments
    • Settings
      • Organization Settings
        • General
        • Users
        • Locations (Job Site or Facilities)
        • Tags
      • Roles and Permissions
      • Developers
        • OAuth2
        • Webhooks
        • Create New Webhook
      • Integrations
    • User Profile Menu
    • Limits
  • Blynk.Apps
    • Overview
    • Mobile Dashboard Editor
    • Device Header Constructor
      • Header Design
      • Header Mini Widgets
        • Connection Status Widget
        • Last Reported Widget
        • Tabs Widget
        • Datastream Value Widget
        • Image Widget
        • Battery Level Widget
        • Signal Level Widget
        • Tags Widget
      • Header Buttons
    • Pages
    • Widgets (app)
      • Common Widget Settings
      • List of Datastreams types supported by Widgets
    • Widgets Controllers
      • Button
      • Styled Button
      • Icon Button
      • Image Button
      • Slider
      • Vertical Slider
      • Step Slider
      • Vertical Step Slider
      • Joystick
      • zeRGBa
      • RGB Light Control
      • Step H
      • Step V
      • Slope Control
      • Switch
      • Level Slider
      • Level Slider with Switch
    • Widgets Displays
      • Value Display
      • Labeled Value
      • LED
      • Gauge
      • Radial Gauge
      • Enhanced Gauge
      • LCD
      • Simple Chart
      • SuperChart
      • Terminal
      • Video Stream
      • Level H
      • Level V
      • Image Gallery
      • Gradient Ramp
      • Icon
      • Image Animation
      • Lottie Animation
    • Widgets Interface
      • Tabs
      • Menu
      • Map
      • Text Input
      • Numeric Input
      • Time input
      • Segmented Switch
      • Icon Segmented Switch
      • Text
      • Formatted Text
      • Dynamic Spacer
    • Widgets Other
      • Music Player
      • WebPage Button
      • WebPage Image Button
      • Alias Name
    • Main Menu
      • My Profile
      • Organization
      • Settings
      • Help
      • About
      • Log Out
    • Devices
      • Add New Device
    • Automations
    • Notifications & Events
  • Blynk.Edgent
    • Blynk.Edgent overview
    • Blynk.Inject and Blynk.Air
    • OTA: Firmware Over-The-Air updates
  • Blynk.NCP
    • Blynk.NCP overview
    • Supported Connectivity Modules
    • OTA: Firmware Over-The-Air updates
  • Blynk Library - firmware API
    • Installation
      • Install Blynk Library in Arduino IDE
      • Install Blynk Library for Platformio.org
      • Install ESP8266 core for Arduino IDE
    • Configuration
    • Connection Management
    • Device Online/Offline Status
    • Digital/Analog Pins
    • Virtual Pins
    • Widget Properties
    • State Syncing
    • Timers
    • Time (RTC clock)
    • Timezone / Location
    • Log Event
    • Metadata
    • Debug
    • Reboot
    • Over-The-Air Firmware Updates (OTA)
    • Other
    • Limitations and Recommendations
    • Blynk Protocol
  • BLYNK.CLOUD MQTT API
    • Device MQTT API
      • Authentication
      • Topic Structure
      • Datastreams
      • Widget Properties
      • Events
      • Metadata
      • Timezone/Location
      • OTA
      • Miscelaneous
      • Code Examples
  • BLYNK.CLOUD HTTPS API
    • Device HTTPS API
      • Get Datastream Value
      • Get Multiple Datastream Values
      • Get Historical Data From Device
      • Update Datastream Value
      • Update Multiple Datastreams Simultaneously
      • Upload a Set of Timestamped Data
      • Update Widget/Datastream Property
      • Send/Log An Event
      • Get Device Metadata Value
      • Update Device Metadata Value
      • Is Device Connected
      • Upload a File
      • HTTPS API Troubleshooting
    • Platform API
      • Authentication
      • Ogranization API
        • Get Own Organization Info
        • Get Organization Info
        • Search Organizations
        • Create Organization
        • Get Static Tokens
        • Get Organization Tags
        • Get Organization Automations
      • Devices API
        • Get All Devices
        • Search Devices
        • Get Devices by Owner Email
        • Get Devices in user organization
        • Get Recently Activated Devices
        • Get Device Info
        • Get Connection Status
        • Create Device
        • Edit Device
        • Get Datastream Values
        • Update Datastream Value
        • Update Multiple Datastreams Values
        • Import Datastream Values
        • Update Datastream Property
        • Get Datastream Historical Data
        • Get Device Metadata
        • Update Device Metadata
        • Get Device Tags
        • Get Device Timeline Log
        • Log a Device Event
        • Get Actions Log
        • Erase All Data
        • Remove Device Owner
        • Transfer Device
        • Delete Device
      • Users API
        • Get All Users
        • Search Users
        • Create New User
        • Invite User
        • Get User Info
        • Update User Role
      • Templates API
        • Get All Templates
        • Get Template Info
        • Get Template Metadata
        • Get Template Datastreams
        • Get Template Events
    • Security
  • Downloads
    • Blynk Mobile Apps
    • Blynk Library
  • Troubleshooting
    • General Issues
    • Developer Mode
    • Changes from Blynk 0.1
      • Migrating to the new Blynk - Full Guide
    • Glossary
    • Links
  • Commercial Use
    • Deploying Products With Dynamic AuthTokens
    • Deploying Products With Static Tokens
    • Working With Clients
    • Supported topologies
    • Business Plan (White Label Solution)
      • App Publishing Process And Timeline
      • What's Needed To Publish Your Apps And Go Live
      • Branding Materials
      • Custom Email Address For Transactional Emails
      • Application Settings
        • General
        • Design
        • Mobile Apps
        • Sign Up
  • Add-Ons
    • Add-on list
    • Amazon Alexa
    • Google Assistant
    • Localization
    • Database Access
    • Marketing
Powered by GitBook
On this page
  • Introduction
  • Types of conditions
  • Types of actions
  • Interoperability
  • How to Set Up Automations in Blynk
  • 1. Prepare the Template and Datastreams
  • 2. Create an Automation
  • Conditions
  • Actions
  • Placeholders
  • Automation Settings (Limit Period, Name, Cover)
  • Configuring a Device State Condition
  • 3. Automation Management
  • Automations Logs

Was this helpful?

  1. General Concepts

Automations

PreviousOrganizationsNextForward Device Data

Last updated 7 months ago

Was this helpful?

Introduction

Automations allow the end-user of your app to create scenarios where the device automatically performs one or more actions based on a condition.

A manufacturer (or developer) defines which parameters of the device can be automated by end customers.

Types of conditions

The types of conditions are:

  • Schedule: triggers an event 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 event when the time before/after sunrise/sunset occurs relative to a set of defined weekdays, at a specific geographic location.

  • Device State: triggers an action based on the value of a .

  • Scene: manually triggers an automation scenario from the mobile app or the web app.

Types of actions

One or more actions may be executed sequentially or simultaneously when a condition's requirement has been met. The types of actions include:

  • Sending a mobile app notification

  • Forwarding device data to some other device datastream

  • Sending an email

  • Setting a delay

  • Setting a value.

Interoperability

Automations are designed to work across all properly configured devices. This means that one condition can be used to perform actions on multiple devices.

Note that the value of a Datastream may be used by a condition, and 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.

How to Set Up Automations in Blynk

1. Prepare the Template and Datastreams

Check permissions

Check Developer Mode

Even if none of your existing Datastreams will be involved in any Automation, you can simply enable the Condition or Action switch for any Datastream (no harm will be done), or create a Datastream if none exist. Otherwise, build your first Automation based on the Datastream that will be used as either the ‘Condition’ or ‘Action’ for the Automation.

Set up Automations in Template

Go to Blynk.Console ->Templates -> Template you are working with -> Automations tab.

A list of Datastreams for the Template will appear, with columns labeled 'Condition' and 'Action' that each has an enable/disable switch for each Datastream. At the top right of the screen, click the 'Edit' button.

Template Automation Options

Automation Type

Data Type

Description

Blynk.App Automation GUI Control

Power Switch

Integer

Typically 0 = on, 1 = off Max 1 Power Switch per product

Switch

Switch

Integer

Typically 0 = on, 1 = off

Switch

Range Control

Integer

The min/max is defined by the Datastream. The slider step value is defined in the ‘Type of Automation’ column.

Slider

Color

String

Color value and Alpha (transparency)

Color Slider

Enumerable

Enumerable

An integer value corresponds to a string value

a list of the enumeration values

Sensor

Double

Integer

String

Enumerable

Cannot be an action

N/A

If the value of the Datastream will be used to trigger an action, then enable the ‘Condition’ switch in the table. If the value of the Datastream is to be changed by the Automation, then enable the ‘Action’ switch in the table.

  1. 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.

2. Create an Automation

Conditions

Choose a condition from one of the options below:

  • 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 weekdays, at a specific geographic location.

  • Scene is a manual trigger of an Automation directly from the 'Automations' page in the Blynk.Console or Blynk.App.

Actions

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

  • Control Device - select a specific Device to control by setting a Datastream value.

  • Send Email 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 one or more Users' 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.

Placeholders

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

  • {PRODUCT_NAME} - name of the Template used.

  • {DEVICE_NAME} - the IoT Device name as displayed under ‘DEVICES’.

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

The 'Name' and 'Cover' should also be configured for the new automation.

Automation Settings (Limit Period, Name, Cover)

The 'Name' and 'Cover' should also be configured for the new automation in the 'Settings' section.

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.

Limit Period Example

For the Automation scenario of: “When the temperature is higher than 40, send Email Notification" with a limit period of 1 hour”, if the temperature rises and exceeds 40 at 9:30 am, then no additional notifications will be sent until 1 hour later at 10:30 am. At 10:30 am, the limit period resets, permitting another notification to be sent at 11:30 am if the temperature continues to exceed 40.

Configuring a Device State Condition

The condition (When) option of ‘Device State’ triggers an action based on the value of a datastream.

After selecting the ‘Device State’ option, you need to specify the device, then the datastream, and finally what type of datastream value change to monitor from the dropdown lists.

The options ‘Is On’ and ‘Is Off’ require that the datastream is set back to the default state after the automation is triggered in order for the automation to execute again. To avoid having to reset the device state use the 'Is Any' or 'Has Changed' option as in the example below.

The ‘Is Any’ option detects an update to the value for the datastream (it can be the same as prior, or changed). The ‘Has changed’ option checks that the new datastream value has changed from the prior value.

‘Is Any’ Device State Condition Example

A integer type datastream V20 is configured as shown below.

An automation is created as shown below with the ‘LIMIT PERIOD’ set to ‘No Limit’.

The automation Device State condition is set to ‘Is Any’ for datastream V20 ('Has Changed' could be used as well, with the exact same behavior). A two second timer is executed, and then the V20 datastream is set to off (value of zero).

Configuring a switch in the Blynk.Console web dashboard for datastream V20 will allow you to set V20 to on (value of 1), and after two seconds you will see the value changed back to a value of off (zero) by the automation. Click the switch on again and the automation will turn off the switch after two seconds.

‘Is On’ Device State Condition Example

When you click the web dashboard switch for V20 ‘on’, you will observe the switch turn off after two seconds by the automation. However, if you try it again, the switch will not be turned off (datastream set to a value of zero) by the automation. The automation will not execute again until the datastream is set back to the default state (a value of zero) by either manually clicking the web dashboard switch on/off, or by the IoT hardware.

The described behavior is similar if a datastream with a default value of 1 is used with the ‘Is Off’ automation device state condition, but now the values 0 and 1 (off /on) are reversed.

Consider carefully this automation behavior for ‘Is On’ and ‘Is Off’ when creating an automation.

3. Automation Management

After the Automation is configured, it will appear in the 'Automations' list as a card, with the count of actions defined, and the last date/time that the Automation was executed. A switch on the card allows the Automation to be enabled/disabled.

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.

The images that follow, show how the Automation card appears in both the Blynk.Console and the Blynk.App. Recall that creating an Automation in one app (Blynk.Console or Blynk.App) will cause it to be accessible in the other app.

Within the Blynk.App, you can see Automations the device is participating in. From the Device page, select the ‘...’ icon in the upper right of the screen. Choose the ‘Information’ tab, and the Automations the device is participating in will be listed under the ‘AUTOMATIONS’ section.

If you click on the ‘AUTOMATIONS’ section, you may enable/disable the participation of the Device in Automations.

Automations Logs

Automations are created per and are only available for users with permission for it. By default, the first user in the Organization becomes a and has sufficient permissions to create an Automation.

Enable automation permissions for other roles by visiting , click on the 'Settings' option on the main menu, access the 'Roles and permissions' menu option, expand the 'Organizations' section and find the 'Automations' permissions. Set the role's create/edit/view/delete/execute/manage permissions as appropriate for the role.

The must be turned on in order to edit the Automations options for a . The Developer Mode can be turned on from or the .

The ‘Automations’ icon in both the Blynk.App and the Blynk.Console will not be visible until at least one listed in the Template under the ‘Automations’ tab has a condition or action option turned on.

In the table column labeled Type of Automation, make a choice for the Datastream to be associated with your Automation. The choices vary by the data type (double, integer, string, enumerable). All options except for ‘Sensor’ define what type of GUI control will be presented to the User when defining the Automation in the Blynk.App.

Refresh the browser window (CTRL-F5), and the Automations icon should be now visible in the side menu.

Restart the , and the Automations icon will be visible at the bottom of the screen in between the Devices and Notifications icons.

You may create an Automation scenario in either the , or the . Creating an Automation in one app will cause it to be accessible in the other app (you may need to refresh the other app).

From the , click on the Automations icon on the main menu. From the , click on the ‘Automations’ icon at the bottom of the home screen.

Device State triggers an action based on the value of a Datastream. See for more details.

- update a datastream value for any device with the datastream value from the device assigned to this automation. This option works with datastreams of data type integer, double, and string and is currently available only in Blynk.Console.

The ‘Send Email’, ‘Send In-App Notifications’, and ‘Send SMS’ actions support the use of placeholders. Placeholders are key/value pairs that refer to Blynk account metadata and values.

If the Device State condition is set to ‘Is On’, then the automation will only execute once, unless the value of the datastream is changed manually with the dashboard switch, or by the hardware. See the next example .

Configure a datastream, automation, and web dashboard as specified in the prior example . Modify the device state condition, changing it from ‘Is Any’ to ‘Is On’.

In the , you may also view the Automation Logs while editing an Automation. This option is not available in the .

Selecting the ‘Automation Logs’ icon will display a page with a history of the executions of the Automation. The summary includes the date/time when it was executed, from what , the Datastream employed, and the value of the .

Datastream
Blynk.App
Blynk.Console
Datastream
Organization
Developer
Blynk.Console
Developer Mode
Template
Blynk.Console
Blynk.App
Datastream
Datastream
Blynk.Console
Blynk.App
Blynk.Console
Blynk.App
Blynk.Console
Blynk.App
Configuring a Device State Condition
Forward Device Data
Datastream
‘Is On’ Device State Condition Example
‘Is Any’ Device State Condition Example
Blynk.Console
Blynk.App
Device
Datastream