make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.36k stars 526 forks source link

Request support for Lumary US-GL4C-1 Smart Recessed Lighting Color #1020

Closed Colorado4Wheeler closed 1 year ago

Colorado4Wheeler commented 1 year ago

Log Message

My actual HomeAssistant log has 1,400 lines of errors about Local Tuya, I'm not sure if that's how much detail you want, here is a sample.

2023-08-23 08:47:53.918 DEBUG (MainThread) [custom_components.localtuya.discovery] Listening to broadcasts on UDP port 6666 and 6667
2023-08-23 08:47:54.141 INFO (MainThread) [custom_components.localtuya] Cloud API connection succeeded.
2023-08-23 08:47:55.158 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback _SelectorDatagramTransport._read_ready()
Traceback (most recent call last):
  File "/config/custom_components/localtuya/discovery.py", line 65, in datagram_received
    data = decrypt_udp(data)
           ^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/discovery.py", line 30, in decrypt_udp
    return _unpad(decryptor.update(message) + decryptor.finalize()).decode()
                                              ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 186, in finalize
    data = self._ctx.finalize()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 222, in finalize
    raise ValueError(
ValueError: The length of the provided data is not a multiple of the block length.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1163, in _read_ready
    self._protocol.datagram_received(data, addr)
  File "/config/custom_components/localtuya/discovery.py", line 67, in datagram_received
    data = data.decode()
           ^^^^^^^^^^^^^

Information about DPS mappings

{
  "result": {
    "model": "{\"modelId\":\"000004eshd\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[
{\"abilityId\":20,\"accessMode\":\"rw\",\"code\":\"switch_led\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power\",\"attribute\":\"643\"},\"name\":\"开关\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":21,\"accessMode\":\"rw\",\"code\":\"work_mode\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_mode\",\"attribute\":\"1664\"},\"name\":\"模式\",\"typeSpec\":{\"range\":[\"white\",\"colour\",\"scene\",\"music\"],\"type\":\"enum\",\"typeDefaultValue\":\"white\"}},
{\"abilityId\":22,\"accessMode\":\"rw\",\"code\":\"bright_value\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-liangdu1\",\"attribute\":\"646\"},\"name\":\"白光亮度\",\"typeSpec\":{\"max\":1000,\"min\":10,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":10}},
{\"abilityId\":23,\"accessMode\":\"rw\",\"code\":\"temp_value\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_half\",\"attribute\":\"646\"},\"name\":\"冷暖值\",\"typeSpec\":{\"max\":1000,\"min\":0,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0}},
{\"abilityId\":24,\"accessMode\":\"rw\",\"code\":\"colour_data\",\"description\":\"用于调节彩光颜色、亮度、饱和度\",\"extensions\":{\"iconName\":\"icon-yanse\",\"attribute\":\"642\"},\"name\":\"彩光\",\"typeSpec\":{\"maxlen\":255,\"type\":\"string\",\"typeDefaultValue\":\"\"}},
{\"abilityId\":25,\"accessMode\":\"rw\",\"code\":\"scene_data\",\"description\":\"用于切换、编辑场景\",\"extensions\":{\"iconName\":\"icon-shoucang\",\"attribute\":\"640\"},\"name\":\"场景\",\"typeSpec\":{\"maxlen\":255,\"type\":\"string\",\"typeDefaultValue\":\"\"}},
{\"abilityId\":26,\"accessMode\":\"rw\",\"code\":\"countdown\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-a_nav_timer\",\"attribute\":\"646\"},\"name\":\"倒计时\",\"typeSpec\":{\"max\":86400,\"min\":0,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0,\"unit\":\"s\"}},
{\"abilityId\":27,\"accessMode\":\"wr\",\"code\":\"music_data\",\"description\":\"通过APP内置律动算法实现灯光律动\",\"extensions\":{\"iconName\":\"icon-dp_mic\",\"attribute\":\"128\"},\"name\":\"音乐律动\",\"typeSpec\":{\"maxlen\":255,\"type\":\"string\",\"typeDefaultValue\":\"\"}},
{\"abilityId\":28,\"accessMode\":\"wr\",\"code\":\"control_data\",\"description\":\"用于实时下发数据实现实时预览效果\",\"extensions\":{\"iconName\":\"icon-dp_box2\",\"attribute\":\"640\"},\"name\":\"实时调节\",\"typeSpec\":{\"maxlen\":255,\"type\":\"string\",\"typeDefaultValue\":\"\"}},
{\"abilityId\":29,\"accessMode\":\"rw\",\"code\":\"debug_data\",\"description\":\"用于gamma调试,需配合支持gamma调试的面板使用\",\"extensions\":{\"iconName\":\"icon-dp_tool\",\"attribute\":\"128\"},\"name\":\"Gamma调试\",\"typeSpec\":{\"maxlen\":255,\"type\":\"string\",\"typeDefaultValue\":\"\"}},
{\"abilityId\":30,\"accessMode\":\"rw\",\"code\":\"rhythm_mode\",\"description\":\"不同时间段的色温、亮度根据人体节律自动调整\",\"extensions\":{\"iconName\":\"icon-dp_time3\",\"attribute\":\"640\"},\"name\":\"生物节律\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":31,\"accessMode\":\"rw\",\"code\":\"sleep_mode\",\"description\":\"温馨的灯光渐灭陪您进入甜美的梦乡\",\"extensions\":{\"iconName\":\"icon-dp_sleep\",\"attribute\":\"640\"},\"name\":\"灯光助眠\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":32,\"accessMode\":\"rw\",\"code\":\"wakeup_mode\",\"description\":\"柔和的灯光渐亮伴您迎接新的一天\",\"extensions\":{\"iconName\":\"icon-dp_sun\",\"attribute\":\"640\"},\"name\":\"灯光唤醒\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":33,\"accessMode\":\"rw\",\"code\":\"power_memory\",\"description\":\"用于设置断电再上电灯亮起的状态(不记忆APP关灯动作)\",\"extensions\":{\"iconName\":\"icon-dp_lightning\",\"attribute\":\"640\"},\"name\":\"断电记忆\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":34,\"accessMode\":\"rw\",\"code\":\"do_not_disturb\",\"description\":\"适用于经常停电的区域,避免停电再来电时亮灯打扰用户。开启通电勿扰,APP上关灯后需要连续两次上电才会亮灯\",\"extensions\":{\"iconName\":\"icon-dp_sleep\",\"attribute\":\"644\"},\"name\":\"停电勿扰\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":209,\"accessMode\":\"rw\",\"code\":\"cycle_timing\",\"description\":\"灯光循环亮灭满足植物照明等场景\",\"extensions\":{\"iconName\":\"icon-dp_time\",\"attribute\":\"128\"},\"name\":\"循环定时\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":210,\"accessMode\":\"rw\",\"code\":\"random_timing\",\"description\":\"灯光随机亮灭模拟有人在家的场景\",\"extensions\":{\"iconName\":\"icon-dp_time3\",\"attribute\":\"128\"},\"name\":\"灯光看家\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}}]}]}"
  },
  "success": true,
  "t": 1692802947660,
  "tid": "1320125741c611ee8c70fe98ebe72f12"
}

Product ID

{
  "result": [
    {
      "active_time": 1692738871,
      "category": "dj",
      "create_time": 1692738871,
      "custom_name": "Soffit Garage 1",
      "icon": "smart/icon/ay1531796423071q5AXk/1654138335f04830c0c5c.png",
      "id": "eb4e9c82773dbb7d66yk3o",
      "ip": "1.2.3.4",
      "is_online": true,
      "lat": "",
      "local_key": "-redacted-",
      "lon": "",
      "model": "US-GL4C-1",
      "name": "Lumary Smart Gimbal Recessed Light C1",
      "product_id": "2dmcbvavoe7dqi9m",
      "product_name": "Lumary Smart Gimbal Recessed Light C1",
      "sub": false,
      "time_zone": "-00:00",
      "update_time": 1692739677,
      "uuid": "-redacted-"
    }
  ],
  "success": true,
  "t": 1692803609532,
  "tid": "9daca63c41c711ee804ade073cb82c5d"
}

Information about how the device functions

https://lumarysmart.com/collections/smart-gimbal-recessed-lights/products/lumary-wifi-smart-gimbal-recessed-light-4-inch-9w

make-all commented 1 year ago

I don't want any detail about localtuya's logs. That is a different integration.

Colorado4Wheeler commented 1 year ago

I wasn't sure what you wanted there so that's what I pasted. Is the rest enough to go on or do you need more from me on this device?

make-all commented 1 year ago

For lightbulbs I need the log message from this integration when you try to add it, or device diagnostics if it is matching an existing device but not working correctly with that config. The color_data format is not adequately documented in the information about DPS mappings on iot.tuya.com

Colorado4Wheeler commented 1 year ago

I did an add but those are the only Tuya messages I got. I had expected more but that is all that there were. I can add on the built-in Tuya just fine, but this integration just throws those errors.

make-all commented 1 year ago

Those log messages are from a different integration. You are filing this bug in the wrong place.

Colorado4Wheeler commented 1 year ago

My apologies!

Colorado4Wheeler commented 1 year ago

@make-all thank you so much for pointing out my mistake, it didn't register with me that there were two totally different HACS integrations named nearly the same and I got you mixed up with the other. I installed yours and everything worked perfectly so far.