tuya / tuya-home-assistant

Home Assistant integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, maintained by the Home Assistant Community and Tuya Developer Team.
MIT License
874 stars 206 forks source link

Fan is showing up but no controls available including on/off or fan speed #100

Open sajid2310 opened 3 years ago

sajid2310 commented 3 years ago

Existing Tuya integration detect FAN as a switch but no Fan Speed control but tuya v2 does detect but no control for Fan Turn on/off or Fan Speed

Device normal info

Device info (please complete the following information, which can be found in [log]()): like this: { "active_time": 1624690956, "biz_type": 18, "category": "fs", "create_time": 1624690956, "icon": "smart/icon/ay1555587406780sSPrA/d47e62f529234826a9b4c5be7c26efb9.png", "id": "eba3fa0e92623b3535t31u", "ip": "xxx.xxx.xxx.xxx", "lat": "xxxxxxxxxxxxx", "local_key": "3a1afef8ee34355c", "lon": "xxxxxxxxxxxx", "name": "Fan Pantry HM4", "online": true, "owner_id": "22586758", "product_id": "vv2ulpgrr1faptiz", "product_name": "Touch Fan Regulator WB", "status": [ { "code": "switch", "value": false }, { "code": "fan_speed_percent", "value": 1 } ], "sub": false, "time_zone": "+05:30", "uid": "az1599543442118VT26q", "update_time": 1625574081, "uuid": "188be4bb94e2aeff" }

Device specifications (please complete the following information, which can be found in log): Same device's id, like this: 2021-07-06 17:57:50 DEBUG (SyncWorker_1) [tuya iot] Request: method = GET, url = https://openapi.tuyaus.com/v1.0/devices/eba3fa0e92623b3535t31u/specifications, params = None, body = None, headers = {'client_id': '5efushdkaoaicowimadn', 'sign': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'sign_method': 'HMAC-SHA256', 'access_token': 'xxxxxxxxxxxxxxxxx', 't': '1625574470310', 'lang': 'en'}

tsutsuku commented 3 years ago

@sajid2310 Can you provide more logs?

sajid2310 commented 3 years ago

Additional logs - These are the only ones i can find referencing the device ID. Is there additional config needed in config.yaml?

2021-07-06 17:57:50 DEBUG (SyncWorker_1) [tuya iot] Request: method = GET, url = https://openapi.tuyaus.com/v1.0/devices/eba3fa0e92623b3535t31u/specifications, params = None, body = None, headers = {'client_id': '5efushdkaoaicowimadn', 'sign': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'sign_method': 'HMAC-SHA256', 'access_token':

2021-07-06 17:57:52 INFO (MainThread) [custom_components.tuya_v2.fan] fan add-> ['eba3fa0e92623b3535t31u', 'ebfb352d3fdd63561cktva', 'eb454a5c74c3e9999edsdy', 'eb273ca59d38347643cl9y', '5723104550029165e69d']

2021-07-06 18:01:22 DEBUG (Thread-5) [tuya iot] on_message: {'data': {'bizCode': 'online', 'bizData': {'time': 1625574682}, 'devId': 'eba3fa0e92623b3535t31u', 'productKey': 'vv2ulpgrr1faptiz', 'ts': 0}, 'protocol': 20, 'pv': '2.0', 'sign': 'c9a67f5cfd18b64b06c8b5c9e3455056', 't': 1625574682} 2021-07-06 18:01:22 DEBUG (Thread-5) [tuya iot] mq receive-> {'data': {'bizCode': 'online', 'bizData': {'time': 1625574682}, 'devId': 'eba3fa0e92623b3535t31u', 'productKey': 'vv2ulpgrr1faptiz', 'ts': 0}, 'protocol': 20, 'pv': '2.0', 'sign': 'c9a67f5cfd18b64b06c8b5c9e3455056', 't': 1625574682} 2021-07-06 18:01:22 DEBUG (Thread-5) [tuya iot] mq _on_device_other-> eba3fa0e92623b3535t31u -- online

