homebridge-tuya-web icon indicating copy to clipboard operation
homebridge-tuya-web copied to clipboard

Fan - Setting RotationSpeed

Open CameronSmith93 opened this issue 3 years ago • 13 comments

Device type

Stirling FS1-40DCWIFI Pedestal Fan

Device information

{   u'header': {   u'code': u'SUCCESS', u'payloadVersion': 1},
    u'payload': {   u'devices': [   {   u'data': {   u'online': True,
                                                     u'speed': u'3',
                                                     u'speed_level': 15,
                                                     u'state': u'false'},
                                        u'dev_type': u'fan',
                                        u'ha_type': u'fan',
                                        u'icon': u'https://images.tuyaeu.com/smart/icon/bay1589359175993MeEh/159540337782efe7f8e63.jpg',
                                        u'id': u'<redacted>',
                                        u'name': u'FS1-40DCWIFI'}],
                    u'scenes': []}}

Issue

Toggling on/off the fan via HomeKit works correctly. However, when setting any rotation speed, the fan shows a speed of '00' on the physical display and stops rotating.

Setting the rotation speed via the TuyaSmart app works correctly.

Let me know what else I can provide to assist in diagnosing the issue.

CameronSmith93 avatar Nov 05 '20 00:11 CameronSmith93

Hey! Thank you for opening an issue.

In your logs you should be able to find some log lines that look something like the following

[device_name] Characteristic.RotationSpeed [SET] xxxx xxxx

Could you please provide me with your log after you set the rotation speed, then I can see what values are being transmitted and see what goes wrong there.

milo526 avatar Nov 05 '20 07:11 milo526

Thanks for looking into this! Here are some values I've triggered just now:

[11/6/2020, 10:25:13] [TuyaWebPlatform] [FS1-40DCWIFI] Characteristic.RotationSpeed - [SET] 24 4
[11/6/2020, 10:25:13] [TuyaWebPlatform] [FS1-40DCWIFI] Characteristic.Active - [SET] 1 1
[11/6/2020, 10:25:15] [TuyaWebPlatform] [FS1-40DCWIFI] Characteristic.RotationSpeed - [SET] 30 5
[11/6/2020, 10:25:15] [TuyaWebPlatform] [FS1-40DCWIFI] Characteristic.Active - [SET] 1 1
[11/6/2020, 10:25:17] [TuyaWebPlatform] [FS1-40DCWIFI] Characteristic.Active - [SET] 1 1
[11/6/2020, 10:25:17] [TuyaWebPlatform] [FS1-40DCWIFI] Characteristic.RotationSpeed - [SET] 36 6
[11/6/2020, 10:25:20] [TuyaWebPlatform] [FS1-40DCWIFI] Characteristic.Active - [SET] 1 1
[11/6/2020, 10:25:20] [TuyaWebPlatform] [FS1-40DCWIFI] Characteristic.RotationSpeed - [SET] 24 4
[11/6/2020, 10:25:21] [TuyaWebPlatform] [FS1-40DCWIFI] Characteristic.Active - [SET] 1 1
[11/6/2020, 10:25:21] [TuyaWebPlatform] [FS1-40DCWIFI] Characteristic.RotationSpeed - [SET] 18 3
[11/6/2020, 10:25:28] [TuyaWebPlatform] [FS1-40DCWIFI] Characteristic.Active - [SET] 0 0

Edit: Just for clarification, it's a 15-speed fan.

CameronSmith93 avatar Nov 05 '20 23:11 CameronSmith93

I have no clue what the problem is here. It seems like the plugin is sending very reasonable values, I've tried it with my fan and that one works fine.

milo526 avatar Nov 12 '20 16:11 milo526

Yes, very strange indeed.

Is there anything that I can provide you with to assist with a diagnosis? Packet or request/response capture of working traffic from the Tuya app?

CameronSmith93 avatar Nov 21 '20 12:11 CameronSmith93

I cannot reproduce this issue and at the moment do not have the time to debug this with you sadly.

I would love for somebody to be able to submit a PR for this.

milo526 avatar Nov 27 '20 09:11 milo526

I've got a very similar problem. I've also submitted an issue for this.

patrickl96 avatar Dec 09 '20 03:12 patrickl96

I have a similar issue with my fan. For my fan, it looks like maybe the speeds are not set by percentage, but simply enumerated. My fan has three speeds. When I set it to the medium speed in the Smart Life app, I see this in the HomeBridge logs:

[05/03/2021, 00:03:28] [TuyaWebPlatform] [Ceiling Fan] Characteristic.Active - [GET] true
[05/03/2021, 00:03:28] [TuyaWebPlatform] [Ceiling Fan] Characteristic.RotationSpeed - [GET] 2

BobbyLindsey avatar Mar 05 '21 05:03 BobbyLindsey

Also, on startup, it seems to indicate the number of speeds; three in my case:

[05/03/2021, 00:11:16] [TuyaWebPlatform] [Ceiling Fan] deviceConfig: {
  data: { online: true, state: 'false', speed_level: 3, speed: '2' },
  name: 'Ceiling Fan',
  icon: 'https://images.tuyaus.com/smart/icon/ay1566306500214Y6P2j/15856618854f216b2db9c.png',
  id: 'removed',
  dev_type: 'fan',
  ha_type: 'fan'
}

BobbyLindsey avatar Mar 05 '21 05:03 BobbyLindsey

I guess there is a rounding error somewhere. I'm strongly contemplating moving away from percentage based device control and instead move back to level based control thus only allowing you to select steps 0 (off), 1, 2, ... up til the max your device supports.

milo526 avatar Mar 06 '21 12:03 milo526

I'm inclined to agree with the suggestion of it being a rounding error - incrementing the speed on my 15-speed fan increases the percentage display by 6%, for a max speed displayed of 90% rather than 100%.

Looking forward to level based control if/when you have the time to make the change!

CameronSmith93 avatar Mar 14 '21 04:03 CameronSmith93

Any word on if/when this change to fan levels, rather than percentages may occur?

Thank you

pcm1ke avatar Sep 21 '21 06:09 pcm1ke

No updates at the moment.

milo526 avatar Oct 04 '21 08:10 milo526