Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trigger Update API
Overview
The Trigger Update API provides a REST endpoint that allows external plugins (like
homebridge-plugin-update-check) to programmatically trigger updates for Homebridge, homebridge-config-ui-x, or any installed Homebridge plugin.Endpoint
Authentication
This endpoint requires admin authentication via Bearer token.
Authorization: Bearer <your-token>Request Body
Valid Package Names
homebridge- The Homebridge core packagehomebridge-config-ui-x- The Homebridge Config UI X packagehomebridge-*or@scope/homebridge-*Response
Success (201 Created)
{ "message": "Update for homebridge-example-plugin to version 1.2.3 has been queued and will be performed in the background.", "name": "homebridge-example-plugin", "version": "1.2.3", "status": "queued" }Error Responses
404 Not Found - Package is not installed
{ "statusCode": 404, "message": "Plugin homebridge-example-plugin is not installed.", "error": "Not Found" }400 Bad Request - Invalid package name
{ "statusCode": 400, "message": "Invalid package name. Must be \"homebridge\", \"homebridge-config-ui-x\", or a valid Homebridge plugin name.", "error": "Bad Request" }401 Unauthorized - Missing or invalid authentication
{ "statusCode": 401, "message": "Unauthorized" }Usage Examples
Update a Plugin to Latest Version
Update a Plugin to Specific Version
Update Homebridge Core
Update homebridge-config-ui-x
Note: When updating
homebridge-config-ui-x, the server will automatically restart after 5 seconds to apply the update.JavaScript/TypeScript Example
Behavior
Validation: The endpoint first validates:
Asynchronous Execution: The update is queued and executed in the background using
setImmediate(). The endpoint returns immediately with a success response.Update Process: The update process:
homebridge-config-ui-x, triggers an automatic restart after 5 secondsRestart Requirement: After updating plugins or Homebridge, a restart of the Homebridge service is typically required to apply the changes. The endpoint does NOT automatically restart Homebridge (except for
homebridge-config-ui-x).Integration with homebridge-plugin-update-check
This endpoint is designed to be used by plugins like
homebridge-plugin-update-checkto provide automated update capabilities. Example integration:Security Considerations
Logging
All update operations are logged to the Homebridge logs with the format:
Error Handling
Failed updates are logged with full error details:
The endpoint itself will not throw errors for background update failures, as the update happens asynchronously after the response is sent.