Skip to content

Commit

Permalink
Accessory must have a name to work in Homebridge.
Browse files Browse the repository at this point in the history
  • Loading branch information
seikan committed May 20, 2017
1 parent 5890e9e commit c444f68
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ This is Xiaomi Mi Air Purifier plugin for [Homebridge](https://github.com/nfarin
```
"accessories": [
{
"accessory": "MiAirPurifier"
"accessory": "MiAirPurifier",
"name": "Air Purifier"
}
]
```
Expand Down
1 change: 1 addition & 0 deletions example.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"accessories": [
{
"accessory": "MiAirPurifier",
"name": "Air Purifier"
}
]
}
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ module.exports = function(homebridge) {

function MiAirPurifier(log, config) {
this.log = log;
this.name = config.name || 'Air Purifier';

this.modes = [
[0, 'idle'], [40, 'silent'], [60, 'auto'], [80, 'low'], [100, 'medium']
];

// Air purifier is not available in Homekit yet, use as fan for now
this.fanService = new Service.Fan('Air Purifier');
this.fanService = new Service.Fan(this.name);

// Register another service as air quality sensor
this.airQualitySensorService = new Service.AirQualitySensor('Air Quality');
this.airQualitySensorService = new Service.AirQualitySensor(this.name);

this.serviceInfo = new Service.AccessoryInformation();

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-mi-air-purifier",
"version": "1.0.0",
"version": "1.0.1",
"description": "Xiaomi Mi air purifier plugin for Homebridge.",
"license": "MIT",
"keywords": [
Expand Down

0 comments on commit c444f68

Please sign in to comment.