make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.44k stars 556 forks source link

Unable to connect to device #2213

Closed capitar06 closed 3 months ago

capitar06 commented 3 months ago

Describe the bug When adding a LSC Smart Pet Feeder I get this error: image All values are verified from API explorer in Tuya IOT and DHCP router.

Information regarding the device: LSC Pet Feeder with Camera model: 5525000400 https://shop.action.com/en-nl/p/8712879155744/lsc-smart-connect-smart-food-bowl

{ "result": { "category": "sp", "functions": [ { "code": "basic_flip", "desc": "basic flip", "name": "basic flip", "type": "Boolean", "values": "{}" }, { "code": "motion_sensitivity", "desc": "motion sensitivity", "name": "motion sensitivity", "type": "Enum", "values": "{\"range\":[\"0\",\"1\",\"2\"]}" }, { "code": "basic_nightvision", "desc": "basic nightvision", "name": "basic nightvision", "type": "Enum", "values": "{\"range\":[\"0\",\"1\",\"2\"]}" }, { "code": "sd_format", "desc": "sd format", "name": "sd format", "type": "Boolean", "values": "{}" }, { "code": "motion_switch", "desc": "motion switch", "name": "motion switch", "type": "Boolean", "values": "{}" }, { "code": "record_switch", "desc": "record switch", "name": "record switch", "type": "Boolean", "values": "{}" }, { "code": "record_mode", "desc": "record mode", "name": "record mode", "type": "Enum", "values": "{\"range\":[\"1\",\"2\"]}" } ] }, "success": true, "t": 1723798807906, "tid": "ef9163655bad11ef9a8c4604aebef837" }

{"103":"Flip","106":"Motion detector sensitivity","108":"Night Vision","109":"获取存储卡容量","110":"存储卡状态","111":"存储卡格式化","115":"Motion Detection","117":"格式化状态","134":"Motion","231":"Feed","232":"Food Weight","233":"Realtime Data","234":"History Data","235":"短音录制","236":"Schedule"}


To Reproduce Steps to reproduce the behavior including the device the issue was observed with:

  1. Add new device
  2. User Smart life app
  3. Fill in device specifications

Other devices in Smart Life app can be added no problem, in the same network.

Expected behavior Device should be added to Home Assistant and usable.

Additional context Add any other context about the problem here.

If the bug involves a device, then please include device diagnostics from Settings / Devices & Services / Tuya Local (your device) / "1 device" N.a.

Please check if there are messages from Tuya Local in the Home Assistant log (Settings / System / Logs), and include those too. Here are logs from Home Assistant when enabling debug logging while adding the device:

`This error originated from a custom integration.

Logger: custom_components.tuya_local.config_flow Source: custom_components/tuya_local/config_flow.py:406 integration: Tuya Local (documentation, issues) First occurred: 10:27:49 (2 occurrences) Last logged: 10:51:40

Could not find device: xxxxxxxxx17v`

`This error originated from a custom integration.

Logger: custom_components.tuya_local.device Source: custom_components/tuya_local/device.py:564 integration: Tuya Local (documentation, issues) First occurred: 10:28:25 (3 occurrences) Last logged: 10:52:04

Failed to refresh device state for Test.`

