Skip to content

Commit

Permalink
Merge pull request #2516 from homebridge/rc
Browse files Browse the repository at this point in the history
v1.0.0
  • Loading branch information
oznu committed Apr 27, 2020
2 parents ee3366c + 476e4be commit 34f18ff
Show file tree
Hide file tree
Showing 45 changed files with 8,329 additions and 2,457 deletions.
31 changes: 31 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended", // uses the recommended rules from the @typescript-eslint/eslint-plugin
"plugin:jest/recommended" // enables eslint-plugin-jest
],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"ignorePatterns": [
"bin/",
"lib/"
],
"rules": {
"quotes": ["error", "double"],
"indent": ["error", 2, { "SwitchCase": 1 }],
"linebreak-style": ["error", "unix"],
"semi": ["error", "always"],

"comma-dangle": ["error", "always-multiline"],
"dot-notation": "error",
"eqeqeq": "error",
"curly": ["error", "all"],
"brace-style": ["error"],

"@typescript-eslint/no-non-null-assertion": "off" // currently disabled, hap-nodejs has some bad typing (like getCharacteristic) for this to be enabled
}
}
6 changes: 5 additions & 1 deletion .github/workflows/npmpublish-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ jobs:
with:
node-version: 12
- run: npm ci
- run: npm run build
- run: npm run lint
- run: npm test

publish-npm:
if: github.repository == 'homebridge/homebridge'
needs: build
runs-on: ubuntu-latest
steps:
Expand All @@ -27,7 +31,7 @@ jobs:
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm install
- run: node .github/workflows/prerelease.js
- run: npm --no-git-tag-version version prerelease --preid=beta
- run: npm publish --tag=beta
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ jobs:
with:
node-version: 12
- run: npm ci
- run: npm run build
- run: npm run lint
- run: npm test

publish-npm:
if: github.repository == 'homebridge/homebridge'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test

on: [
pull_request,
push
]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x, 13.x]

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
- run: npm run lint
- run: npm test
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ node_modules/
npm-debug.log
.node-version

package-lock.json

# Ignore any extra plugins in the example directory that aren't in Git already
# (this is a sandbox for the user)
example-plugins
lib

.idea

# possible local testing storage
.homebridge
71 changes: 71 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Change Log

All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/).

## v1.0.0 (2020-04-27)

### Breaking Changes

