make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.35k stars 520 forks source link

[New device] PANAMALAR Smart WiFi Sunset Lamp #1479

Closed tmeuze closed 10 months ago

tmeuze commented 10 months ago

Thank you for the awesome work done here. Hoping you can add this device:

Log Message

2024-01-02 18:39:08.135 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call to sleep inside the event loop by custom integration 'tuya_local' at custom_components/tuya_local/device.py, line 77: self._api = tinytuya.Device(dev_id, address, local_key), please create a bug report at https://github.com/make-all/tuya-local/issues

Information about DPS mappings

{
  "result": {
    "model": "{\"modelId\":\"000003b4j4\",\"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\":\"640\"},\"name\":\"模式\",\"typeSpec\":{\"range\":[\"white\",\"colour\",\"scene\",\"music\"],\"type\":\"enum\",\"typeDefaultValue\":\"white\"}},
{\"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\":\"642\"},\"name\":\"倒计时\",\"typeSpec\":{\"max\":86400,\"min\":0,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0,\"unit\":\"s\"}},
{\"abilityId\":28,\"accessMode\":\"wr\",\"code\":\"control_data\",\"description\":\"用于实时下发数据实现实时预览效果\",\"extensions\":{\"iconName\":\"icon-dp_box2\",\"attribute\":\"640\"},\"name\":\"实时调节\",\"typeSpec\":{\"maxlen\":255,\"type\":\"string\",\"typeDefaultValue\":\"\"}},
{\"abilityId\":31,\"accessMode\":\"rw\",\"code\":\"sleep_mode\",\"description\":\"温馨的灯光渐灭陪您进入甜美的梦乡\",\"extensions\":{\"iconName\":\"icon-dp_sleep\",\"attribute\":\"640\"},\"name\":\"灯光助眠\",\"typeSpec\":{\"maxlen\":255,\"type\":\"raw\"}},
{\"abilityId\":32,\"accessMode\":\"rw\",\"code\":\"wakeup_mode\",\"description\":\"柔和的灯光渐亮伴您迎接新的一天\",\"extensions\":{\"iconName\":\"icon-dp_sun\",\"attribute\":\"640\"},\"name\":\"灯光唤醒\",\"typeSpec\":{\"maxlen\":255,\"type\":\"raw\"}},
{\"abilityId\":33,\"accessMode\":\"rw\",\"code\":\"power_memory\",\"description\":\"用于设置断电再上电灯亮起的状态(不记忆APP关灯动作)\",\"extensions\":{\"iconName\":\"icon-dp_lightning\",\"attribute\":\"640\"},\"name\":\"断电记忆\",\"typeSpec\":{\"maxlen\":255,\"type\":\"raw\"}},
{\"abilityId\":34,\"accessMode\":\"rw\",\"code\":\"do_not_disturb\",\"description\":\"适用于经常停电的区域,避免停电再来电时亮灯打扰用户。开启通电勿扰,APP上关灯后需要连续两次上电才会亮灯\",\"extensions\":{\"iconName\":\"icon-dp_sleep\",\"attribute\":\"640\"},\"name\":\"停电勿扰\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}}]}]}"
  },
  "success": true,
  "t": 1704238186170,
  "tid": "d070d9cfa9c611ee9212a2353e8c4b69"
}

{"20":"ON/OFF","21":"Mode","24":"Colorful","25":"Scene","26":"Timer","28":"Real-Time Adjustment","31":"Light to Sleep","32":"Light to Wake","33":"Power Off Memory","34":"Do not Disturb"}

Product ID

httjaqed1h4iteup

Information about how the device functions

PANAMALAR Smart WiFi Sunset Lamp

https://www.amazon.com/gp/product/B09MCZDRND

Simple RGB light with scenes

IMG_0590

make-all commented 10 months ago

The log message required will be the one with dps, the one you have included just indicates that you left the IP address blank and the tinytuya library is trying to detect it (perhaps unsuccessfully). This light is close to rgb_led_strip in functionality, the additional dps are anyway not handled in any of the other lights, as their functionality and encoding is not understood. So probably you can just use the rgb_led_strip config unless there is something specific about this light that makes it unusable with that.

tmeuze commented 10 months ago

Thank you for your response! After trying different combinations of settings, all except for protocol version 3.5 resulted in the "intermittent error". Specifying 3.5 allowed me to add it as an RGB strip, which is working just fine.

Thank you again.

Here are the more detailed logs, if of any interest:

2024-01-03 10:22:34.511 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Loaded device config rgb_led_strip.yaml 2024-01-03 10:22:34.513 INFO (MainThread) [homeassistant.components.number] Setting up number.tuya_local 2024-01-03 10:22:34.514 INFO (MainThread) [homeassistant.components.light] Setting up light.tuya_local 2024-01-03 10:22:34.557 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Loaded device config rgb_led_strip.yaml 2024-01-03 10:22:34.558 DEBUG (MainThread) [custom_components.tuya_local.helpers.config] Adding number for number_timer 2024-01-03 10:22:34.578 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Loaded device config rgb_led_strip.yaml 2024-01-03 10:22:34.580 DEBUG (MainThread) [custom_components.tuya_local.helpers.config] Adding light for light 2024-01-03 10:22:34.626 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for range of value 2024-01-03 10:22:34.627 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for range of value 2024-01-03 10:22:34.631 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for step of value 2024-01-03 10:22:34.632 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Step for value is 60 with scale 60 2024-01-03 10:22:34.635 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new number.tuya_local entity: number.sunset_lamp_timer 2024-01-03 10:22:34.638 DEBUG (MainThread) [custom_components.tuya_local.device] Starting monitor loop for Sunset Lamp 2024-01-03 10:22:34.640 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for range of value 2024-01-03 10:22:34.641 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for range of value 2024-01-03 10:22:34.641 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for step of value 2024-01-03 10:22:34.643 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Step for value is 60 with scale 60 2024-01-03 10:22:34.647 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:34.649 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:34.649 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:34.650 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:34.652 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:34.653 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new light.tuya_local entity: light.sunset_lamp 2024-01-03 10:22:34.658 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:34.659 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:34.660 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:34.661 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:34.663 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:34.681 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Sunset Lamp to 3.5 2024-01-03 10:22:34.711 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for range of value 2024-01-03 10:22:34.711 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for range of value 2024-01-03 10:22:34.712 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for step of value 2024-01-03 10:22:34.712 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Step for value is 60 with scale 60 2024-01-03 10:22:34.713 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:34.713 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:34.713 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:34.713 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:34.714 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] color_mode values: ['white', 'hs', 'Scene'] 2024-01-03 10:22:35.114 DEBUG (MainThread) [custom_components.tuya_local.device] Sunset Lamp received {"20": true, "21": "scene", "24": "00380277005e", "25": "23505002000003e803e80000000046460200f003e803e800000000", "26": 0, "34": false, "full_poll": true} 2024-01-03 10:22:35.115 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for range of value 2024-01-03 10:22:35.115 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for range of value 2024-01-03 10:22:35.115 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for step of value 2024-01-03 10:22:35.116 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Step for value is 60 with scale 60 2024-01-03 10:22:35.116 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] LED strip: Mapped dps 26 value from 0 to 0.0 2024-01-03 10:22:35.116 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] LED strip: Mapped dps 26 value from 0 to 0.0