2021-07-06 18:01:25 DEBUG (Thread-5) [tuya iot] on_message: {'data': {'dataId': 'f7e73d0a-ca1d-43b3-a611-aa2341c1bbfb', 'devId': 'eba3fa0e92623b3535t31u', 'productKey': 'vv2ulpgrr1faptiz', 'status': [{'1': False, 'code': 'switch', 't': '10', 'value': False}, {'3': 1, 'code': 'fan_speed_percent', 't': '10', 'value': 1}, {'14': False}]}, 'protocol': 4, 'pv': '2.0', 'sign': '221f621e44802bf32f39fe10bd40723c', 't': 10}

2021-07-06 18:01:25 DEBUG (Thread-5) [tuya iot] mq receive-> {'data': {'dataId': 'f7e73d0a-ca1d-43b3-a611-aa2341c1bbfb', 'devId': 'eba3fa0e92623b3535t31u', 'productKey': 'vv2ulpgrr1faptiz', 'status': [{'1': False, 'code': 'switch', 't': '10', 'value': False}, {'3': 1, 'code': 'fan_speed_percent', 't': '10', 'value': 1}, {'14': False}]}, 'protocol': 4, 'pv': '2.0', 'sign': '221f621e44802bf32f39fe10bd40723c', 't': 10}

jamessonsson commented 3 years ago

It's the same for me, I have a Cleverio AF-F100 (https://www.kjell.com/se/produkter/hem-fritid/flaktar/cleverio-af-f100-golvflakt-med-luftfilter-p47081) I use it via the Smart Life app, and can change fanspeed, oscilation and so on, but in the tuya it's only on/off. Also, via the IoT Tuya developper page it's available, but to me it only have one function in the cloud.

Tuya-cloud

Hope this can help in any way.

sajid2310 commented 3 years ago

It's the same for me, I have a Cleverio AF-F100 (https://www.kjell.com/se/produkter/hem-fritid/flaktar/cleverio-af-f100-golvflakt-med-luftfilter-p47081) I use it via the Smart Life app, and can change fanspeed, oscilation and so on, but in the tuya it's only on/off. Also, via the IoT Tuya developper page it's available, but to me it only have one function in the cloud.

Tuya-cloud

Hope this can help in any way.

In your case your are able to see on/off...I cannot see this in tuya v2 but in the inbuilt tuya integration I can see it.

For Fan Speed one technique I have used if it is a 5 speed fan is to create "Tap-to-run" in smart life which when triggered changes fan speed. This shows up as a scene in HASS. You could then use Input, Script & Automation to change speed from Dashboard

tsutsuku commented 3 years ago

@sajid2310 Can you provide the fan device specifications? like this:

[2021-07-01 10:18:01,351] [tuya-openapi] Request: method = GET, url = https://openapi.tuyacn.com/v1.0/devices/aaaaaaaaaaa/specifications, params = None, body = None, headers = {'client_id': 'xxxxxxxxxxxx', 'sign': 'xxxxxxxxxxxx', 'sign_method': 'HMAC-SHA256', 'access_token': '213e2d4af5e8d217abc0b104462a9f72', 't': '1625105881351', 'lang': 'en'} 2021-07-01 10:18:01 DEBUG (SyncWorker_1) [tuya iot] Response: { "result": { "category": "cz", "functions": [ { "code": "countdown_1", "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}" }, { "code": "switch", "type": "Boolean", "values": "{}" } ], "status": [ { "code": "cur_voltage", "type": "Integer", "values": "{\"unit\":\"V\",\"min\":0,\"max\":2500,\"scale\":0,\"step\":1}" }, { "code": "cur_current", "type": "Integer", "values": "{\"unit\":\"mA\",\"min\":0,\"max\":30000,\"scale\":0,\"step\":1}" }, { "code": "switch", "type": "Boolean", "values": "{}" }, { "code": "cur_power", "type": "Integer", "values": "{\"unit\":\"W\",\"min\":0,\"max\":50000,\"scale\":0,\"step\":1}" }, { "code": "countdown_1", "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}" } ] }, "success": true, "t": 1625105881348 }

