From b247bd6b58b2878de0dfdaccd8874e0456fb7c53 Mon Sep 17 00:00:00 2001 From: Stefan Nienhuis Date: Mon, 25 Jul 2022 20:31:35 +0200 Subject: [PATCH] Fix device serial numbers --- plugin/package.json | 2 +- plugin/src/index.ts | 2 +- plugin/src/types/device.ts | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugin/package.json b/plugin/package.json index 0d155b9..a730201 100644 --- a/plugin/package.json +++ b/plugin/package.json @@ -1,7 +1,7 @@ { "name": "homebridge-bold", "displayName": "Homebridge Bold", - "version": "2.1.2", + "version": "2.1.3", "description": "HomeKit support for the Bold Smart Locks.", "main": "build/index.js", "engines": { diff --git a/plugin/src/index.ts b/plugin/src/index.ts index 5226b1f..0650c19 100644 --- a/plugin/src/index.ts +++ b/plugin/src/index.ts @@ -89,7 +89,7 @@ class BoldPlatform implements DynamicPlatformPlugin { .onGet(() => device.model.model || 'Lock'); informationService.getCharacteristic(this.hap.Characteristic.SerialNumber) - .onGet(() => device.serial || 'Unknown'); + .onGet(() => device.serial || `${device.type.id}-${device.model.id}-${device.owner.organizationId}-${device.id}`); informationService.getCharacteristic(this.hap.Characteristic.FirmwareRevision) .onGet(() => `${device.actualFirmwareVersion || 'Unknown'}`); diff --git a/plugin/src/types/device.ts b/plugin/src/types/device.ts index ef7695b..e1cf3d3 100644 --- a/plugin/src/types/device.ts +++ b/plugin/src/types/device.ts @@ -3,13 +3,17 @@ export interface Device { name: string; serial: string; gateway: any; // Only checked for presence + owner: { + organizationId: number; + }; type: { id: number; // ID = 1 for locks - } + }; settings: { activationTime: number; }; model: { + id: number; make: string; model: string; };