seamapi / public-tracker

0 stars 0 forks source link

Add Access Code ID to Salto KS Unlock Events #60

Closed sybohy closed 3 months ago

sybohy commented 7 months ago

Description

Some Salto KS locks with pin pad expose the access code that was used to gain access. Seam does not currently surface this information in its API and Console.

Steps to Reproduce

  1. Connect a SaltoKS system
  2. Create an access code
  3. Unlock the door

Expected behavior: See access_code_id for created code on the lock.unlocked event.

Actual behavior: No access_code_id is present.

Solution

Retrieve the access code and attach it to the lock.unlocked event:

Sample event code:

{
  "access_code_id": "c1296d07-3e96-4ee9-8219-3cd33a09aa37", // <---- ADD THIS HERE
  "connected_account_id": "c1296d07-3e96-4ee9-8219-3cd33a09aa37",
  "created_at": "2023-01-09T18:54:32.737Z",
  "device_id": "c1296d07-3e96-4ee9-8219-3cd33a09aa37",
  "event_id": "c1296d07-3e96-4ee9-8219-3cd33a09aa37",
  "event_type": "lock.unlocked",
  "method": "keycode",
  "occurred_at": "2023-01-09T18:54:32.737Z",
  "workspace_id": "c1296d07-3e96-4ee9-8219-3cd33a09aa37"
}

Resources

Seam team: information context