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
857 stars 206 forks source link

Brightness Level Issues with Color light #591

Open dmnsgit opened 2 years ago

dmnsgit commented 2 years ago

Describe the bug When running a script that changes the HS value of a bulb every 10 seconds, occasionally the changes in the HS value will be accompanied by random reductions in brightness. After this happens enough times, the light reaches a brightness of 0 and looks off but is not. I am also not able to set the brightness or the brightness_pct using light.turn_on service.

Expected behavior No changes in the brightness when making changes to the HS. Ability to set brightness or brightness_pct using light.turn_on

Home Assistant Version core-2021.10.4

**Device info (please complete the following information, which can be found in [log](https://github.com/tuya/tuya-home-2021- 10-16 14:45:52 DEBUG (Thread-4) [tuya iot] _on_log: Received PUBLISH (d0, q0, r0, m0), 'cloud/token/in/e5e384cd27bee033434c14d18f30fe16', ... (412 bytes) 2021-10-16 14:45:52 DEBUG (Thread-4) [tuya iot] payload-> b'{"data":"uou0XGJDVSXrEB2nFLhQYQ1asSoqAKlG2KtSWEoG+t/a6AXwcwwnrj/1G73ck4377hWsAjg4hLOpscJ8LJoKMemi8eCdf36aBouB3AJgjOGYBDSLB7o+zD07YeduGSIDHF5tlMJpoXVnFQ8vD9kdgjEoVvNv8rsKUbBdtvBBdJhyI5gygGbS7mWXXLIjbrgKgsH7UfijGpJPlq51tDaBORWDJZv8hQaDzM3Lggiy9W5GhU3gr0BZuMSsa9k8PpM6BNIHO37PFe/VyyeJqvaaDGu/klZ6v+W2Ky04afI7qQmg8AG355RzbHtfpcs+m4hO","protocol":4,"pv":"2.0","sign":"e302501c530ac2f30965b0a17477f626","t":1634420751}' 2021-10-16 14:45:52 DEBUG (Thread-4) [tuya iot] on_message: {'data': {'dataId': '786bef17-bb83-422b-a9aa-76e2d79780f7', 'devId': '20060353a4e57c8b0586', 'productKey': 'kmkhqzkkimrihf5g', 'status': [{'24': '001703de0017', 'code': 'colour_data_v2', 't': '1634420751', 'value': '{"h":23,"s":990,"v":23}'}]}, 'protocol': 4, 'pv': '2.0', 'sign': 'e302501c530ac2f30965b0a17477f626', 't': 1634420751} 2021-10-16 14:45:52 DEBUG (Thread-4) [tuya iot] mq receive-> {'data': {'dataId': '786bef17-bb83-422b-a9aa-76e2d79780f7', 'devId': '20060353a4e57c8b0586', 'productKey': 'kmkhqzkkimrihf5g', 'status': [{'24': '001703de0017', 'code': 'colour_data_v2', 't': '1634420751', 'value': '{"h":23,"s":990,"v":23}'}]}, 'protocol': 4, 'pv': '2.0', 'sign': 'e302501c530ac2f30965b0a17477f626', 't': 1634420751} 2021-10-16 14:45:52 DEBUG (Thread-4) [tuya iot] mq _on_device_report-> [{'24': '001703de0017', 'code': 'colour_data_v2', 't': '1634420751', 'value': '{"h":23,"s":990,"v":23}'}] 2021-10-16 14:45:52 DEBUG (Thread-4) [custom_components.tuya_v2] _update--><custom_components.tuya_v2.DeviceListener object at 0x7f6f88c33340>;->>20060353a4e57c8b0586 2021-10-16 14:45:57 DEBUG (Thread-4) [tuya iot] _on_log: Sending PINGREQ 2021-10-16 14:45:57 DEBUG (Thread-4) [tuya iot] _on_log: Received PINGRESP 2021-10-16 14:46:02 DEBUG (SyncWorker_1) [custom_components.tuya_v2.light] light kwargs-> {'hs_color': (24.0, 99.0)} 2021-10-16 14:46:02 DEBUG (SyncWorker_1) [tuya iot] Request: method = POST, url = https://openapi.tuyaus.com/v1.0/devices/20060353a4e57c8b0586/commands, params = None, body = {'commands': [{'code': 'switch_led', 'value': True}, {'code': 'colour_data_v2', 'value': '{"h": 24, "s": 990, "v": 19}'}]}, t = 1634420762111 2021-10-16 14:46:02 DEBUG (SyncWorker_1) [tuya iot] Response: { "result": true, "success": true, "t": 1634420762163 } 2021-10-16 14:46:02 DEBUG (Thread-4) [tuya iot] _on_log: Received PUBLISH (d0, q0, r0, m0), 'cloud/token/in/e5e384cd27bee033434c14d18f30fe16', ... (412 bytes) 2021-10-16 14:46:02 DEBUG (Thread-4) [tuya iot] payload-> b'{"data":"Q0jrci/+yIgsHukiw6NnnnK370w7YCN6JA4z5+ZQHBMKRmHDuNK9a2y7toDazn4J7hWsAjg4hLOpscJ8LJoKMemi8eCdf36aBouB3AJgjOGYBDSLB7o+zD07YeduGSIDHF5tlMJpoXVnFQ8vD9kdgjEoVvNv8rsKUbBdtvBBdJiRF6pA1nqYFRpyQSbyxwzPgsH7UfijGpJPlq51tDaBORWDJZv8hQaDzM3Lggiy9W6XGKJEyOMjTQ8wqW9gHa8vnKxM+c0vEnmAny+pgHJMGO/WrszvvQ4lE+YHgMExiOWg8AG355RzbHtfpcs+m4hO","protocol":4,"pv":"2.0","sign":"fa4aed39f51d6d10819161cab7d8b231","t":1634420761}' 2021-10-16 14:46:02 DEBUG (Thread-4) [tuya iot] on_message: {'data': {'dataId': '685321f7-d466-4688-aaa1-c03a129b7097', 'devId': '20060353a4e57c8b0586', 'productKey': 'kmkhqzkkimrihf5g', 'status': [{'24': '001803de0013', 'code': 'colour_data_v2', 't': '1634420761', 'value': '{"h":24,"s":990,"v":19}'}]}, 'protocol': 4, 'pv': '2.0', 'sign': 'fa4aed39f51d6d10819161cab7d8b231', 't': 1634420761} 2021-10-16 14:46:02 DEBUG (Thread-4) [tuya iot] mq receive-> {'data': {'dataId': '685321f7-d466-4688-aaa1-c03a129b7097', 'devId': '20060353a4e57c8b0586', 'productKey': 'kmkhqzkkimrihf5g', 'status': [{'24': '001803de0013', 'code': 'colour_data_v2', 't': '1634420761', 'value': '{"h":24,"s":990,"v":19}'}]}, 'protocol': 4, 'pv': '2.0', 'sign': 'fa4aed39f51d6d10819161cab7d8b231', 't': 1634420761} 2021-10-16 14:46:02 DEBUG (Thread-4) [tuya iot] mq _on_device_report-> [{'24': '001803de0013', 'code': 'colour_data_v2', 't': '1634420761', 'value': '{"h":24,"s":990,"v":19}'}] 2021-10-16 14:46:02 DEBUG (Thread-4) [custom_components.tuya_v2] _update--><custom_components.tuya_v2.DeviceListener object at 0x7f6f88c33340>;->>20060353a4e57c8b0586 2021-10-16 14:46:12 DEBUG (SyncWorker_9) [custom_components.tuya_v2.light] light kwargs-> {'hs_color': (25.0, 99.0)} 2021-10-16 14:46:12 DEBUG (SyncWorker_9) [tuya iot] Request: method = POST, url = https://openapi.tuyaus.com/v1.0/devices/20060353a4e57c8b0586/commands, params = None, body = {'commands': [{'code': 'switch_led', 'value': True}, {'code': 'colour_data_v2', 'value': '{"h": 25, "s": 990, "v": 15}'}]}, t = 1634420772196 2021-10-16 14:46:12 DEBUG (SyncWorker_9) [tuya iot] Response: { "result": true, "success": true, "t": 1634420772248 } 2021-10-16 14:46:12 DEBUG (Thread-4) [tuya iot] _on_log: Received PUBLISH (d0, q0, r0, m0), 'cloud/token/in/e5e384cd27bee033434c14d18f30fe16', ... (412 bytes) 2021-10-16 14:46:12 DEBUG (Thread-4) [tuya iot] payload-> b'{"data":"sFn0Q4+8pMpTnFL8RD+4JPxZPDVW2dBJOH47scvfg9w4R4xXEgQJpYAASzBrhc1j7hWsAjg4hLOpscJ8LJoKMemi8eCdf36aBouB3AJgjOGYBDSLB7o+zD07YeduGSIDHF5tlMJpoXVnFQ8vD9kdgjEoVvNv8rsKUbBdtvBBdJixonqOr5zaYMfsjFEzQDdbgsH7UfijGpJPlq51tDaBORWDJZv8hQaDzM3Lggiy9W44COgTwQLtbK5+Z5pc3w9hUoxZ6EOg9r1pUVcQ3XBGliU2i+nuUB+F51LCPjIqjieg8AG355RzbHtfpcs+m4hO","protocol":4,"pv":"2.0","sign":"42ee114ea075c181e8376c3765540827","t":1634420771}' 2021-10-16 14:46:12 DEBUG (Thread-4) [tuya iot] on_message: {'data': {'dataId': 'd54359e0-95e0-4b15-bf13-67e20497c990', 'devId': '20060353a4e57c8b0586', 'productKey': 'kmkhqzkkimrihf5g', 'status': [{'24': '001903de000f', 'code': 'colour_data_v2', 't': '1634420771', 'value': '{"h":25,"s":990,"v":15}'}]}, 'protocol': 4, 'pv': '2.0', 'sign': '42ee114ea075c181e8376c3765540827', 't': 1634420771} 2021-10-16 14:46:12 DEBUG (Thread-4) [tuya iot] mq receive-> {'data': {'dataId': 'd54359e0-95e0-4b15-bf13-67e20497c990', 'devId': '20060353a4e57c8b0586', 'productKey': 'kmkhqzkkimrihf5g', 'status': [{'24': '001903de000f', 'code': 'colour_data_v2', 't': '1634420771', 'value': '{"h":25,"s":990,"v":15}'}]}, 'protocol': 4, 'pv': '2.0', 'sign': '42ee114ea075c181e8376c3765540827', 't': 1634420771} 2021-10-16 14:46:12 DEBUG (Thread-4) [tuya iot] mq _on_device_report-> [{'24': '001903de000f', 'code': 'colour_data_v2', 't': '1634420771', 'value': '{"h":25,"s":990,"v":15}'}] 2021-10-16 14:46:12 DEBUG (Thread-4) [custom_components.tuya_v2] _update--><custom_components.tuya_v2.DeviceListener object at 0x7f6f88c33340>;->>20060353a4e57c8b0586 2021-10-16 14:46:22 DEBUG (SyncWorker_0) [custom_components.tuya_v2.light] light kwargs-> {'hs_color': (26.0, 99.0)} 2021-10-16 14:46:22 DEBUG (SyncWorker_0) [tuya iot] Request: method = POST, url = https://openapi.tuyaus.com/v1.0/devices/20060353a4e57c8b0586/commands, params = None, body = {'commands': [{'code': 'switch_led', 'value': True}, {'code': 'colour_data_v2', 'value': '{"h": 26, "s": 990, "v": 11}'}]}, t = 1634420782283 2021-10-16 14:46:22 DEBUG (SyncWorker_0) [tuya iot] Response: { "result": true, "success": true, "t": 1634420782334 } 2021-10-16 14:46:22 DEBUG (Thread-4) [tuya iot] _on_log: Received PUBLISH (d0, q0, r0, m0), 'cloud/token/in/e5e384cd27bee033434c14d18f30fe16', ... (412 bytes) 2021-10-16 14:46:22 DEBUG (Thread-4) [tuya iot] payload-> b'{"data":"YkdZI/zMa0XuQeaxg5cYxZoTwOQQNzp+1daBph+EgocIvsbIpJOkCcZvdUhu16G07hWsAjg4hLOpscJ8LJoKMemi8eCdf36aBouB3AJgjOGYBDSLB7o+zD07YeduGSIDHF5tlMJpoXVnFQ8vD9kdgjEoVvNv8rsKUbBdtvBBdJi6O6AZmAZUwLWp3EjPwdTUgsH7UfijGpJPlq51tDaBORWDJZv8hQaDzM3Lggiy9W4A5joTZPrDboruq+wIr1thkuVDek5GHccg/3jCDGK7v+q8Mgfrl4kSIScYfSqmWpKg8AG355RzbHtfpcs+m4hO","protocol":4,"pv":"2.0","sign":"c152ba7acdaa831a8e6db34f2085a2a4","t":1634420781}' 2021-10-16 14:46:22 DEBUG (Thread-4) [tuya iot] on_message: {'data': {'dataId': '1b015541-756a-44db-b733-6320966dad76', 'devId': '20060353a4e57c8b0586', 'productKey': 'kmkhqzkkimrihf5g', 'status': [{'24': '001a03de000b', 'code': 'colour_data_v2', 't': '1634420781', 'value': '{"h":26,"s":990,"v":11}'}]}, 'protocol': 4, 'pv': '2.0', 'sign': 'c152ba7acdaa831a8e6db34f2085a2a4', 't': 1634420781} 2021-10-16 14:46:22 DEBUG (Thread-4) [tuya iot] mq receive-> {'data': {'dataId': '1b015541-756a-44db-b733-6320966dad76', 'devId': '20060353a4e57c8b0586', 'productKey': 'kmkhqzkkimrihf5g', 'status': [{'24': '001a03de000b', 'code': 'colour_data_v2', 't': '1634420781', 'value': '{"h":26,"s":990,"v":11}'}]}, 'protocol': 4, 'pv': '2.0', 'sign': 'c152ba7acdaa831a8e6db34f2085a2a4', 't': 1634420781} 2021-10-16 14:46:22 DEBUG (Thread-4) [tuya iot] mq _on_device_report-> [{'24': '001a03de000b', 'code': 'colour_data_v2', 't': '1634420781', 'value': '{"h":26,"s":990,"v":11}'}] 2021-10-16 14:46:22 DEBUG (Thread-4) [custom_components.tuya_v2] _update--><custom_components.tuya_v2.DeviceListener object at 0x7f6f88c33340>;->>20060353a4e57c8b0586 2021-10-16 14:46:32 DEBUG (SyncWorker_7) [custom_components.tuya_v2.light] light kwargs-> {'hs_color': (27.0, 99.0)} 2021-10-16 14:46:32 DEBUG (SyncWorker_7) [tuya iot] Request: method = POST, url = https://openapi.tuyaus.com/v1.0/devices/20060353a4e57c8b0586/commands, params = None, body = {'commands': [{'code': 'switch_led', 'value': True}, {'code': 'colour_data_v2', 'value': '{"h": 27, "s": 990, "v": 7}'}]}, t = 1634420792371 2021-10-16 14:46:32 DEBUG (SyncWorker_7) [tuya iot] Response: { "result": true, "success": true, "t": 1634420792426 } 2021-10-16 14:46:32 DEBUG (Thread-4) [tuya iot] _on_log: Received PUBLISH (d0, q0, r0, m0), 'cloud/token/in/e5e384cd27bee033434c14d18f30fe16', ... (412 bytes) 2021-10-16 14:46:32 DEBUG (Thread-4) [tuya iot] payload-> b'{"data":"GOZexdQlSMAr93//O7aO/KBxtbIPXE/H9pla+XHDkde1veT4NYl6ti2uq4Y5AfT47hWsAjg4hLOpscJ8LJoKMemi8eCdf36aBouB3AJgjOGYBDSLB7o+zD07YeduGSIDHF5tlMJpoXVnFQ8vD9kdgjEoVvNv8rsKUbBdtvBBdJh2CVK9CYYBKYz5zjBNvuPxgsH7UfijGpJPlq51tDaBORWDJZv8hQaDzM3Lggiy9W6h4Fq7UFOD++IYzp/xhPUKh9ZhzYBCHXuJheXDC9lKsOSzvkXp93yJR08DNovP/ZBHcaDntjhSBwWNw+ZirkoG","protocol":4,"pv":"2.0","sign":"0e8a12e577b524f80a1e9ca4f1e68f28","t":1634420791}' 2021-10-16 14:46:32 DEBUG (Thread-4) [tuya iot] on_message: {'data': {'dataId': 'df6f6d2a-c3e1-402e-997a-0b67c73350af', 'devId': '20060353a4e57c8b0586', 'productKey': 'kmkhqzkkimrihf5g', 'status': [{'24': '001b03de0007', 'code': 'colour_data_v2', 't': '1634420791', 'value': '{"h":27,"s":990,"v":7}'}]}, 'protocol': 4, 'pv': '2.0', 'sign': '0e8a12e577b524f80a1e9ca4f1e68f28', 't': 1634420791} 2021-10-16 14:46:32 DEBUG (Thread-4) [tuya iot] mq receive-> {'data': {'dataId': 'df6f6d2a-c3e1-402e-997a-0b67c73350af', 'devId': '20060353a4e57c8b0586', 'productKey': 'kmkhqzkkimrihf5g', 'status': [{'24': '001b03de0007', 'code': 'colour_data_v2', 't': '1634420791', 'value': '{"h":27,"s":990,"v":7}'}]}, 'protocol': 4, 'pv': '2.0', 'sign': '0e8a12e577b524f80a1e9ca4f1e68f28', 't': 1634420791} 2021-10-16 14:46:32 DEBUG (Thread-4) [tuya iot] mq _on_device_report-> [{'24': '001b03de0007', 'code': 'colour_data_v2', 't': '1634420791', 'value': '{"h":27,"s":990,"v":7}'}] 2021-10-16 14:46:32 DEBUG (Thread-4) [custom_components.tuya_v2] _update--><custom_components.tuya_v2.DeviceListener object at 0x7f6f88c33340>;->>20060353a4e57c8b0586 2021-10-16 14:46:57 DEBUG (Thread-4) [tuya iot] _on_log: Sending PINGREQ 2021-10-16 14:46:57 DEBUG (Thread-4) [tuya iot] _on_log: Received PINGRESP

Additional context Add any other context or logs about the problem here. This is occurring in both the HACS V2 and the new official V2 integration.

min_mireds: 153 max_mireds: 500 supported_color_modes:

guidohaesen commented 2 years ago

Mine isn't working also, BUT, you can use: Light Entity Card in Hacs or click here In this card you can use the brightness slider for the time being. Guido card