Skip to content

Commit

Permalink
Update docs and add filename to UI
Browse files Browse the repository at this point in the history
  • Loading branch information
thenewwazoo committed Jan 9, 2021
1 parent 28843d1 commit 670f8a0
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 10 deletions.
58 changes: 53 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,54 @@
A plugin that extends Homekit support for the Lutron Smart Bridge 2. Specifically, this adds support for the `SerenaTiltOnlyWoodBlind` device, which is all I care about at the moment. :)
# LutronCasetaLeap

This is a plugin that interfaces between Homebridge (and HomeKit) and the [Lutron Caséta Smart Bridge](https://www.casetawireless.com/products/expansion-kits-and-smart-bridge). Specifically, this adds support for the [Serena Smart Wood Blinds](https://www.serenashades.com), which is all I care about at the moment. :)

This is specifically _not_ for the Smart Bridge Pro, which uses (can use) an entirely different protocol. This plugin makes use of the [lutron-leap-js](https://github.com/thenewwazoo/lutron-leap-js) library, which implements the Lutron LEAP protocol, used by the Lutron mobile apps.

## Preparation

### Get your bridge ID

The bridge ID is the serial number, and is printed on the underside of the bridge, indicated here in green:

![picture of the underside of a bridge, showing the sticker with the ID on it](assets/bridge.png)

### Get your bridge credentials

The easiest way is to use the [`get_lutron_cert.py`](https://github.com/gurumitts/pylutron-caseta/blob/dev/get_lutron_cert.py) script that comes with the [`pylutron-caseta`](https://github.com/gurumitts/pylutron-caseta) project, without which this would not have been possible.

Each file corresponds to a configuration item:
* `caseta-bridge.crt` => CA certificate
* `caseta.key` => Private key
* `caseta.crt` => Signed certificate

## Installation

Either run `npm -i homebridge-lutron-caseta-leap` in your Homebridge installation directory or install it using [`homebridge-config-ui-x`](https://github.com/oznu/homebridge-config-ui-x#readme).

## Configuration

Each bridge on your network that you wish to control needs its own configuration entry.

### Using `homebridge-config-ui-x`

If you're using the GUI, you'll want to fill out the form, copying and pasting in the appropriate fields:

![a screenshot of the configuration UI, with fields filled with the contents of certificate files](assets/config.png)

The UI will handle multi-line input, so just paste it in.

Click the "ADD SECRETS" button to add additional bridges.

### Using `config.json`

The shape of the configuration is:

To configure it:
```json
{
"platform": "LutronCasetaLeap",
"secrets": [
{
"bridgeid": "0A1B2C3D", // this is the hex representation of your bridge's serial number. instructions eventually
"bridgeid": "0a1b2c3d",
"ca": "-----BEGIN CERTIFICATE-----\nMII...",
"key": "-----BEGIN PRIVATE KEY-----\nMII...",
"cert": "-----BEGIN CERTIFICATE-----\nMII..."
Expand All @@ -16,6 +58,12 @@ To configure it:
}
```

To get your device's ID, ask mDNS for the device's hostname (I'll post a tool to automate that eventually).
The authn strings are newline-escaped versions of the files you generated.

## To-do and contributions

The authn strings are newline-escaped versions of the files generated by [`get_lutron_cert.py`](https://github.com/gurumitts/pylutron-caseta/blob/dev/get_lutron_cert.py).
I welcome contributions! I wrote this to scratch an itch (no Serena wood blind support), but would be fine with additional devices. To add a device:
* Add a case to `LutronCasetaLeap.configureAccessory` and `handleBridgeDiscovery` for your new device type.
* Add a class for your device. The constructor should wire up event handlers and manage services and characteristics.
* Add relevant methods to the [`SmartBridge`](https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/SmartBridge.ts) class in the `lutron-leap-js` project to control the device. These methods should construct command requests.
* Add an "unsolicited events" handler in your new device class to update itself when new information arrives from the bridge, and to update characteristic values.
Binary file added assets/bridge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@
{
"key": "secrets[].ca",
"flex": "200px",
"title": "CA certificate",
"title": "CA certificate (caseta-bridge.crt)",
"placeholder": "-----BEGIN CERTIFICATE-----...",
"type": "textarea"
},
{
"key": "secrets[].key",
"flex": "200px",
"title": "Private key",
"title": "Private key (caseta.key)",
"placeholder": "-----BEGIN PRIVATE KEY-----...",
"type": "textarea"
},
{
"key": "secrets[].cert",
"flex": "200px",
"title": "Signed certificate",
"title": "Signed certificate (caseta.crt)",
"placeholder": "-----BEGIN CERTIFICATE-----...",
"type": "textarea"
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"displayName": "Lutron Caseta LEAP",
"name": "homebridge-lutron-caseta-leap",
"version": "2.0.0",
"version": "2.0.1",
"description": "Support for the Lutron Caseta Smart Bridge 2 (non-pro)",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class LutronCasetaLeap
secretsFromConfig(config: PlatformConfig): Map<string, SecretStorage> {
const out = new Map();
for (const entry of config.secrets as Array<BridgeAuthEntry>) {
out.set(entry.bridgeid, {
out.set(entry.bridgeid.toLowerCase(), {
ca: entry.ca,
key: entry.key,
cert: entry.cert,
Expand Down

0 comments on commit 670f8a0

Please sign in to comment.