Skip to content

Commit

Permalink
fix extra fan accessory issue
Browse files Browse the repository at this point in the history
  • Loading branch information
howanghk committed Jun 8, 2020
1 parent 557dbd7 commit 11c9273
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function eWeLink(log, config, api) {
platform.log('Group type error ! Device [%s], ID : [%s] will not be added', deviceToAdd.name, deviceToAdd.deviceid);
break;
}
} else if (deviceToAdd.extra.extra.model === "PSF-BFB-GL" || deviceToAdd.extra.extra.model === "PSF-B04-GL") {
} else if (deviceToAdd.extra.extra.model === "PSF-BFB-GL") {
services.fan = true;
services.switch = false;
platform.log('Device [%s], ID : [%s] will be added as a fan', deviceToAdd.name, deviceToAdd.deviceid);
Expand Down Expand Up @@ -960,11 +960,11 @@ eWeLink.prototype.updateFanLightCharacteristic = function (deviceId, state, devi

let accessory = platform.accessories.get(deviceId);

if (typeof accessory === 'undefined' && device) {
platform.log("Adding accessory for deviceId [%s].", deviceId);
platform.addAccessory(device, deviceId, {'fan': true});
accessory = platform.accessories.get(deviceId);
}
// if (typeof accessory === 'undefined' && device) {
// platform.log("Adding accessory for deviceId [%s].", deviceId);
// platform.addAccessory(device, deviceId);
// accessory = platform.accessories.get(deviceId);
// }

if (!accessory) {
platform.log("Error updating non-exist accessory with deviceId [%s].", deviceId);
Expand Down Expand Up @@ -993,11 +993,11 @@ eWeLink.prototype.updateFanSpeedCharacteristic = function (deviceId, state1, sta

let accessory = platform.accessories.get(deviceId);

if (typeof accessory === 'undefined' && device) {
platform.log("Adding accessory for deviceId [%s].", deviceId);
platform.addAccessory(device, deviceId, {'fan': true});
accessory = platform.accessories.get(deviceId);
}
// if (typeof accessory === 'undefined' && device) {
// platform.log("Adding accessory for deviceId [%s].", deviceId);
// platform.addAccessory(device, deviceId);
// accessory = platform.accessories.get(deviceId);
// }

if (!accessory) {
platform.log("Error updating non-exist accessory with deviceId [%s].", deviceId);
Expand Down

0 comments on commit 11c9273

Please sign in to comment.