# ASSET LIBRARY EVENTS The asset library publishes messages to configurable MQTT topics on certain events taking place. ## Configuration By default, the MQTT event topics are configured as follows, but may be overridden per deployment: ```yaml events: groups: topic: cdf/assetlibrary/events/groups/{objectId}/{event} devices: topic: cdf/assetlibrary/events/devices/{objectId}/{event} policies: topic: cdf/assetlibrary/events/policies/{objectId}/{event} groupTemplates: topic: cdf/assetlibrary/events/groupTemplates/{objectId}/{event} deviceTemplates: topic: cdf/assetlibrary/events/deviceTemplates/{objectId}/{event} ``` `{objectId}` represents the unique identifier as follows: - groups: `groupPath` - devices: `deviceId` - policies: `policyId` - groupTemplates: `templateId` - deviceTemplates: `templateId` ## Events The payload for the MQTT message is as follows: ```json { "objectId": "", "type": "", "event": "", "payload": "", "attributes": { } } ``` ## Device Events The following events are published per device: | Event | Type | Event | Payload | Attributes | | ----------------------------------- | ------- | ------ | ------------------------------------------ | ----------------------------------------------------------------------------------- | | Device created | devices | create | Device | N/A | | Device updated | devices | modify | Device (changed attributes) | N/A | | Device deleted | devices | delete | Device (pre delete) | N/A | | Device attached to group | devices | modify | N/A | {"deviceId":"", "attachedToGroup":"", "relationship":"" } | | Device detached from group | devices | modify | N/A | {"deviceId":"", "detachedFromGroup":"", "relationship":"" } | | Device attached to another device | devices | modify | N/A | {"deviceId":"", "attachedToDevice":"", "relationship":"" } | | Device detached from another device | devices | modify | N/A | {"deviceId":"", "detachedFromDevice":"", "relationship":"" } | | Device component created | devices | create | Device (the component) | {"deviceId":"", "componentId":"" } | | Device component updated | devices | modify | Device (the component, changed attributes) | {"deviceId":"