Device Groups

Device Groups

Device Groups are a technique for identifying a particular set of Devices/Sensors. A Device Group is used to explicitly filter which Device's advertisements, connections and Device Status events (presence, absence, or battery level) are delivered to a defined Pipeline.

A default Device Group exists that contains all devices Edge Connect observes.


Defining Device Groups

Device Groups are defined in an Edge Connect Configuration. There is no limit to the number of defined Device Groups.

Two types of Device Groups are currently supported: static and persistent. Either one is based on an include and exclude list of MAC Addresses, with the persistent type storing discovered/removed devices on disk in order to persist across reboots. Static device groups are best suited for a pre-configured set of devices in the configuration file, while persistent groups are better for dynamic provisioning.

References:

Static Device Group Documentation

Persistent Device Group Documentation


Targeting Device Groups in Pipelines

Pipelines have a groups field. If this parameter is set, the Pipeline will only receive events if at least one of the Device Groups match the Device that generated the event. If the parameter is
left empty, the Pipeline will receive events from the default from all observed devices.


Device Status Events

Device Status Events are emitted from each Device Group when the presence of a Device changes. To subscribe to these events, create a Pipeline with the eventType field set to deviceStatus. Setting the groups field to a set of Device Groups causes Edge Connect to deliver only device status events for devices which match the group(s).

Device Status events include these fields:

{
    "property": "string; the property that is being reported, currently either presence or batteryLevel",
    "propertyStatus": "string; either OK, WARN, or FAIL",
    "propertyValue": "percentage of batteryLevel, or boolean for presence",
    "lastAdvertisement": "ble advertisement (see filter output docs)",
    "lastSeenTimestamp": "golang time.Time",
    "present": "deprecated: boolean - true if device arrives, false if it is absent",
    "timestamp": "golang time.Time, the time of the event",
    "deviceGroup": "string - the Device Group ID that generated this event",
    "mac":"string"
}

Discovery of Devices

Rather than explicitly setting the include or exclude lists for a device group, devices can be added to, or removed from, a Device Group at runtime using the discoverDevice or removeDevice Filters. In this way, a Filter in a Pipeline can be used to discover the devices that should be in a Group by adding any devices that reach the discoverDevice Filter in the
Pipeline. If these devices should persist across reboots, the device group should use the persistent group type.