@evan-kinney/homebridge-proxmox
v2.1.0
Published
Simple switch for Proxmox QEMU/LXC nodes
Maintainers
Readme
Homebridge Proxmox plugin
Proxmox plugin for Homebridge. This plugin adds switches that control status (on/off) of LXC/QEMU machines across multiple Proxmox servers.
Features
- Multiple Server Support: Connect to multiple Proxmox servers simultaneously
- LXC Container Control: Start/stop LXC containers from HomeKit
- QEMU VM Control: Start/stop QEMU virtual machines from HomeKit
- Real-time Status: Get current VM/container status in HomeKit
- Auto-discovery: Automatically discovers all VMs and containers from all configured servers
Requirements
- Homebridge - HomeKit support for the impatient
- Proxmox instance(s) - Proxmox Virtual Environment
Configuration
New Configuration Format (Multiple Servers)
Using Password Authentication
{
"platform": "HomebridgeProxmox",
"servers": [
{
"name": "Main Proxmox",
"host": "192.168.1.100",
"port": 8006,
"username": "root@pam",
"password": "your-password",
"ssl": true
}
],
"debug": false
}Using API Token Authentication (Recommended)
{
"platform": "HomebridgeProxmox",
"servers": [
{
"name": "Proxmox Server",
"host": "192.168.1.100",
"port": 8006,
"username": "homebridge@pve",
"apiToken": {
"tokenId": "homebridge@pve!homebridge-token",
"secret": "your-api-token-secret"
},
"ssl": true
}
],
"debug": false
}Migration from Single Server
If you're upgrading from a previous version that supported only one server, you'll need to update your configuration. The old format:
{
"platform": "HomebridgeProxmox",
"host": "192.168.1.100",
"username": "root@pam",
"password": "your-password",
"ssl": true,
"debug": false
}Should be converted to the new format:
{
"platform": "HomebridgeProxmox",
"servers": [
{
"name": "My Proxmox Server",
"host": "192.168.1.100",
"port": 8006,
"username": "root@pam",
"password": "your-password",
"ssl": true
}
],
"debug": false
}Configuration Options
Server Configuration
- name (required): A unique identifier for the Proxmox server
- host (required): IP address or hostname of the Proxmox server
- port (optional): Port number for the Proxmox server (default: 8006)
- username (required): Username for Proxmox authentication (e.g., "root@pam")
- password (optional): Password for Proxmox authentication
- apiToken (optional): API token for authentication (alternative to password)
- tokenId (required): API Token ID (format:
user@realm!tokenname) - secret (required): API Token Secret
- tokenId (required): API Token ID (format:
- ssl (required): Whether to accept self-signed SSL certificates (true/false)
Note: You must provide either password or apiToken for authentication. API tokens are recommended for better security.
Global Options
- debug (optional): Enable debug logging (true/false, default: false)
Installation
Install the plugin through Homebridge Config UI X or manually:
npm install -g homebridge-proxmoxConfigure the plugin with your Proxmox server details
Restart Homebridge
How it Works
- The plugin connects to all configured Proxmox servers on startup
- It discovers all VMs and LXC containers across all servers
- Each VM/container appears as a switch in HomeKit
- Turning the switch on/off starts/stops the corresponding VM/container
- The switch status reflects the current state of the VM/container
Troubleshooting
- Connection Issues: Check that the Proxmox server is accessible and credentials are correct
- SSL Errors: If using self-signed certificates, ensure
ssl: trueis set for that server - Missing VMs: Verify that the user has sufficient permissions in Proxmox
- Duplicate Names: Each server should have a unique name to avoid conflicts
Development
Setup Development Environment
Clone the repository:
git clone https://github.com/evan-kinney/homebridge-proxmox.git cd homebridge-proxmoxRun the setup script:
./dev-setup.shUpdate
.homebridge/config.jsonwith your Proxmox server detailsStart development:
npm run dev
Development Scripts
npm run dev- Start development server with auto-reloadnpm run build- Build the TypeScript codenpm run watch- Watch for changes and rebuildnpm run homebridge:dev- Run Homebridge with the pluginnpm run homebridge:debug- Run Homebridge with full debug outputnpm run test:config- Test Homebridge configuration without QR codenpm run clean- Clean build artifacts and Homebridge cachenpm run lint- Run ESLint
VS Code Development
The repository includes VS Code configurations for:
- Tasks: Build, watch, and run Homebridge
- Launch Configurations: Debug Homebridge with breakpoints
- Settings: TypeScript and ESLint integration
Use Ctrl+Shift+P → "Tasks: Run Task" → "Development Server" to start developing.
Project Structure
src/
├── index.ts # Plugin entry point
├── platform.ts # Main platform class with multi-server support
├── platformAccessory.ts # Individual accessory handling
└── settings.ts # Plugin constants
.homebridge/ # Development Homebridge configuration
├── config.json # Test configuration (update with real servers)
└── README.md # Development setup instructions
.vscode/ # VS Code configuration
├── tasks.json # Build and run tasks
└── launch.json # Debug configurationsTesting
- Update
.homebridge/config.jsonwith test server details - Run
npm run homebridge:devto test the plugin - Use iOS Home app or Homebridge UI to verify functionality
- Check logs for any errors or warnings
Debugging
- Set breakpoints in VS Code and use "Debug Homebridge" launch configuration
- Enable debug logging with
"debug": truein configuration - Use
npm run homebridge:debugfor verbose output - Check
.homebridge/directory for Homebridge logs and state
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly using the development environment
- Submit a pull request
Creating API Tokens in Proxmox
API tokens provide a more secure way to authenticate with Proxmox than using passwords. Here's how to create them:
Log into Proxmox Web Interface as an administrator
Navigate to Datacenter → Permissions → API Tokens
Click "Add" to create a new API token
Configure the token:
- User: Select or create a user (e.g.,
homebridge@pve) - Token ID: Give it a meaningful name (e.g.,
homebridge-token) - Privilege Separation: Uncheck this if you want the token to have the same permissions as the user
- Comment: Optional description
- User: Select or create a user (e.g.,
Set Permissions: Ensure the user has appropriate permissions:
- Path:
/(or specific paths for VMs/containers) - Role:
PVEVMAdminor custom role with necessary permissions - Propagate: Check this to apply to child objects
- Path:
Copy the Token: After creation, copy both the Token ID and Secret immediately (the secret is only shown once)
Use in Configuration: The Token ID format should be
user@realm!tokenname(e.g.,homebridge@pve!homebridge-token)
Required Permissions
The API token/user needs these minimum permissions:
- VM.Monitor: To read VM/container status
- VM.PowerMgmt: To start/stop VMs/containers
- Sys.Audit: To list nodes and resources