sajid2310 commented 3 years ago

This is what i see in the logs...I have both tuya and tuya v2. Here is what works

Tuya Integration - On/Off - works, Fan speed: Does not show Tuya V2 Integration - On/Off - Does not show, Fan Speed : Does Not show

These are the logs i have. I can also publish TUYA API OUTPUT too 2021-07-07 20:28:01 DEBUG (SyncWorker_0) [tuya iot] Request: method = GET, url = https://openapi.tuyaus.com/v1.0/devices/eba3fa0e92623b3535t31u/specifications, params = None, body = None, headers = {'client_id': '5efushdkaoaicowimadn', 'sign': 'Xxxxxxxxxxxxxxxxxxxxxxxx', 'sign_method': 'HMAC-SHA256', 'access_token': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 't': '1625669881382', 'lang': 'en'} 2021-07-07 20:28:01 DEBUG (Thread-4) [tuya iot] _on_log: Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'cloud_5a85a9d920bd1352213bc810b3ad0aca' 2021-07-07 20:28:01 DEBUG (SyncWorker_0) [tuya iot] Response: { "result": { "category": "fs", "functions": [ { "code": "switch", "type": "Boolean", "values": "{}" }, { "code": "fan_speed_percent", "type": "Integer", "values": "{\"min\":\"1\",\"max\":\"5\",\"scale\":\"0\",\"step\":\"1\"}" } ], "status": [ { "code": "switch", "type": "Boolean", "values": "{}" }, { "code": "fan_speed_percent", "type": "Integer", "values": "{\"min\":\"1\",\"max\":\"5\",\"scale\":\"0\",\"step\":\"1\"}" } ] }, "success": true, "t": 1625669881617 }

sajid2310 commented 3 years ago

This is what shows up on my homeassistant. No switch or fan domain. can you please help

Screen Shot 2021-07-09 at 10 28 11 AM
sachinss123 commented 3 years ago

This is similar to my issue - the exact same device as well: https://github.com/tuya/tuya-home-assistant/issues/92

sajid2310 commented 3 years ago

This is similar to my issue - the exact same device as well: #92 Yes this is the exact issue and device. Surprisingly it works on the existing HASS tuya (Switch on/off but no speed control)...

sajid2310 commented 3 years ago

@sajid2310 Can you provide the fan device specifications? like this:

[2021-07-01 10:18:01,351] [tuya-openapi] Request: method = GET, url = https://openapi.tuyacn.com/v1.0/devices/aaaaaaaaaaa/specifications, params = None, body = None, headers = {'client_id': 'xxxxxxxxxxxx', 'sign': 'xxxxxxxxxxxx', 'sign_method': 'HMAC-SHA256', 'access_token': '213e2d4af5e8d217abc0b104462a9f72', 't': '1625105881351', 'lang': 'en'} 2021-07-01 10:18:01 DEBUG (SyncWorker_1) [tuya iot] Response: { "result": { "category": "cz", "functions": [ { "code": "countdown_1", "type": "Integer", "values": "{"unit":"s","min":0,"max":86400,"scale":0,"step":1}" }, { "code": "switch", "type": "Boolean", "values": "{}" } ], "status": [ { "code": "cur_voltage", "type": "Integer", "values": "{"unit":"V","min":0,"max":2500,"scale":0,"step":1}" }, { "code": "cur_current", "type": "Integer", "values": "{"unit":"mA","min":0,"max":30000,"scale":0,"step":1}" }, { "code": "switch", "type": "Boolean", "values": "{}" }, { "code": "cur_power", "type": "Integer", "values": "{"unit":"W","min":0,"max":50000,"scale":0,"step":1}" }, { "code": "countdown_1", "type": "Integer", "values": "{"unit":"s","min":0,"max":86400,"scale":0,"step":1}" } ] }, "success": true, "t": 1625105881348 }

Any update on this @tsutsuku