mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
Basic info on writing plugins
This commit is contained in:
14
README.md
14
README.md
@@ -97,6 +97,20 @@ Once your device has been added to HomeKit, you should be able to tell Siri to c
|
||||
|
||||
One final thing to remember is that Siri will almost always prefer its default phrase handling over HomeKit devices. For instance, if you name your Sonos device "Radio" and try saying "Siri, turn on the Radio" then Siri will probably start playing an iTunes Radio station on your phone. Even if you name it "Sonos" and say "Siri, turn on the Sonos", Siri will probably just launch the Sonos app instead. This is why, for instance, the suggested `name` for the Sonos accessory is "Speakers".
|
||||
|
||||
# Writing Plugins
|
||||
|
||||
We don't have a lot of documentation right now for creating plugins, but there are many existing plugins you can study.
|
||||
|
||||
The best place to start is the included [Example Plugins](tree/master/example-plugins). Right now this contains a single plugin that registers a fake door lock Accessory. This will show you how to use the Homebridge Plugin API.
|
||||
|
||||
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 isn't currently an example for how to publish a Platform (which allows the user to bridge many discovered devices at once, like a house full of smart lightbulbs), but the process is almost identical to registering an Accessory. Simply modify the example `index.js` in [homebridge-lockitron](tree/master/example-plugins/homebridge-lockitron) to say something like:
|
||||
|
||||
homebridge.registerPlatform("homebridge-myplugin", "MyPlatform", MyPlatform);
|
||||
|
||||
See more examples on how to create Platform classes in the [Legacy Plugins](https://github.com/nfarina/homebridge-legacy-plugins/tree/master/platforms) repository.
|
||||
|
||||
# Why?
|
||||
|
||||
Technically, the device manufacturers should be the ones implementing the HomeKit API. And I'm sure they will - eventually. When they do, this project will be obsolete, and I hope that happens soon. In the meantime, Homebridge is a fun way to get a taste of the future, for those who just can't bear to wait until "real" HomeKit devices are on the market.
|
||||
|
||||
Reference in New Issue
Block a user