diff --git a/src/lib/device.ts b/src/lib/device.ts index 69f80a8e..0f985fe9 100644 --- a/src/lib/device.ts +++ b/src/lib/device.ts @@ -69,6 +69,13 @@ export default class NodePyATVDevice implements EventEmitter{ return this.options.id; } + /** + * Get all IDs of the Apple TV. + */ + get allIDs(): string[] | undefined { + return this.options.allIDs; + } + /** * Get the used protocol to connect to the Apple TV. */ diff --git a/src/lib/instance.ts b/src/lib/instance.ts index cd5916f8..23feefcb 100644 --- a/src/lib/instance.ts +++ b/src/lib/instance.ts @@ -120,6 +120,7 @@ export default class NodePyATVInstance { this.device(Object.assign({}, options, { host: device.address, id: device.identifier, + allIDs: device.all_identifiers, name: device.name, model: device.device_info?.model, modelName: device.device_info?.model_str, diff --git a/src/lib/types.ts b/src/lib/types.ts index 9d3fe669..67eabb64 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -157,6 +157,7 @@ export interface NodePyATVDeviceOptions extends NodePyATVFindAndInstanceOptions os?: string; version?: string; services?: NodePyATVService[]; + allIDs?: string[]; } export interface NodePyATVGetStateOptions { @@ -175,6 +176,7 @@ export interface NodePyATVInternalScanDevice { name: string; address: string; identifier: string; + all_identifiers: string[]; device_info?: { model: string; model_str: string; diff --git a/test/device.ts b/test/device.ts index 162cebd0..30d2d626 100644 --- a/test/device.ts +++ b/test/device.ts @@ -48,6 +48,27 @@ describe('NodePyATVDevice', function () { }); }); + describe('get allIDs()', function () { + it('should return all the IDs', function () { + const device = new NodePyATVDevice({ + name: 'My Testdevice', + host: '192.168.178.2', + id: '*****', + allIDs: [ + 'some_id_1', + 'some_id_2', + 'some_id_3', + ] + }); + + assert.deepStrictEqual(device.allIDs, [ + 'some_id_1', + 'some_id_2', + 'some_id_3', + ]); + }); + }); + describe('get protocol()', function () { it('should return the protocol', function () { const device = new NodePyATVDevice({