2024-08-16 11:21:16.874 DEBUG (MainThread) [custom_components.tuya_local.config_flow] Adding device: bfa1f4d445f7bebbccr17v 2024-08-16 11:21:16.875 DEBUG (MainThread) [custom_components.tuya_local.config_flow] Device count: 2 2024-08-16 11:21:16.875 DEBUG (MainThread) [custom_components.tuya_local.config_flow] Hub count: 0 2024-08-16 11:21:21.973 DEBUG (MainThread) [custom_components.tuya_local.config_flow] Scanning network to get IP address for bfa1f4d445f7bebbccr17v. 2024-08-16 11:21:21.973 WARNING (MainThread) [custom_components.tuya_local.config_flow] Could not find device: bfa1f4d445f7bebbccr17v 2024-08-16 11:21:34.015 DEBUG (MainThread) [custom_components.tuya_local.device] Refreshing device state for Test 2024-08-16 11:21:34.016 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3 2024-08-16 11:21:39.049 DEBUG (SyncWorker_43) [custom_components.tuya_local.device] Test refreshed device state: null 2024-08-16 11:21:39.050 DEBUG (MainThread) [custom_components.tuya_local.device] Retrying after exception <class 'TypeError'> argument of type 'NoneType' is not iterable (0/3) 2024-08-16 11:21:39.050 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3 2024-08-16 11:21:44.071 DEBUG (SyncWorker_33) [custom_components.tuya_local.device] Test refreshed device state: null 2024-08-16 11:21:44.072 DEBUG (MainThread) [custom_components.tuya_local.device] Retrying after exception <class 'TypeError'> argument of type 'NoneType' is not iterable (1/3) 2024-08-16 11:21:44.072 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3 2024-08-16 11:21:45.547 DEBUG (MainThread) [custom_components.tuya_local.device] Waterkoker received {"1": false, "2": 23, "8": 90, "15": "0", "16": "5", "103": false, "104": 5, "full_poll": true} 2024-08-16 11:21:45.549 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for range of value 2024-08-16 11:21:45.549 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for range of value 2024-08-16 11:21:45.549 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for step of value 2024-08-16 11:21:45.549 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Step for value is 30 with scale 1 2024-08-16 11:21:45.550 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 18 (sensor), unable to determine valid values 2024-08-16 11:21:45.550 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for range of temperature 2024-08-16 11:21:45.550 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for range of temperature 2024-08-16 11:21:45.551 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] operation_mode values: ['Off', 'Keep warm', 'Boil'] 2024-08-16 11:21:45.551 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Silvercrest kettle: Mapped dps 1 value from False to Off 2024-08-16 11:21:45.551 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Silvercrest kettle: Mapped dps 1 value from False to Off 2024-08-16 11:21:45.551 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Silvercrest kettle: Mapped dps 1 value from False to Off 2024-08-16 11:21:45.552 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Silvercrest kettle: Mapped dps 1 value from False to Off 2024-08-16 11:21:49.094 DEBUG (SyncWorker_51) [custom_components.tuya_local.device] Test refreshed device state: null 2024-08-16 11:21:49.095 DEBUG (MainThread) [custom_components.tuya_local.device] Retrying after exception <class 'TypeError'> argument of type 'NoneType' is not iterable (2/3) 2024-08-16 11:21:49.095 ERROR (MainThread) [custom_components.tuya_local.device] Failed to refresh device state for Test. 2024-08-16 11:21:49.096 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3 2024-08-16 11:22:02.383 DEBUG (MainThread) [custom_components.tuya_local.device] Refreshing device state for Test 2024-08-16 11:22:02.383 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3 2024-08-16 11:22:07.617 DEBUG (SyncWorker_9) [custom_components.tuya_local.device] Test refreshed device state: null 2024-08-16 11:22:07.618 DEBUG (MainThread) [custom_components.tuya_local.device] Retrying after exception <class 'TypeError'> argument of type 'NoneType' is not iterable (0/11) 2024-08-16 11:22:07.618 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.1 2024-08-16 11:22:07.642 DEBUG (SyncWorker_16) [custom_components.tuya_local.device] Test refreshed device state: {"Error": "Unexpected Payload from Device", "Err": "904", "Payload": ""} 2024-08-16 11:22:07.642 WARNING (SyncWorker_16) [custom_components.tuya_local.device] Test protocol error 904: Unexpected Payload from Device 2024-08-16 11:22:07.642 DEBUG (SyncWorker_16) [custom_components.tuya_local.device] new state (incl pending): {"updated_at": 1723800127.641925}

capitar06 commented 3 months ago

Maybe the device is not supported, but I believe the error message should be different according to the docs. So just in case I've reported this as a bug.

Log also mentions the device could not be found, meanwhile its present and working in the Smart life app.

make-all commented 3 months ago

Seems like a duplicate of https://github.com/make-all/tuya-local/issues/507#issuecomment-1528889860 where setting the protocol to 3.2 was required to make a Pet feeder work.

capitar06 commented 3 months ago

Seems like a duplicate of #507 (comment) where setting the protocol to 3.2 was required to make a Pet feeder work.

Thanks, I tried Auto as protocol but it didnt work, 3.2 seemed to be the fix. Is there some documentation for this specific device? About the entities etc. I'm not sure under which device this one falls in the Tuya local > Devices folder. Thanks

make-all commented 3 months ago

Protocol 3.2 and 3.3 are almost identical and the integration cannot tell them apart automatically. There is no documentation on which devices use which protocol, the auto setting is just trial and error, and the cloud device detection uses some network discovery tricks to narrow it down.

Unfortunately Tuya pet feeder, camera and some other device types do not reply with much info when polled, so you can only try each config that appears to match and check yourself whether other entities match.

capitar06 commented 3 months ago

Protocol 3.2 and 3.3 are almost identical and the integration cannot tell them apart automatically. There is no documentation on which devices use which protocol, the auto setting is just trial and error, and the cloud device detection uses some network discovery tricks to narrow it down.

Unfortunately Tuya pet feeder, camera and some other device types do not reply with much info when polled, so you can only try each config that appears to match and check yourself whether other entities match.

Thanks for the quick reply. Do you know if there is any way to see which .yaml file is begin used by a device which is added in HA? Right now I don't know which .yaml this pet feeder is using and I would like to add some DP's. I think those should be added in the .yaml file the device uses, correct? If so, is there a way to verify which .yaml it uses? I couldn't find the exact make/model.

make-all commented 3 months ago

No you should leave the existing config files alone, as they are correct for specific devices. After trying all the matching configs that are for other brands of Pet feeder, if none are a match, make a copy of the closest one to start your modifications from.

The name of the config file is shown when you set it up. If you download the device diagnostics, you can see the name of the current config in there.