iRayanKhan / homebridge-tuya

A Homebridge plugin to control Tuya devices locally.
MIT License
395 stars 165 forks source link

Updating FanController logic to merge the setSpeed and SetActive functions #403

Closed 05TEVE closed 8 months ago

05TEVE commented 1 year ago

Removing the standalone setActive function that turns the fan on and instead sing the SetMultiState function to turn the fan on when it sets the speed.

Some Fan Controllers like the DETA 3 Speed Fan Controller with Light default to a particular speed when it is turned on. The existing logic sets the fan to active and then sets the speed. This causes a clash as the response from the switch turning the fan on will sets the speed to 3 and override the subsequent update speed call. This change fixes that by ensuring that only one call is made to turn the fan on and set the rotation speed.

05TEVE commented 1 year ago

@iRayanKhan is there anything else required to have this PR merged?

xrust83 commented 1 year ago

Pay attention to the date of the lasting update of the plugin, March 25, 2021. It's easier to make a branch at all and make your own branch.

05TEVE commented 1 year ago

@xrust83, It would be good to try avoid building another parallel version of the plugin here if possible. There have been minor PRs merged recently however as you state there are no version bumps. It would be great to be able to fix some of the simple issues and get a new version out there.

michael-j-green commented 1 year ago

I agree with @05TEVE. Unless @iRayanKhan has abandoned this project, I suggest we keep moving forward with this one.

There's already a crazy number of forks in different stages of completeness.

However, as I suggested on another issue, if @iRayanKhan is not available to continue (due to sickness, work, or just needs a break), it would be fantastic if he could add someone else to the project to commit those PR's.

Edit: was also thinking that many users using HomeBridge are using this repo rather than one of the many other forks. It would be a smoother update for those users for this repo to be updated rather than asking them to migrate to a new plugin.

badbubblegum commented 1 year ago

@05TEVE great work on these files, could not get the fan speed control working properly at all until I stumbled upon this. The only issue I have now is that I cannot switch fan on/off with Siri voice commands or by touching the button in the home app. It does turn on/off however when using the slider control when the home tile is open. Have you found a way around this?

05TEVE commented 1 year ago

@05TEVE great work on these files, could not get the fan speed control working properly at all until I stumbled upon this. The only issue I have now is that I cannot switch fan on/off with Siri voice commands or by touching the button in the home app. It does turn on/off however when using the slider control when the home tile is open. Have you found a way around this?

Hi, I have pushed a fix that seems to work on my devices. I also added a default speed variable so that the fan starts on speed 1 as my DETA switches have an annoying habit of starting at full speed every time.

It could probably do with a bit of refactoring, but should do the job.

badbubblegum commented 1 year ago

@05TEVE great work on these files, could not get the fan speed control working properly at all until I stumbled upon this. The only issue I have now is that I cannot switch fan on/off with Siri voice commands or by touching the button in the home app. It does turn on/off however when using the slider control when the home tile is open. Have you found a way around this?

Hi, I have pushed a fix that seems to work on my devices. I also added a default speed variable so that the fan starts on speed 1 as my DETA switches have an annoying habit of starting at full speed every time.

It could probably do with a bit of refactoring, but should do the job.

Hi, Just updated and your fix works like a charm. Will report if I find any issues but great work and thanks!

scooterpsu commented 1 year ago

Just wanted to say thanks for this. After updating to IOS 17 the separate commands were firing more often and actually conflicting a couple times and I was legitimately worried my controller would burn out.