iRayanKhan / homebridge-tuya

A Homebridge plugin to control Tuya devices locally.
MIT License
392 stars 164 forks source link

Deta Grid Connect Smart Fan Controller CFR225HA #369

Open RayNixon665 opened 2 years ago

RayNixon665 commented 2 years ago

Checklist

Describe the bug

        "name": "My Fan",
        "type": "FanLight",
        "id": "xxx,
        "key": "xxx,
        "manufacturer": "Arlec",
        "model": "Arlec Grid",
        "maxSpeed": 3,
        "dpRotationSpeed": "3",
        "useBrightness": "False",
        "dpLightOn": "15"

Fan on works. Fan off works. Fan will not change speed.

I'm using a stand alone, off the shelf smart controller. Its a Deta Grid Connect unit, designed to convert a standard fan to Grid Connect.

I believe the fan speed update function not working because the command that is sent to the fan, is being sent as a string, rather than an integer.

for example.

[Tuya] Sending My Fan {"1":true} [Tuya] Sending My Fan {"3":"1"} // looks like a string is being sent. but [Tuya] SimpleFanLight changed: {"1":true,"3":1,"15":false,"22":"cancel"} // looks like the returned value is an integer?

When the following commands are sent, looks like error is returned? and no physical state change of the fan [Tuya] Sending My Fan {"1":true} [Tuya] Sending My Fan {"3":"2"} [Tuya] Heard back from My Fan with command 8

To Reproduce iphone, home kit, turn fan on, and flick though the 3 available speeds. same issue occurs when chageing speed under the homebridge ui

Expected behavior fan speed should change

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional context Light works. data points are correct as per tuya web api. device has no dimmer. device functions, fan (3 speed). (fan timer) and light on off. everything great but fan speed.

RayNixon665 commented 2 years ago

Im new to GitHub, but, i did manage to fork my own version of this add in. make the change and got this accessory working.

i changed SimpleFanLightAccessory.js from return this.setState(this.dpRotationSpeed, value.toString(), callback); to return this.setState(this.dpRotationSpeed, value, callback);

of course this might break other devices. and not sure how to implement correctly.

but my theory has been proven in my case for this particular device.

Madz75 commented 2 years ago

Have you had any more luck with your settings? Are you able to control brightness? It's possible you're creating a string because you have quotation marks around your rotation speed setting. Try removing those.

05TEVE commented 1 year ago

Hi, I have raised https://github.com/iRayanKhan/homebridge-tuya/pull/403 to fix this bug. The issue is being caused by the setActive and setSpeed being called at the same time. Once i made this change the fans have behaved much more consistently.

My Fan settings are as follows.

"name": "Fan Name",
"type": "FanLight",
"manufacturer": "Deta",
"model": "3 Speed Fan Controller",
"id": "XXXX",
"key": "XXXXX",
"maxSpeed": 3,
"useBrightness": false,