Keypad Data Manipulation

Keypad Data Manipulation

The keypad will send the data by pressing a custom button or just by inputting a combination and waiting 3 seconds.

Whenever a pin code is submitted, the structure sent to the variable will be:

DIGITS,ACTION

So, for instance, if your user has clicked the sequence 1234 and then a custom button DISARM, the output would be:

1234,disarm

If the user pressed a sequence and no action button, then the format will exclude the button, like so:

1234

Likewise, if the user only pressed a button and no sequence, this will be the format:

disarm

The best way for you to extract and use this data is through an analysis. The keypad widget offers an option to run an analysis in the User Control tab.

Analysis

If you select an analysis, this is the scope that you will receive when a user sends a sequence:

[
  {
    "bucket": "5da07e1269c7ae001b2faefe"
    "origin": "5da07e1269c7ae001b2faeff",
    "id": "5da07e1269c7ae001b2faefs",
    "variable": "my_variable",
    "created_at": "2019-10-16T00:00:00Z",
    "time": "2019-10-16T00:00:00Z",
    "value": "1234,disarm"
  }
]

Analyses are the best way to manipulate the data you receive from your keypad.

Since you can receive either a digit sequence, an action string, or both, the easiest way to extract the data inside of the analysis is by using the split string method.

Python
scope[0].value.split(',');
>> ['1234', 'disarm']

Node.js
scope[0].value.split(',');
>> ['1234', 'disarm']

Do not store data

If you select this option, the data sent by the widget will never reach the bucket. Keep in mind that the data sent will still be accessible inside of the analysis' scope.

Capture User Information

This option only works if you are using this widget inside of the Run platform.

If you select this option, the data sent by the widget will have any additional object called run_user. This will be the structure of the item:

{
  "bucket": "5da07e1269c7ae001b2faefe"
  "origin": "5da07e1269c7ae001b2faeff",
  "id": "5da07e1269c7ae001b2faefs",
  "variable": "run_user",
  "created_at": "2019-10-16T00:00:00Z",
  "time": "2019-10-16T00:00:00Z",
  "value": "5da07e1269c7ae001b2faeff"
}

The value in this case will be the ID of the run user.


    • Related Articles

    • Keypad Widget

      Keypad allows the user to submit a pin code along with an optional action string. This widget is ideal to represent an alarm or to request a PIN code to unlock a resource. Creating your own To add it to your dashboard, choose the Keypad widget from ...
    • Keypad Visualization

      The numeric keypad contains 10 digits that range from 0-9, it also contains an asterisk (*) and a number sign (#). You have the option to customize the content of the keypad by creating buttons that will appear along with the digits. In the ...
    • Creating Keypad Widgets

      This article will demonstrate how to create a Keypad Widget using the TagoIO Node.js SDK. In order for you to create keypad widgets, this is the structure that you will need to send to the account.dashboards.widgets.create method. {   "analysis_run": ...
    • Deleting Data

      DEL - https://api.tago.io/data Headers: Authorization: Your device token. Optional Query Strings KEY TYPE DESCRIPTION query string pre-defined by Tago qty string Maximum number of data to be returned start_date string Start date end_date string end ...
    • Getting Data

      HEADERS: Authorization: Your-Device-Token GET - https://api.tago.io/data QUERYSTRINGS: KEY TYPE DESCRIPTION variable string || array Get variables query string pre-defined by Tago qty string Maximum number of data to be returned.  start_date string ...

    Aug 30 - Join us at TagoIO Connect, our annual conference. Learn new features and use cases. Register Here


      Future and past Webinars