--- title: "Device" slug: "170-manage-device" updated: 2025-12-09T17:26:51Z published: 2025-12-09T18:02:06Z canonical: "docs.developer.comcast.com/170-manage-device" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.developer.comcast.com/llms.txt > Use this file to discover all available pages before exploring further. # Device **Device Module 1.7.0 | Manage SDK** ## Usage To use the Device module, you can import it into your project from the Firebolt SDK: ``` import { Device } from '@firebolt-js/manage-sdk' ``` ## Overview A module for querying about the device and it's capabilities. ## Methods ### listen To listen to a specific event pass the event name as the first parameter: ``` listen(event: string, callback: (data: any) => void): Promise ``` Parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `event` | `string` | Yes | The event to listen for, see [Events](/docs/170-manage-device#events). | | *callback* | `function` | Yes | A function that will be invoked when the event occurs. | Promise resolution: | Type | Description | | --- | --- | | `number` | Listener ID to clear the callback method and stop receiving the event, e.g. `Device.clear(id)` | Callback parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `data` | `any` | Yes | The event data, which depends on which event is firing, see [Events](/docs/170-manage-device#events). | To listen to all events from this module pass only a callback, without specifying an event name: ``` listen(callback: (event: string, data: any) => void): Promise ``` Parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | *callback* | `function` | Yes | A function that will be invoked when the event occurs. The event data depends on which event is firing, see [Events](/docs/170-manage-device#events). | Callback parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `event` | `string` | Yes | The event that has occured listen for, see [Events](/docs/170-manage-device#events). | | `data` | `any` | Yes | The event data, which depends on which event is firing, see [Events](/docs/170-manage-device#events). | Promise resolution: | Type | Description | | --- | --- | | `number` | Listener ID to clear the callback method and stop receiving the event, e.g. `Device.clear(id)` | See [Listening for events](/docs/listening-for-events/) for more information and examples. ### name The human readable name of the device To get the value of `name` call the method like this: ``` function name(): Promise ``` Promise resolution: Capabilities: | Role | Capability | | --- | --- | | uses | xrn:firebolt:capability:device:name | #### Examples Default example #1 JavaScript: ``` import { Device } from '@firebolt-js/manage-sdk' let value = await Device.name() console.log(value) ``` Value of `value`: ``` 'Living Room' ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Device.name", "params": {} } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": "Living Room" } ``` Default example #2 JavaScript: ``` import { Device } from '@firebolt-js/manage-sdk' let value = await Device.name() console.log(value) ``` Value of `value`: ``` 'Living Room' ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Device.name", "params": {} } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": "Kitchen" } ``` --- To set the value of `name` call the method like this: ``` function name(value: string): Promise ``` Parameters: | Param | Type | Required | Description | | --- | --- | --- | --- | | `value` | `string` | true | the device friendly-name | Promise resolution: #### Examples Default example #1 JavaScript: ``` import { Device } from '@firebolt-js/manage-sdk' let result = await Device.name('Living Room') console.log(result) ``` Value of `result`: ``` null ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Device.setName", "params": { "value": "Living Room" } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` Default example #2 JavaScript: ``` import { Device } from '@firebolt-js/manage-sdk' let result = await Device.name('Kitchen') console.log(result) ``` Value of `result`: ``` null ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Device.setName", "params": { "value": "Kitchen" } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` --- To subscribe to notifications when the value changes, call the method like this: ``` function name(callback: (value) => string): Promise ``` Promise resolution: ``` number ``` #### Examples Default example #1 JavaScript: ``` import { Device } from '@firebolt-js/manage-sdk' let listenerId = await name((value) => { console.log(value) }) console.log(listenerId) ``` Value of `value`: ``` 'Living Room' ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Device.onNameChanged", "params": { "listen": true } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": "Living Room" } ``` Default example #2 JavaScript: ``` import { Device } from '@firebolt-js/manage-sdk' let listenerId = await name((value) => { console.log(value) }) console.log(listenerId) ``` Value of `value`: ``` 'Living Room' ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Device.onNameChanged", "params": { "listen": true } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": "Kitchen" } ``` --- ### once To listen to a single instance of a specific event pass the event name as the first parameter: ``` once(event: string, callback: (data: any) => void): Promise ``` The `once` method will only pass the next instance of this event, and then dicard the listener you provided. Parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `event` | `string` | Yes | The event to listen for, see [Events](/docs/170-manage-device#events). | | *callback* | `function` | Yes | A function that will be invoked when the event occurs. | Promise resolution: | Type | Description | | --- | --- | | `number` | Listener ID to clear the callback method and stop receiving the event, e.g. `Device.clear(id)` | Callback parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `data` | `any` | Yes | The event data, which depends on which event is firing, see [Events](/docs/170-manage-device#events). | To listen to the next instance only of any events from this module pass only a callback, without specifying an event name: ``` once(callback: (event: string, data: any) => void): Promise ``` Parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | *callback* | `function` | Yes | A function that will be invoked when the event occurs. The event data depends on which event is firing, see [Events](/docs/170-manage-device#events). | Callback parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `event` | `string` | Yes | The event that has occured listen for, see [Events](/docs/170-manage-device#events). | | `data` | `any` | Yes | The event data, which depends on which event is firing, see [Events](/docs/170-manage-device#events). | Promise resolution: | Type | Description | | --- | --- | | `number` | Listener ID to clear the callback method and stop receiving the event, e.g. `Device.clear(id)` | See [Listening for events](/docs/listening-for-events/) for more information and examples. ### provision Used by a distributor to push provision info to firebolt. ``` function provision( accountId: string, deviceId: string, distributorId: string, ): Promise ``` Parameters: | Param | Type | Required | Description | | --- | --- | --- | --- | | `accountId` | `string` | true | The id of the account that is device is attached to in the back office. | | `deviceId` | `string` | true | The id of the device in the back office. | | `distributorId` | `string` | false | The id of the distributor in the back office. | Promise resolution: Capabilities: | Role | Capability | | --- | --- | | manages | xrn:firebolt:capability:account:id xrn:firebolt:capability:device:id xrn:firebolt:capability:device:distributor | #### Examples Default Example JavaScript: ``` import { Device } from '@firebolt-js/manage-sdk' let result = await Device.provision('12345678910', '987654321111') console.log(result) ``` Value of `result`: ``` null ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Device.provision", "params": { "accountId": "12345678910", "deviceId": "987654321111" } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` With distributor id JavaScript: ``` import { Device } from '@firebolt-js/manage-sdk' let result = await Device.provision( '12345678910', '987654321111', 'global_partner', ) console.log(result) ``` Value of `result`: ``` null ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Device.provision", "params": { "accountId": "12345678910", "deviceId": "987654321111", "distributorId": "global_partner" } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` --- ## Events ### deviceNameChanged [Deprecated] This method is deprecated as of since version 0.6.0. Please use `Device.name()` as a replacement. --- ### nameChanged See: [name](/docs/170-manage-device#name) ## Private Events **View** ### deviceNameChanged [Deprecated] This method is deprecated as of since version 0.6.0. Please use `Device.name()` as a replacement. --- ### nameChanged See: [name](/docs/170-manage-device#name) ## Types