2.0.0-beta.4 • Published 4 years ago

homebridge-ts-helper v2.0.0-beta.4

Weekly downloads
5
License
MIT
Repository
-
Last release
4 years ago

homebridge-ts-helper

This is a small repository that provides interfaces for writing code for homebridge in Typescript. At the moment this is only the abstract class HomebridgeAccessory and the two interfaces HomebridgeApi and IAccessoryConfig.

How do I use this?

Well, start by turning your homebridge plugin into a Typescript project, and then add this project as dependency.

npm i typescript @types/node --save-dev
npm i homebridge-ts-helper --save-dev

You can then write your plugin like this

export default (homebridge: HomebridgeApi): void => {
    homebridgeService = homebridge.hap.Service;

    homebridge.registerAccessory('homebridge-my-amazing-plugin', 'my-amazing-plugin', MyPlugin);
};

class MyPlugin extends HomebridgeAccessory {
}

For further questions have a look at either the official reference repo for typescript plugins or my other project

Contributions / Suggestions

They are always welcome, anything that makes homebridge better. Note: I am using hap-nodejs in version ^0.4.53 because that is the version that homebridge uses at the moment. With ^0.5.0 nfarina has extended the typing and I would like to switch to this version. However, there appears to be something wrong with either the types for services or the way apparently every call to the constructor in homebridge plugins happens. So be careful here.

2.0.0-beta.4

4 years ago

2.0.0-beta.2

4 years ago

2.0.0-beta.1

4 years ago

2.0.0-beta.0

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago