README
homebridge-http-entry
A homebridge accessory to make HTTP calls to garage doors and gates.
Open, close, and get the state of your entry.
Features
- Configurable endpoints for getting/setting entry state
- Support for any type of HTTP method (default: GET)
- Support for HTTP basic auth
- Configurable mapping of endpoint response body to HomeKit garage door states
- Supports pulling data from device (polling) or pushing from devices (webhooks)
Install
- Requires homebridge (
npm install -g homebridge
). - Requires Node >= 8.11
npm install -g homebridge-http-entry
Usage
Update your homebridge configuration file with a new block under accessories
.
Property | Type | Default | Description |
---|---|---|---|
accessory |
string | (Required) HttpEntry |
|
name |
string | (Required) The name of your accessory. | |
enableDebugLog |
bool | false |
Enable extra debug logging. |
auth.username |
string | HTTP auth username | |
auth.password |
string | HTTP auth password | |
webhooks.accessoryId |
string | A unique id for notification server urls | |
webhooks.password |
string | An optional password for notification server requests | |
pollInterval |
number | Interval to poll in milliseconds. Ignored if used with webhooks.accessoryId |
|
endpoints |
object | Supports getState , open , close . See Endpoint Configuration for details |
|
mappers |
object | Supports static , regex , and xpath . See Mappers for usage. |
Example config (minimal)
{
"accessory": "HttpEntry",
"name": "Garage Bay 1",
"endpoints": {
"getState": {
"method": "GET",
"url": "http://bay1.local/state",
},
"open": {
"method": "PUT",
"url": "http://bay1.local/state",
"body": "OPEN"
},
"close": {
"method": "PUT",
"url": "http://bay1.local/state",
"body": "CLOSED"
}
}
}
Endpoint Configuration
Endpoint configuration is passed directly to got
. Minimally url
makes this useful, but you may also craft requests with PUT or POST methods.
Example:
{
"url": "http://bay1.local/state",
"method": "PUT",
"body": "OPEN",
}
You may define any of the following endpoints:
getState
open
close
cycle
Advanced
Mappers
Mappers may be applied to the endpoint response to transform it into the numeric states expected by HomeKit. The GarageDoorOpener
service expects one of the following states:
Value | State |
---|---|
0 |
open |
1 |
closed |
2 |
opening |
3 |
closing |
4 |
stopped |
Mappers are applied in order, with the result of the previous passed to the next. Use the mappers
property to configurare mappers for your accessory.
Static
Map one value to another
Example configuration:
{
"type": "static",
"parameters": {
"mapping": {
"OPENING": 2,
"CLOSING": 3
}
}
}
Example response:
OPENING
Output:
2
Regex
Capture output a regular expression
Example configuration:
{
"type": "regex",
"parameters": {
"regexp": "^The door is currently (OPEN|CLOSED), yo!