fibaro_get_device
Retrieve a specific smart home device by its ID from the Fibaro Home Center 3 system to access device details and status.
Instructions
Get specific device by ID from Fibaro HC3
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Device ID |
Implementation Reference
- src/index.ts:355-368 (handler)MCP tool handler for 'fibaro_get_device' that checks connection, calls FibaroClient.getDevice, and formats the response as text content.case 'fibaro_get_device': { if (!this.fibaroClient) { throw new Error('Not connected to Fibaro HC3. Please check your configuration and restart the MCP server.'); } const device = await this.fibaroClient.getDevice(args?.id as number); return { content: [ { type: 'text', text: `Device ${device.id}:\nName: ${device.name}\nType: ${device.type}\nRoom ID: ${device.roomID}\nEnabled: ${device.enabled}\nVisible: ${device.visible}\nProperties: ${JSON.stringify(device.properties, null, 2)}`, }, ], }; }
- src/index.ts:120-133 (registration)Tool registration in ListTools handler, including name, description, and input schema requiring 'id'.{ name: 'fibaro_get_device', description: 'Get specific device by ID from Fibaro HC3', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Device ID', }, }, required: ['id'], }, },
- src/fibaro-client.ts:12-20 (schema)TypeScript interface defining the Device structure returned by getDevice.export interface Device { id: number; name: string; type: string; roomID: number; enabled: boolean; visible: boolean; properties: Record<string, any>; }
- src/fibaro-client.ts:78-85 (helper)Core implementation of device retrieval via HTTP GET to Fibaro API /api/devices/{id}, using Axios client.async getDevice(id: number): Promise<Device> { try { const response = await this.client.get(`/api/devices/${id}`); return response.data; } catch (error) { throw new Error(`Failed to get device ${id}: ${error}`); } }