Device Events
Yonomi Platform maintaings logs of all device events that are published, allowing client users to audit device history and/or fetch on-demand information about a device's events. Additionally, clients may subscribe to receiving event webhooks whenever events of the type subscribed to are published to the event logs.
Device Event Types
Note: The shapes for the following event types are defined in the linked documentation pages that go over the flows where that publish these events. See the linked pages for details and examples.
Event Type | Description |
DEVICE_ACTION_CREATED | Event published when a new action is created (see Trait Overview: Device Action Lifecycle) |
DEVICE_ACTION_UPDATED | Event published when an existing action is updated (see Trait Overview: Device Action Lifecycle) |
DEVICE_STATE_UPDATED | Event published when device reports an update to a standard trait state (see Trait Overview: Device Reported State) |
DEVICE_BULK_DATA_STATE_UPDATED | Event published when device reports an update to a bulk data trait state (see Trait Overview: Device Reported State) |
DEVICE_NOTIFICATION_REPORTED | Event published when device reports an info or warning notification (see Trait Overview: Device Notifications) |
Example events that get published for a given action
Users may receive many events published for a single action mutation. For example, when sending a LockV1ExcuteLockingAction mutation, users will recive betwen 2 and 6 events total. Below are the events that might be expected for this action request
Event | Trigger |
DEVICE_ACTION_CREATED | When action has been created, user will get one of these events. |
DEVICE_ACTION_UPDATED | When action has been either rejected with an error or resolved, user will get one of these events with the appropriate status. |
DEVICE_STATE_UPDATED | If the action results in device changing its lockState, one of these will be emitted for each state change made. If action results in a momentary unlock of the device, state update will publish when device unlocks and again when it automatically relocks. Therefore, up to 2 DEVICE_STATE_UPDATED events are expected. |
DEVICE_NOTIFICATION_REPORTED | The device publishes a notification each time something attempts to change it's lockState to detail what the trigger was and the result. As such, anytime the lockState emits a DEVICE_STATE_UPDATED event, there will be a correspondiing notification giving context on why the state was changed. Therefore, up to 2 DEVICE_NOTIFICATION_REPORTED events are expected. |
Subscribing to Receive Webhooks
To configure webhook subscriptions to Yonomi events, see the Training Project: Create a Webhook Configuration page
Querying Event History
Required Headers
All device event queries require the following header be included.
FieldName | Description | Value | Required |
x-allegion-installation-Id | UUID of the installation that owns the device. Authentication will validate that bearer token has authorization to mutate against this installationId and that the requested deviceId is owned by that installation. If either fail, request will be rejected. | ID! | true |
Available Query Filters
Filter | Data Type | Additional Information |
eventType | string | See eventType list above for valid values |
before | dateTime | YYYY-MM-DDThh:mm:ss.sssZ |
after | dateTime | YYYY-MM-DDThh:mm:ss.sssZ |
traitName | string | See individual trait documents for valid values |
actionId | ID | Only apply if eventType filters on a Device Action Lifecycle eventType |
Querying for all events example
query QueryDeviceEvents ($deviceId: ID!) {
device (deviceId: "9a8f6104-6c50-476e-90ee-16b9a2dafc8d") {
id
events (sort: DESCENDING, first: 20) {
pageInfo {
hasNextPage
hasPreviousPage
endCursor
}
edges {
node {
eventType
createdAt
... on DeviceStateUpdatedEvent {
deviceId
fieldName
traitName
value
createdAt
}
... on DeviceBulkDataStateUpdatedEvent {
deviceId
traitName
}
... on DeviceActionCreatedEvent {
actionId
deviceId
traitName
actionParameters
actionStatus
}
... on DeviceActionUpdatedEvent {
actionId
deviceId
actionStatus
createdAt
errors {
code
message
details
}
}
... on DeviceNotificationReportedEvent {
deviceId
notificationName
notificationType
message
sampledAt
createdAt
traitName
details
}
}
}
}
}
}Querying for all events related to a particular trait example
query QueryDeviceEvents ($deviceId: ID!) {
device (deviceId: "9a8f6104-6c50-476e-90ee-16b9a2dafc8d") {
id
events (filter: { traitName: LockV1 }, sort: DESCENDING, first: 20) {
pageInfo {
hasNextPage
hasPreviousPage
endCursor
}
edges {
node {
eventType
createdAt
... on DeviceStateUpdatedEvent {
deviceId
fieldName
traitName
value
createdAt
}
... on DeviceBulkDataStateUpdatedEvent {
deviceId
traitName
}
... on DeviceActionCreatedEvent {
actionId
deviceId
traitName
actionParameters
actionStatus
}
... on DeviceActionUpdatedEvent {
actionId
deviceId
actionStatus
createdAt
errors {
code
message
details
}
}
... on DeviceNotificationReportedEvent {
deviceId
notificationName
notificationType
message
sampledAt
createdAt
traitName
details
}
}
}
}
}
}Querying for all DEVICE_ACTION_UPDATED events related to a particular action example
Note: because actionId filter is used, eventType must be DEVICE_ACTION_CREATED or DEVICE_ACTION_UPDATED to successfully get results.
query QueryDeviceEvents ($deviceId: ID!) {
device (deviceId: "9a8f6104-6c50-476e-90ee-16b9a2dafc8d") {
id
events (filter: { eventType: DEVICE_ACTION_UPDATED, actionId: "7eb3629a-a1c3-49f0-89b6-2831d500ac68" }, sort: DESCENDING, first: 20) {
pageInfo {
hasNextPage
hasPreviousPage
endCursor
}
edges {
node {
eventType
createdAt
... on DeviceActionUpdatedEvent {
actionId
deviceId
actionStatus
createdAt
errors {
code
message
details
}
}
}
}
}
}
}Querying for all events within a given dateTime range example
query QueryDeviceEvents ($deviceId: ID!) {
device (deviceId: "9a8f6104-6c50-476e-90ee-16b9a2dafc8d") {
id
events (filter: { before: "2024-12-01T00:00:00.000Z", after: "2024-12-31T23:59:59.999Z" }, sort: DESCENDING, first: 20) {
pageInfo {
hasNextPage
hasPreviousPage
endCursor
}
edges {
node {
eventType
createdAt
... on DeviceStateUpdatedEvent {
deviceId
fieldName
traitName
value
createdAt
}
... on DeviceBulkDataStateUpdatedEvent {
deviceId
traitName
}
... on DeviceActionCreatedEvent {
actionId
deviceId
traitName
actionParameters
actionStatus
}
... on DeviceActionUpdatedEvent {
actionId
deviceId
actionStatus
createdAt
errors {
code
message
details
}
}
... on DeviceNotificationReportedEvent {
deviceId
notificationName
notificationType
message
sampledAt
createdAt
traitName
details
}
}
}
}
}
}What made this section unhelpful for you?
On this page
- Device Events