Hello, I at home you do a little change in the plug-in can be correctly identified as IOS 11 air purifier, correct response work and operation can get equipment, but I have no basis in this field, now is not the right power state feedback, interface button state home.app update is not correct no, do not know if you have time and plan for an upgrade to your this great plugin
The following is my modified version of index.js may have many unreasonable places, laughed————————————————————————
var miio = require('miio');
var Accessory, Service, Characteristic;
var devices = [];
if(!this.ip)
throw new Error('Your must provide IP address of the airpurifier.');
if(!this.token)
throw new Error('Your must provide token of the airpurifier.');
this.services = [];
// Modes supported
this.modes = [
[0, 'idle'], [60, 'auto'], [80, 'silent'], [100, 'favorite']
];
// Air purifier is not available in Homekit yet, register as Fan
this.AirPurifierService = new Service.AirPurifier(this.name);
this.AirPurifierService
.getCharacteristic(Characteristic.Active)
.on('get', this.getPowerState.bind(this))
.on('set', this.setPowerState.bind(this));
this.AirPurifierService
.getCharacteristic(Characteristic.RotationSpeed)
.on('get', this.getRotationSpeed.bind(this))
.on('set', this.setRotationSpeed.bind(this));
this.services.push(this.AirPurifierService);
this.serviceInfo = new Service.AccessoryInformation();
this.serviceInfo
.setCharacteristic(Characteristic.Manufacturer, 'Xiaomi')
.setCharacteristic(Characteristic.Model, 'Air Purifier');
this.services.push(this.serviceInfo);
if(this.showAirQuality){
this.airQualitySensorService = new Service.AirQualitySensor('Air Quality Sensor');
this.airQualitySensorService
.getCharacteristic(Characteristic.AirQuality)
.on('get', this.getAirQuality.bind(this));
this.services.push(this.airQualitySensorService);
}
if(this.showTemperature){
this.temperatureSensorService = new Service.TemperatureSensor('Temperature');
this.temperatureSensorService
.getCharacteristic(Characteristic.CurrentTemperature)
.on('get', this.getCurrentTemperature.bind(this));
this.services.push(this.temperatureSensorService);
}
if(this.showHumidity){
this.humiditySensorService = new Service.HumiditySensor('Humidity');
this.humiditySensorService
.getCharacteristic(Characteristic.CurrentRelativeHumidity)
.on('get', this.getCurrentRelativeHumidity.bind(this));
this.services.push(this.humiditySensorService);
}
this.discover();
}
MiAirPurifier.prototype = {
discover: function(){
var accessory = this;
var log = this.log;
log.debug('Discovering Mi air purifier devices...');
Hello, I at home you do a little change in the plug-in can be correctly identified as IOS 11 air purifier, correct response work and operation can get equipment, but I have no basis in this field, now is not the right power state feedback, interface button state home.app update is not correct no, do not know if you have time and plan for an upgrade to your this great plugin
The following is my modified version of index.js may have many unreasonable places, laughed————————————————————————
var miio = require('miio'); var Accessory, Service, Characteristic; var devices = [];
module.exports = function(homebridge) { Accessory = homebridge.platformAccessory; Service = homebridge.hap.Service; Characteristic = homebridge.hap.Characteristic;
}
function MiAirPurifier(log, config) { this.log = log; this.name = config.name || 'Air Purifier'; this.showAirQuality = config.showAirQuality || false; this.showTemperature = config.showTemperature || false; this.showHumidity = config.showTemperature || false; this.ip = config.ip; this.token = config.token; this.device = null;
}
MiAirPurifier.prototype = { discover: function(){ var accessory = this; var log = this.log;
this.device = miio.createDevice({ address: this.ip, token: this.token, model: 'zhimi.airpurifier.m1' });
};