在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:Djelibeybi/homebridge-button-platform开源软件地址:https://github.com/Djelibeybi/homebridge-button-platform开源编程语言:JavaScript 100.0%开源软件介绍:Button Platform for HomebridgeThis Homebridge platform plugin creates virtual buttons that can be triggered using HTTP requests. It was originally created to provide HomeKit support for Flic smart buttons before the Flic Hub LR got native HomeKit support but can be leveraged by anything that can send HTTP requests.
This plugin requires a working home hub. Before you install, ensure you have setup a HomePod, HomePod mini, Apple TV or iPad as a home hub for HomeKit. A home hub is required to run automations triggered by the button events generated by this plugin. InstallThe simplest method to install and configure this plugin is via
To install manually, run the following command in your Homebridge directory.
Depending on how you installed Homebridge, you may need to add the npm install [-g|--unsafe-perms] homebridge-button-platform The ConfigurationThe plugin can be configured via the To configure the plugin manually, add the following configuration to the
"platforms": [
{
"platform": "button-platform",
"port": 3001,
"buttons": [
"My Button",
"Your Button",
"Their Button"
]
}
] You can add as many buttons to the array as you need. Each button will get its
own URI on which the server will listen for events. You can determine the URI
for each button by checking the Homebridge logs for
Sending eventsTo trigger a button event, send an HTTP
Using a |
Field | Value |
---|---|
Hub Action | Internet Request |
URL | http://homebridge.local:3001/button-name?event=click |
Type | GET |
The plugin from v1.5 onwards automatically creates a battery service when it detects it's being triggered by a Flic button and will update the battery level with the current value from the Flic whenever the button is pushed.
You can use the "Website" Stream Deck action to trigger an event. In the
Stream Deck configuration, drag the "Website" action to a key and configure
the URL to be http://homebridge.local:3001/button-name?event=click
which uses the
same parameters as the GET
request above:
Top tip: If you enable the
GET request in background
option, a browser will not open when you hit the key.
POST
requestIf you use an HTTP POST
request you must set the Content-Type header to either
application/json
or application/x-www-form-urlencoded
. The body of the request
needs a field named event
with a value of one of the event types defined above.
For example, to send a double press event to a button using curl
with a JSON
payload:
$ curl -X POST \
-H 'Content-Type: application/json' \
-d '{"event": "double-click"}' \
http://<homebridge>:<port>/<uri>
You can also POST
with an application/x-www-form-urlencoded
payload:
$ curl -X POST \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'event=double-click' \
http://<homebridge>:<port>/<uri>
This is useful when used in with a larger form-based application.
Check the Homebridge logs for any warnings as the plugin will log any attempts to trigger an invalid event or any invalid URIs.
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论