tonesto7 / homebridge-smartthings

SmartThings Homebridge Plugin
385 stars 767 forks source link

(BUG) Fan reads 0% while running #326

Open danielhopkins opened 4 years ago

danielhopkins commented 4 years ago

(Moved from the old project)

How many devices are detected?: 9 Mobile App Version(Not required): iOS 13.5 SmartApp Version: 2.3.3 Device Handler Version: ?? not sure what this is Homebridge Version: 1.0.4 NodeJS Version: 12.6.1

Expected Behavior

I have a modern forms house fan connected to smartthings and then bridged to homekit through homebridge. While the fan can be turned on and off through the app it always says that it’s at 0% speed.

Current Behavior

Always shows as 0% speed.

Context

Trying to control the fan in my living room.

I’m not sure at which logs to look at? Homebridge? Smarthings?

Sorry this isn’t that good of information, I’m not sure where to start debugging this.

jonnyborbs commented 4 years ago

I've got this same issue and it seems to be an issue with alignment of the FANSPEED and LEVEL settings.

I control my 3-speed fans using both Alexa and SmartThings currently and the default DTH in SmartThings sets the steps as follows:

FANSPEED 0 = LEVEL 0 FANSPEED 1 = LEVEL 32 FANSPEED 2 = LEVEL 66 FANSPEED 3 = LEVEL 100

The problem is that the homebridge-SmartThings plugin sets a threshold of FANSPEED 1 = LEVEL 33

This means that at the DTH's FANSPEED 1 setting, the LEVEL is 32 and HomeBridge/HomeKit register it as a FANSPEED 0 instead, hence showing at 0% while still spinning.

It also means that if you set the fan's speed to "LOW" (FANSPEED 1) in HomeKit, the DTH will get a LEVEL setting of 33 and actually be running at "MEDIUM" (FANSPEED 2)

Should be easily fixed... would love to see it happen!

jfsteele commented 3 years ago

Saw similar (would set to "low" via Home, it sends 33, and actually sets the fan to "medium"). This fixed it: file ST_Transforms.js: in fanSpeedLevelToInt: lines 471 and 473: change 33 to 34

file ST_DeviceCharacteristics.js: line 269: if (_accessory.hasDeviceFlag('fan_3_spd')) spdSteps = 33 change 33 to 32

Everything seems to be happy with those tweaks. It seems that there's 2 issues, 1) ST_Transforms says that 33 is "medium" (hence the change from 33 to 34), and 2) the 3-speed step is 33, which seems to trigger my GE fans to go to medium. I noticed that ST sends 32, so adjusted the step. All 3 speeds work correctly now.

jonnyborbs commented 3 years ago

Saw similar (would set to "low" via Home, it sends 33, and actually sets the fan to "medium"). This fixed it:

file ST_Transforms.js:

in fanSpeedLevelToInt:

    lines 471 and 473: change 33 to 34

file ST_DeviceCharacteristics.js:

line 269: if (_accessory.hasDeviceFlag('fan_3_spd')) spdSteps = 33

    change 33 to 32

Everything seems to be happy with those tweaks. It seems that there's 2 issues, 1) ST_Transforms says that 33 is "medium" (hence the change from 33 to 34), and 2) the 3-speed step is 33, which seems to trigger my GE fans to go to medium. I noticed that ST sends 32, so adjusted the step. All 3 speeds work correctly now.

That's fantastic! I wonder if you open a PR with these changes if @tonesto7 would just merge it? I'd prefer not to branch off of the default repo if I could avoid it, to keep updates current going forward.

jfsteele commented 3 years ago

Thanks for handling the PR. Family emergency, wasn't where I could.. Hope he accepts it!

jonnyborbs commented 3 years ago

Thanks for handling the PR. Family emergency, wasn't where I could.. Hope he accepts it!

Of course! Hope all is well, I just happened to have the time to make the commits.