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
882 stars 207 forks source link

Ceiling fan + light combo --> Light can't be turn off #419

Open burnworld3d opened 3 years ago

burnworld3d commented 3 years ago

Describe the bug I have a fan with integrated light, each time I try to turn on the light, it goes to off state after 1 second. Even if its displayed as Off, the light has been turned on phisically, but then is impossible to 'turn off' because HA thinks is already off.

The device creates 3 entities in HA:

The last two (fan and switch), does the same thing, that is turn on the fan (if you toggle one, the other automatically gets toggled too, and viceversa).

Expected behavior When I turn on the light switch, it needs to stay ON, and don't revert state, otherwise it can't be turned off.

Screenshots

Small video of the issue: https://funhouse.dev/bug1.webm

Image of the light entity that is bugged: https://puu.sh/I6V6w/f55cff823c.png

Home Assistant Version

Device info:

{ "active_time": 1624113960, "biz_type": 18, "category": "fs", "create_time": 1623585488, "icon": "smart/icon/ay1568717810596BGiOb/082ed29d3eb110cc1651615f8debb9a9.png", "id": "03855241c82b960ccfee", "ip": "", "lat": "", "local_key": "", "lon": "", "name": "Ventilador sergio", "online": true, "owner_id": "10843115", "product_id": "gsza7a634m9ui0dl", "product_name": "Mantra Smart Ceiling Fan", "status": [ { "code": "switch", "value": false }, { "code": "fan_speed", "value": "17" }, { "code": "countdown", "value": "0" }, { "code": "countdown_left", "value": 0 }, { "code": "light", "value": true }, { "code": "bright_value", "value": 999 }, { "code": "temp_value", "value": 498 } ], "sub": false, "time_zone": "+01:00", "uid": "***", "update_time": 1629401145, "uuid": "03855241c82b960ccfee" }

Device specifications:

2021-08-20 23:12:03 DEBUG (SyncWorker_5) [tuya iot] Request: method = GET, url = https://openapi.tuyaus.com/v1.0/devices/03855241c82b960ccfee/specifications, params = None, body = None, t = 1629493923228 2021-08-20 23:12:03 DEBUG (SyncWorker_5) [tuya iot] Response: { "result": { "category": "fs", "functions": [ { "code": "switch", "type": "Boolean", "values": "{}" }, { "code": "fan_speed", "type": "Enum", "values": "{\"range\":[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\",\"31\",\"32\"]}" }, { "code": "countdown", "type": "Enum", "values": "{\"range\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\"]}" }, { "code": "light", "type": "Boolean", "values": "{}" }, { "code": "bright_value", "type": "Integer", "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}" }, { "code": "temp_value", "type": "Integer", "values": "{\"min\":0,\"max\":1000,\"scale\":0,\"step\":1}" } ], "status": [ { "code": "switch", "type": "Boolean", "values": "{}" }, { "code": "fan_speed", "type": "Enum", "values": "{\"range\":[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\",\"31\",\"32\"]}" }, { "code": "countdown", "type": "Enum", "values": "{\"range\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\"]}" }, { "code": "countdown_left", "type": "Integer", "values": "{\"unit\":\"min\",\"min\":0,\"max\":480,\"scale\":0,\"step\":1}" }, { "code": "light", "type": "Boolean", "values": "{}" }, { "code": "bright_value", "type": "Integer", "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}" }, { "code": "temp_value", "type": "Integer", "values": "{\"min\":0,\"max\":1000,\"scale\":0,\"step\":1}" } ] }, "success": true, "t": 1629493923377 }

Additional context I have 5 ceiling fans and this bug happens on all of them, light can't be turned off after you switch it on

Martynhsmith commented 3 years ago

I'm getting exactly the same issue - on a smart plug socket It's a display issue - I have monitors and monitors 2 they both point to the same plug (Monitors is on the original integrations and monitors_1 is on the V2)

https://user-images.githubusercontent.com/11158209/131133731-c55a9105-af72-4072-95eb-10d4eef2f388.mp4

I can switch monitors on and off ok

but as burnworld3d shows, if I switch monitors_1 on after 1/2 second it switches off - On the display only the device is still on (You can see that from the Monitors switch)

@burnworld3d - if you have the Tuya original integration it will work on that Plus if you switch the light on and quickly switch it off again it will switch off your light

It feels like its working for a momentary switch when its displaying a slider

Johnito commented 3 years ago

Yes, the same with my light bulbs. Seems to be the same issue reported here : https://github.com/tuya/tuya-home-assistant/issues/409