Description
n8n-nodes-homebridge



An n8n community node that provides complete integration with Homebridge API, allowing you to control your HomeKit accessories and manage your Homebridge server through n8n workflows.
Optimized for MCP (Model Context Protocol) – Perfect for AI agents and automation!
n8n is a fair-code licensed workflow automation platform.
Table of Contents
- Features
- Installation
- Quick Start
- Operations
- Credentials
- Usage Examples
- MCP Integration
- Troubleshooting
- Resources
- Contributing
- License
- 79 API endpoints – Complete Homebridge API implementation
- 10 resource categories – Authentication, Server, Config, Plugins, Accessories, Users, Status, Platform, Backup, Setup
- Type-safe – Full TypeScript implementation with strict mode
- Error handling – Robust error management with user-friendly messages
- Retry logic – Automatic retry with exponential backoff
- Validation – Input validation for all parameters
- Logging – Comprehensive logging for debugging
- Documentation – Complete JSDoc and inline documentation
- Batch operations – Execute multiple operations efficiently
- Structured metadata – Every response includes execution metadata
- Tool definitions – Ready for AI agent integration
- Webhook support – Real-time event handling
- Auto-authentication – JWT token management
- Pagination – Handle large datasets efficiently
- Caching – Optional caching for performance
- Streaming – Support for long-running operations
—
Features
Comprehensive API Coverage
Developer Experience
MCP Optimization
Advanced Features
—
Installation
Option 1: Via n8n UI (Recommended)
1. Go to Settings > Community Nodes
2. Select Install
3. Enter n8n-nodes-homebridge in Enter npm package name
4. Agree to the risks of using community nodes
5. Select Install
Option 2: Via npm
npm install n8n-nodes-homebridge
Option 3: Manual Installation
git clone https://github.com/paolo-trivi/n8n-nodes-homebridge.git
cd n8n-nodes-homebridge
npm install
npm run build
npm link
After installation, restart n8n to see the node in your palette.
—
Quick Start
1. Configure Credentials
1. In n8n, create new credentials for Homebridge API
2. Enter your Homebridge server details:
– Server URL**: http://your-homebridge-server:8581
– Username**: Your Homebridge username
– Password**: Your Homebridge password
– Two-Factor Code** (optional): If 2FA is enabled
2. Create Your First Workflow
Simple Status Check:
1. Add "Homebridge" node
2. Select Resource: "Authentication"
3. Select Operation: "Login"
4. Add another "Homebridge" node
5. Select Resource: "Status"
6. Select Operation: "Check Homebridge Status"
7. Connect the nodes and execute
Control a Light:
1. Add "Homebridge" node**-> Login
2. Add "Homebridge" node**-> Resource: Accessories, Operation: List
3. Add "Homebridge" node**-> Resource: Accessories, Operation: Set Characteristic
** - Unique ID:
** - Characteristic Type: On
** - Value: true
4. Connect and execute
—
Operations
Complete Feature List (79 Operations)
#### Authentication (4 operations)
#### Server Management (16 operations)
#### Config Editor (9 operations)
#### Plugin Management (8 operations)
#### Accessories Control (4 operations)
#### User Management (8 operations)
#### Status Monitoring (10 operations)
#### Platform Tools (9 operations)
#### Backup & Restore (9 operations)
#### Setup Wizard (2 operations)
—
Credentials
Homebridge API Credentials
Configure the following in n8n:
| Field | Description | Required | Example |
|——-|————-|———-|———|
| Server URL | Homebridge server URL with port | Yes | http://192.168.1.100:8581 |
| Username | Your Homebridge username | Yes | admin |
| Password | Your Homebridge password | Yes | ** |
| Two-Factor Code | 2FA code if enabled | No | 123456 |
Important Notes:
—
Usage Examples
Example 1: Basic Authentication and Status
// Node 1: Login
{
**"resource": "auth",
**"operation": "login"
}// Node 2: Get Status (connected to Node 1)
{
**"resource": "status",
**"operation": "getHomebridgeStatus"
}
// Output:
{
**"status": "up",
**"consolePort": 8581,
**"port": 51826,
**"pin": "031-45-154",
**"username": "CC:22:3D:E3:CE:30"
}
Example 2: Control Smart Light
// Turn light ON
{
**"resource": "accessories",
**"operation": "setCharacteristic",
**"uniqueId": "00000000-0000-1000-8000-0026BB765291",
**"characteristicType": "On",
**"value": "true"
}// Set brightness to 75%
{
**"resource": "accessories",
**"operation": "setCharacteristic",
**"uniqueId": "00000000-0000-1000-8000-0026BB765291",
**"characteristicType": "Brightness",
**"value": "75"
}
Example 3: Plugin Management
// Search for camera plugins
{
**"resource": "plugins",
**"operation": "search",
**"query": "camera"
}// Get specific plugin info
{
**"resource": "plugins",
**"operation": "lookup",
**"pluginName": "homebridge-camera-ffmpeg"
}
// Get plugin changelog
{
**"resource": "plugins",
**"operation": "getChangelog",
**"pluginName": "homebridge-camera-ffmpeg"
}
Example 4: Automated Backup
// Schedule: Every day at 3 AM// 1. Login
{ "resource": "auth", "operation": "login" }
// 2. Create Backup
{ "resource": "backup", "operation": "createBackup" }
// 3. List Backups
{ "resource": "backup", "operation": "listScheduledBackups" }
// 4. Send notification with backup status
Example 5: Temperature Monitoring
// Schedule: Every 5 minutes// 1. Login
// 2. Get temperature sensor
{
**"resource": "accessories",
**"operation": "getAccessory",
**"uniqueId": "temperature-sensor-id"
}
// 3. Check temperature value
// 4. If > 30°C, send alert
Example 6: System Health Dashboard
// Collect system metrics// Parallel execution:
// - Get CPU Info
// - Get RAM Info
// - Get Network Info
// - Get Uptime
// - Get Homebridge Status
// Merge results and send to monitoring dashboard
—
MCP Integration
What is MCP?
Model Context Protocol (MCP) enables AI models to interact with external tools and APIs. This node is fully optimized for MCP.
MCP Features
#### 1. Structured Tool Definitions
Each operation has a clear schema:
{
**"name": "homebridgeaccessoriessetCharacteristic",
**"description": "Control a HomeKit accessory by setting a characteristic value",
**"inputSchema": {
**"type": "object",
**"properties": {
"uniqueId": {
**"type": "string",
**"description": "Unique ID of the accessory"
},
"characteristicType": {
**"type": "string",
**"description": "Characteristic to modify (On, Brightness, Temperature, etc.)"
},
"value": {
**"type": "string",
**"description": "Value to set"
}
**},
**"required": ["uniqueId", "characteristicType", "value"]
**}
}
#### 2. Batch Operations
Execute multiple operations efficiently:
{
**"operations": [
**{ "resource": "status", "operation": "getHomebridgeStatus" },
**{ "resource": "accessories", "operation": "list" },
**{ "resource": "plugins", "operation": "listInstalled" }
**]
}
#### 3. Execution Metadata
Every response includes metadata:
{
**"data": { "status": "up", ... },
**"_metadata": {
**"resource": "status",
**"operation": "getHomebridgeStatus",
**"executedAt": "2025-01-06T12:00:00.000Z",
**"success": true
**}
}
#### 4. Error Handling
User-friendly error messages for AI agents:
{
**"error": "Unauthorized",
**"message": "Access token is invalid or expired. Please authenticate again.",
**"statusCode": 401
}
Using with AI Agents
Example with Claude/GPT:
System: You have access to Homebridge API via n8n.User: "Turn on the living room lights and set them to 50% brightness"
Agent:
1. Execute: homebridgeaccessorieslist
2. Find: living room light uniqueId
3. Execute: homebridgeaccessoriessetCharacteristic (On=true)
4. Execute: homebridgeaccessoriessetCharacteristic (Brightness=50)
5. Respond: " Living room lights are now on at 50% brightness"
—
Troubleshooting
Common Issues and Solutions
#### Authentication Failed
Problem: Cannot login to Homebridge
Solutions:
:8581)#### No Access Token Available
Problem: Error about missing access token
Solutions:
#### Network Timeout
Problem: Requests timeout or fail to connect
Solutions:
#### Invalid JSON Parameter
Problem: Config update fails with JSON error
Solutions:
#### Accessory Not Found
Problem: Cannot control specific accessory
Solutions:
Enable Debug Logging
For detailed logging:
1. Edit GenericFunctions.ts
2. Set LOGGING.LEVEL = 'debug' in constants.ts
3. Rebuild the node
4. Check n8n logs for detailed output
—
Performance Tips
Optimize Your Workflows
1. Reuse Access Tokens
** – Login once, pass token to all subsequent nodes
** – Avoid unnecessary re-authentication
2. Use Batch Operations
** – Combine multiple operations when possible
** – Reduces API calls and improves speed
3. Cache Frequently Used Data
** – Store accessory lists, plugin configs
** – Refresh only when needed
4. Implement Error Handling
** – Enable “Continue on Fail” for non-critical operations
** – Add retry logic for transient failures
5. Limit Data Retrieval
** – Use filters to get only what you need
** – Avoid listing all accessories if you need just one
—
Resources
Documentation
External Resources
Support
—
Contributing
Contributions are welcome! Please follow these steps:
1. Fork the repository
2. Create a feature branch: git checkout -b feature/amazing-feature
3. Make your changes following our coding standards
4. Add tests for new functionality
5. Update documentation (README, IMPLEMENTATION_GUIDE)
6. Commit your changes: git commit -m 'Add amazing feature'
7. Push to the branch: git push origin feature/amazing-feature
8. Open a Pull Request
Development Setup
git clone https://github.com/paolo-trivi/n8n-nodes-homebridge.git
cd n8n-nodes-homebridge
npm install
npm run dev
Coding Standards
—
Architecture
File Structure
n8n-nodes-homebridge/
├── credentials/
│** └── HomebridgeApi.credentials.ts
├── nodes/Homebridge/
│** ├── Homebridge.node.ts
│** ├── HomebridgeDescription.ts
│ ├── GenericFunctions.ts# Helper functions
│ ├── types.ts # TypeScript types
│ ├── constants.ts** # Configuration
│** └── homebridge-logo.svg
├── examples/
│** └── workflows.json
├── IMPLEMENTATION_GUIDE.md
└── README.md
Key Components
—
Roadmap
Future Features
—
License
Copyright (c) 2025 paolo-trivi
—
Acknowledgments
—
Stats
—
Made withby paolo-trivi**
Starthis repo if you find it useful!**
—
Last Updated: 2025-01-06
Version: 2.0.0
Node.js: >=20.15.0
n8n: >=0.187.0