4.5. Configuring Edge Connect for Connection Based Devices

This document covers the connection functionality of Edge Connect. Connections to devices are required when a device does not advertise all available data or when a device requires configuration or other custom actions. There are many reasons for this but the main goal of Edge Connect is to provide some minimal support for connection oriented data transfer.

4.5.1. Concepts

Edge Connect provides a set of Actions that are performed on a device to which it connects. The Actions performed when connected to a device are setup similar to a Pipeline. Edge Connect has the ability to connect, read, write, and collect multiple notifications within a connection session.

Actions

Edge Connect actions are single operations that are performed on a device upon a successful connection. Actions are operations such as read a characteristic or write data to a characteristic.

Connection Sequence

A connection sequence is a set of actions which are performed after a successful device connection. After the connection sequence, the output data from the sequence is accessible for later use.

4.5.2. Configuring a connection pipeline

To configure Edge Connect to connect to a device, the connect filter is inserted into a normal Pipeline. The connect filter initiates connections on a configurable interval.

When an advertisement goes through a pipeline and meets the connection criteria, Edge Connect will initiate a connection to that device. At that time, execution through the pipeline is paused until the connection sequence is completed.

Connection Sequence Setup

The connect filter also requires a named set of actions to perform upon successful connection. All actions in the sequence are performed in the order specified. Data from the previous action is passed forward to the next action.

Writing Data

The data to write using the write action is specified as a Hexadecimal string. This data is written regardless of the current value of the characteristic to which the write is performed. More options can be found in the documentation for the write action.

Output

After all actions are executed, the output data is added to the output of the connect filter in the current pipeline. All keys and data are passed on to the next filter in the pipeline.

4.5.3. Example Configuration

The following example configuration connects to a Nordic Thingy52 device. It reads a number of properties form the device and receives some notifications for Acceleration data. In addition, data is written to update the advertising parameters.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
{
  "settings": {
    "rigado-edge-connect": {
      "service": {
        "actions": {
          "read-adv-name": {
            "config": {
              "characteristic": "ef680101-9b35-4933-9b10-52ffa9740042",
              "outputKey": "advName",
              "service": "ef680100-9b35-4933-9b10-52ffa9740042"
            },
            "type": "read"
          },
          "read-battery": {
            "config": {
              "outputKey": "battery"
            },
            "type": "readBattery"
          },
          "read-fw-version": {
            "config": {
              "characteristic": "ef680107-9b35-4933-9b10-52ffa9740042",
              "outputKey": "fwVersion",
              "service": "ef680100-9b35-4933-9b10-52ffa9740042"
            },
            "type": "read"
          },
          "set-adv-params": {
            "config": {
              "characteristic": "ef680102-9b35-4933-9b10-52ffa9740042",
              "data": "010200",
              "service": "ef680100-9b35-4933-9b10-52ffa9740042"
            },
            "type": "write"
          },
          "wait-motion-notif": {
            "config": {
              "characteristic": "ef680406-9b35-4933-9b10-52ffa9740042",
              "interval": "5s",
              "mode": "notification",
              "outputKey": "motion",
              "service": "ef680400-9b35-4933-9b10-52ffa9740042"
            },
            "type": "wait"
          },
          "wait-temp-notif": {
            "config": {
              "characteristic": "ef680201-9b35-4933-9b10-52ffa9740042",
              "interval": "5s",
              "mode": "notification",
              "outputKey": "temperature",
              "service": "ef680200-9b35-4933-9b10-52ffa9740042"
            },
            "type": "wait"
          }
        },
        "cloud": {
          "connectors": {
            "http": {
              "config": {
                "method": "post",
                "url": "https://testserver.net/test"
              },
              "type": "http"
            }
          }
        },
        "connections": {
          "thingy": {
            "actions": [
              "read-battery",
              "wait-temp-notif",
              "wait-motion-notif",
              "read-fw-version",
              "read-adv-name",
              "set-adv-params"
            ]
          }
        },
        "filters": {
          "agg": {
            "config": {
              "interval": "5m",
              "key": "mac",
              "mode": "map"
            },
            "type": "aggregate"
          },
          "connect": {
            "config": {
              "id": "thingy",
              "interval": "5m",
              "timeout": 10
            },
            "type": "connect"
          },
          "convert": {
            "config": {
              "convertKeys": {
                "advName": "string",
                "fwVersion": "hex",
                "temperature": "hex"
              },
              "injectKeys": {
                "x": {
                  "length": 2,
                  "offset": 0,
                  "source": "motion",
                  "type": "intBE"
                },
                "y": {
                  "length": 2,
                  "offset": 2,
                  "source": "motion",
                  "type": "intBE"
                },
                "z": {
                  "length": 2,
                  "offset": 4,
                  "source": "motion",
                  "type": "intBE"
                }
              }
            },
            "type": "typeConvert"
          },
          "inject": {
            "config": {
              "keyPairs": {
                "serial": "",
                "timestamp": "us"
              }
            },
            "type": "inject"
          },
          "publish": {
            "config": {
              "connector": "http"
            },
            "type": "publish"
          },
          "select": {
            "config": {
              "keys": [
                "mac",
                "rssi",
                "name",
                "battery",
                "temperature",
                "motion",
                "fwVersion",
                "advName"
              ]
            },
            "type": "select"
          },
          "wrap": {
            "config": {
              "key": "testData"
            },
            "type": "wrap"
          },
          "wrapAccel": {
            "config": {
              "key": "accel",
              "keysToWrap": [
                "x",
                "y",
                "z"
              ]
            },
            "type": "wrap"
          }
        },
        "groups": {
          "things": {
            "config": {
              "include": [
                "e98fa57c7a5f",
                "e5178bec5303"
              ]
            },
            "type": "static"
          }
        },
        "pipelines": {
          "pubPipe": {
            "filters": [
              "connect",
              "select",
              "convert",
              "wrapAccel",
              "agg",
              "wrap",
              "inject",
              "publish"
            ],
            "groups": [
              "things"
            ]
          }
        }
      }
    }
  },
  "type": "APP_SET"
}