* **The minimum Node.js version required is now `v10.17.0`.**
* **Important notice:** The update to the underlying HAP-NodeJS library brings many fixes to the HomeKit Accessory Protocol. One of those is the permission management of people you may have added to your Home. It is strongly recommended that you remove every person added to your Home and then invite them back into your home. This will ensure that permissions for all people in your home are downgraded correctly.
* [#2481](https://github.com/homebridge/homebridge/pull/2481) - Platforms will no longer load unless they have been explicitly configured in the `config.json`
* [#2482](https://github.com/homebridge/homebridge/pull/2482) - Dropped support for the `BridgeSetupManager`

If you encounter any issues in v1.0.0 you can rollback to v0.4.53 using this command:

```
sudo npm install -g --unsafe-perm homebridge@0.4.53
```

### Notable Changes

* [#2476](https://github.com/homebridge/homebridge/pull/2476) - Project converted to Typescript by [@Supereg](https://github.com/Supereg)
* Homebridge API version was bumped to `2.5` with the following additions:
* The signatures of `registerAccessory` and `registerPlatform` have been adjusted. The plugin name, which was passed
as the first argument, can now be left out and will be determined automatically by homebridge.
* The `PlatformAccessory` class received a new method `configureController` which can be used to access the new
Controller API (used for Apple TV Remotes and Cameras) introduced with HAP-NodeJS 0.6.0
* Cameras can now be added to the bridge using a `DynamicPlatformPlugin` and the methods `configureCameraSource` or
`configureController` of the `PlatformAccessory` (removing the need to create an external accessory)
* The hidden service and primary service properties are now properly restored for cached accessories
* [#2391](https://github.com/homebridge/homebridge/pull/2391) - [HAP-NodeJS](https://github.com/homebridge/HAP-NodeJS)
updated to 0.6.0 with some changes highlighted here:
* HAP-NodeJS was converted to Typescript as well (thanks to [@hassankhan](https://github.com/hassankhan))
* Support for exposing Cameras through a Bridge was added
* Support for Apple TV Remotes (with and without Siri Voice transmission) using the new RemoteController API
* Introduction of the new CameraController API which improves on the existing API and opens the way for a possible
future introduction of an API for HomeKit Secure Video
* Introduced new APIs to mark a service as primary service
* Added new characteristic property `adminOnlyAccess` to limit certain access rights to the home-owner
* Added new services and characteristics for:
* HomeKit Routers (`WiFiRouter` and `WiFiSatellite` services)
* HomeKit Secure Video (`CameraOperatingMode` and `CameraEventRecordingManagement` services)
* `AccessControl` service
* `SmartSpeaker` service
* `PowerManagement` service
* `TransferTransportManagement` service
* Updated to HAP Protocol Version 1.1.0:
* Support of the HomeKit Data Stream (HDS) protocol (used by Remotes and Secure Video)
* Support for Timed Writes and Write Responses
* Fixed a bug in the encryption layer, which would sometimes encrypt events in the wrong order causing corrupted responses.
This issue typically affected service which expose their state using 'target' characteristics
and 'current' characteristics like Doors, Locks and Windows.
* Improved HAP specification compatibility, while noting the following changes affecting compatibility:
* For `/characteristics` `PUT` request the HAP server will return `204 No Content` if all characteristic writes
succeeded and `207 Multi-Status` if at least one write failed or when a write-response is delivered.
* For `/characteristics` `GET` request the HAP server will return `200 Success` if all characteristic reads
succeeded and `207 Multi-Status` if at least one write failed.
* The HAP server will now return short UUIDs for Apple predefined services and characteristics for the `/accessories` route.
* Many, many more bug fixes and improvements.

### Other Changes

* Homebridge now exports TypeScript types that can be used in the development of plugins.
* See the [homebridge-examples](https://github.com/homebridge/homebridge-examples) repo for examples of how to do this.
* We also have create a [plugin template](https://github.com/homebridge/homebridge-plugin-template) you can use as a base for your own plugins.

## v0.4.53 (2020-03-18)

### Notable Changes

* Added the ability to use [scoped npm](https://docs.npmjs.com/using-npm/scope.html) modules as Homebridge plugins. This means plugin developers can now publish Homebridge plugins to npm under their own user or npm organisation, such as `@username/homebridge-plugin`.
41 changes: 41 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Contributing

Pull requests are welcome from everyone.

Homebridge is written in [TypeScript](https://www.typescriptlang.org/).

## Getting Setup

Fork, then clone the repo:

```
git clone git@github.com:your-username/homebridge.git
```

Install npm dependencies:

```bash
npm install
```

Build Homebridge:

```bash
npm run build
```

Start Homebridge:

```bash
npm run dev

# or

node bin/homebridge
```

All contributions must follow the style guidelines set by this project. To lint your changes run:

```bash
npm run lint
```
38 changes: 24 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ HomeKit communities can also be found on both [Discord](https://discord.gg/RcV7f

The [Homebridge Wiki](https://github.com/homebridge/homebridge/wiki) contains step-by-step instruction on how to install Node.js and setup Homebridge as a service so it automatically starts on boot:

* [Official Homebridge Raspberry Pi Image](https://github.com/homebridge/homebridge-raspbian-image/wiki/Getting-Started)
* [Setup Homebridge on a Raspberry Pi (Raspbian)](https://github.com/homebridge/homebridge/wiki/Install-Homebridge-on-Raspbian)
* [Setup Homebridge on Debian or Ubuntu Linux](https://github.com/homebridge/homebridge/wiki/Install-Homebridge-on-Debian-or-Ubuntu-Linux)
* [Setup Homebridge on macOS](https://github.com/homebridge/homebridge/wiki/Install-Homebridge-on-macOS)
Expand All @@ -50,7 +51,7 @@ The [Homebridge Wiki](https://github.com/homebridge/homebridge/wiki) contains st

#### Quick Overview

1. **Node v4.3.2 or greater is required.** Check by running: `node -v`. The plugins you use may require newer versions.
1. **Node v10.17.0 or greater is required.** Check by running: `node -v`. The plugins you use may require newer versions.
2. Install Homebridge using: `npm install -g --unsafe-perm homebridge`
3. Install the plugins using: `npm install -g <plugin-name>`
4. Create the `config.json` file.
Expand Down Expand Up @@ -103,7 +104,7 @@ Homebridge is now ready to receive commands from iOS.

## Installing Plugins

Plugins are NodeJS modules published through NPM and tagged with the keyword `homebridge-plugin`. They must have a name with the prefix `homebridge-`, like **homebridge-mysmartlock**.
Plugins are Node.js modules published through NPM and tagged with the keyword `homebridge-plugin`. They must have a name with the prefix `homebridge-`, like **homebridge-mysmartlock**.

Plugins can publish Accessories and/or Platforms. Accessories are individual devices, like a smart switch or a garage door. Platforms act like a single device but can expose a set of devices, like a house full of smart lightbulbs.

Expand All @@ -117,13 +118,13 @@ You can explore all available plugins at the NPM website by [searching for the k

## Adding Homebridge to iOS

HomeKit itself is actually not an app; it's a "database" similar to HealthKit and PassKit. Where HealthKit has the companion _Health_ app and PassKit has the _Wallet_ app, HomeKit has the _Home_ app, introduced with iOS 10.
1. Open the Home <img src="https://user-images.githubusercontent.com/3979615/78010622-4ea1d380-738e-11ea-8a17-e6a465eeec35.png" height="16.42px"> app on your device.
2. Tap the Home tab, then tap <img src="https://user-images.githubusercontent.com/3979615/78010869-9aed1380-738e-11ea-9644-9f46b3633026.png" height="16.42px">.
3. Tap *Add Accessory*, then scan the QR code shown in the Homebridge UI or your Homebridge logs.

If you are a member of the iOS developer program, you might also find Apple's [HomeKit Catalog](https://developer.apple.com/library/ios/samplecode/HomeKitCatalog/Introduction/Intro.html) app to be useful, as it provides straightforward and comprehensive management of all HomeKit database "objects".
If the bridge does not have any accessories yet, you may receive a message saying *Additional Set-up Required*, this is ok, as you add plugins they will show up in the Home app without the need to pair again (except for Cameras and TVs).

Using the Home app, or most other HomeKit apps, you should be able to add the single accessory "Homebridge", assuming that you're still running Homebridge and you're on the same Wifi network. Adding this accessory will automatically add all accessories and platforms defined in `config.json`.

When you attempt to add Homebridge, it will ask for a "PIN code". The default code is `031-45-154` (but this can be changed, see `config-sample.json`).
Cameras and most TV devices are exposed as separate accessories and each needs to be paired separately. See [this wiki article](https://github.com/homebridge/homebridge/wiki/Connecting-Homebridge-To-HomeKit#how-to-add-homebridge-cameras--tvs) for instructions.

## Interacting with your Devices

Expand All @@ -139,9 +140,7 @@ There are two basic types of plugins:
* Single accessories: controls, for example, a single light bulb.
* Platform accessories: a "meta" accessory that controls many sub-accessories. For example, a bridge that translates to many other devices on a specialized channel.

There are many existing plugins you can study; you might start with the included [Example Plugins](https://github.com/homebridge/homebridge/tree/master/example-plugins). Right now this contains a single plugin that registers a platform that offers fake light accessories. This is a good example of how to use the Homebridge Plugin API. You can also find an example plugin that [publishes an individual accessory](https://github.com/homebridge/homebridge/tree/6500912f54a70ff479e63e2b72760ab589fa558a/example-plugins/homebridge-lockitron).

For more example on how to construct HomeKit Services and Characteristics, see the many Accessories in the [Legacy Plugins](https://github.com/nfarina/homebridge-legacy-plugins/tree/master/accessories) repository.
There are many existing plugins you can study; you might start with the [Homebridge Example Plugins](https://github.com/homebridge/homebridge-examples). The [Homebridge Plugin Template](https://github.com/homebridge/homebridge-plugin-template) project also provides a base you can use to create your own *platform* plugin.

You can also view the [full list of supported HomeKit Services and Characteristics in the HAP-NodeJS protocol repository](https://github.com/KhaosT/HAP-NodeJS/blob/master/src/lib/gen/HomeKit.ts).

Expand All @@ -155,16 +154,27 @@ Check out the [`homebridge-tesla`](https://github.com/nfarina/homebridge-tesla)

## Plugin Development

When writing your plugin, you'll want Homebridge to load it from your development directory instead of publishing it to `npm` each time. You can tell Homebridge to look for your plugin at a specific location using the command-line parameter `-P`. For example, if you are in the Homebridge directory (as checked out from Github), you might type:
When writing your plugin, you'll want Homebridge to load it from your development directory instead of publishing it to `npm` each time.

Run this command inside your plugin project folder so your global install of Homebridge can discover it:


```shell
npm link
```

*You can undo this using the `npm unlink` command.*

Then start Homebridge in debug mode:

```shell
DEBUG=* ./bin/homebridge -D -P ../my-great-plugin/
homebridge -D
```

This will start up Homebridge and load your in-development plugin from a nearby directory. Note that you can also direct Homebridge to load your configuration from somewhere besides the default `~/.homebridge`, for example:
This will start up Homebridge and load your in-development plugin. Note that you can also direct Homebridge to load your configuration from somewhere besides the default `~/.homebridge`, for example:

```shell
DEBUG=* ./bin/homebridge -D -U ~/.homebridge-dev -P ../my-great-plugin/
homebridge -D -U ~/.homebridge-dev
```

This is very useful when you are already using your development machine to host a "real" Homebridge instance (with all your accessories) that you don't want to disturb.
Expand Down
12 changes: 6 additions & 6 deletions bin/homebridge
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
// This executable sets up the environment and runs the HomeBridge CLI.
//

'use strict';
"use strict";

process.title = 'homebridge';
process.title = "homebridge";

// Find the HomeBridge lib
var path = require('path');
var fs = require('fs');
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
const path = require("path");
const fs = require("fs");
const lib = path.join(path.dirname(fs.realpathSync(__filename)), "../lib");

// Run HomeBridge
require(lib + '/cli')();
require(lib + '/cli')();
Loading

0 comments on commit 34f18ff

Please sign in to comment.