howanghk / homebridge-ewelink

Homebridge plugin to control Sonoff relays with OEM firmware
MIT License
81 stars 46 forks source link

Re-add the missing Fan Device Type Channels #30

Closed JangoBritt closed 4 years ago

JangoBritt commented 5 years ago

There was a disparity between the howanghk master branch, and the MrTomAsh master branch that was missing the Device Type Channels for devices including the iFan02.

I've re-merged them, and tested. This displays as 4 channels in HomeKit, CH1 for light, and CH2-4 for the three speed settings of the fan.

Obviously this is quick and dirty implementation, and I'd prefer to present a proper Fan device type made up of the three channels (OFF/33%/66%/100%). As it is, it appears as extra device tiles.

This at least resolved the problems of the device appearing offline

JangoBritt commented 5 years ago

what's weird though, is that CH2 appears as the Power/Low setting, CH3 is Med, but also requires CH2 ON. CH4 is High, but requires CH2 ON, and CH3 OFF.

so: Light Off = 0 x x x Light On = 1 x x x Fan Off = x 0 0 0 Fan Low = x 1 0 0 Fan med = x 1 1 0 Fan High = x 1 0 1

howanghk commented 5 years ago

Hi @JangoBritt, the code in this PR should be not necessary for it to work. As the "switchAmount" is obtained from the uiid, instead of hardcoding base on model. The uiid and channel count information were extracted from the official ewelink app. If the iFan is not working as intended, would you dump the content of platform.devicesFromApi on line 120 in index.js and post it here? The information should be useful for debugging.

platform.log("devicesFromApi = %s", JSON.stringify(platform.devicesFromApi));
JangoBritt commented 5 years ago

Honestly, I just cut & pasted from the other repo, and it started working.

Are you saying to add that command at 120 and run it? Which file is that going to log to, homebridge.log, or Homebridge.err?

Sent with GitHawk

howanghk commented 5 years ago

Yes, the log should go to stdout, I guess it's the .log file in your case.

bassrock commented 4 years ago

@howanghk I'm having the same issue. Happy to help debug

howanghk commented 4 years ago

Fan support have been added by bassrock in https://github.com/howanghk/homebridge-ewelink/pull/57 and released in version 0.1.18, please install the latest version with

npm install -g homebridge-ewelink-max@latest