1.0.3 • Published 2 years ago

homebridge-programmable-http-switch v1.0.3

Weekly downloads
5
License
MIT
Repository
github
Last release
2 years ago

Programmable HTTP Switch

verified-by-homebridge Downloads Version Issues Pull requests

This Homebridge plugin allows users to create Stateless Programmable Switches which can be controlled using a HTTP API.

Installation

First, install Homebridge npm install --global homebridge

Then, install the Programmable HTTP Switch plugin npm install --global homebridge-programmable-http-switch

Configuration

Platform configuration

An example configuration can be found in the config.example.json file.

PropertyTypeDetails
platformstringRequiredMust always be ProgrammableHTTPSwitch.
accessoriesAccessory[]RequiredList of accessory configurations.
portnumberOptional, default: 3000The port that the HTTP server should listen on.

Accessory configuration

PropertyTypeDetails
namestringRequiredThe name of the accessory.
identifierstringRequiredThe identifier used in the API.
buttonsButton[]RequiredList of button configurations.

Button configuration

PropertyTypeDetails
namestringRequiredThe name of the button. Note: Not shown in Apple's Home app.
identifierstringRequiredThe identifier used in the API.
supportedActionsstring[]Optional, default: allList of actions that this button supports.Supported values: singlePress (0), doublePress (1) and longPress (2)

API endpoints

GET /accessories

Description Returns all the currently configured accessoires.

GET /accessories/:accessoryIdentifier

Description Returns an accessory with a specific identifier.

GET /accessories/:accessoryIdentifier/buttons

Description Returns all buttons for an accessory with a specific identifier.

GET /accessories/:accessoryIdentifier/buttons/:buttonIdentifier

Description Returns a button with a specific identifier for an accessory with a specific identifier.

PUT /accessories/:accessoryIdentifier/buttons/:buttonIdentifier

Description Sets the state of a specific button on a specific accessory.

Body

{
    "action": "singlePress"
}

Note: Action must be one of the supported actions configured for the specific button.