tuya-local icon indicating copy to clipboard operation
tuya-local copied to clipboard

Holman WX1 Tap Timer won't Add to configuration

Open jeeshofone opened this issue 1 year ago • 7 comments

Describe the bug When adding the WX1 Tap Timer to Home Assistant via either cloud or manual mechanisms the device does not add. I am adding the device via the hub after it is paired to Tuya. I can control the device with Tuya Cloud App. I am not leaving the IP address blank. To Reproduce Steps to reproduce the behavior including the device the issue was observed with:

  • Reset Device and remove from Tuya
  • Re:Pair To Tuya and close app
  • Use python -m tinytuya wizard to get devices
  • Use python -m tinytuya scan to get device details (device id, IP(static mapped in Opnsense), local key, version
  • Add to home assistant filling out all fields for the hub (device, ip, local key, version) the Sub device ID (tested with and without the sub device id)

Receive error:

Unable to connect to your device with those details. It could be an intermittent issue, or they may be incorrect.

Screenshot 2024-05-26 at 8 05 24 PM Screenshot 2024-05-26 at 9 06 47 PM

  • reset device and try again (this was me testing for an issue in escaping keys with ',"_{ etc

Expected behavior A clear and concise description of what you expected to happen.

  • I expected to be able to add the device as it is in the supported device list

Additional context Add any other context about the problem here. Discussed in https://github.com/make-all/tuya-local/discussions/1309

TinyTuya Setup Wizard [1.13.2]

    Existing settings:
        API Key=<redacted>
        Secret=<redacted>
        DeviceID=<redacted>
        Region=eu

    Use existing credentials (Y/n):

Download DP Name mappings? (Y/n):


Device Listing

[
    {
        "name": "WX1 Tap Timer",
        "id": "<redacted>",
        "key": "<redacted>",
        "mac": "",
        "category": "kg",
        "product_name": "WX1 Tap Timer",
        "product_id": "zrsgzc8jktsricjj",
        "biz_type": 0,
        "model": "WX1TT",
        "sub": true,
        "icon": "https://images.tuyaeu.com/smart/icon/ay1556838860681oKmdO/ab17f6e4e677bba7d3868a7a57cfe5b7.png",
        "uuid": "<redacted>",
        "node_id": "111",
        "mapping": {},
        "parent": "<redacted>"
    },
    {
        "name": "Wi-Fi Socket",
        "id": "<redacted>",
        "key": "<redacted>",
        "mac": "",
        "category": "cz",
        "product_name": "Wi-Fi Socket",
        "product_id": "hzsl8cxxtpd0x56b",
        "biz_type": 0,
        "model": "Emate Socket",
        "sub": true,
        "icon": "https://images.tuyaeu.com/smart/icon/ay1556838860681oKmdO/a475d09a86f87279a5fb63d3e8bcba84.png",
        "uuid": "<redacted>",
        "node_id": "11B",
        "mapping": {
            "1": {
                "code": "switch_1",
                "type": "Boolean",
                "values": {}
            }
        },
        "parent": "<redacted>"
    },
    {
        "name": "Wi-Fi Hub",
        "id": "<redacted>",
        "key": "<redacted>",
        "mac": "7c:f6:66:c9:09:68",
        "uuid": "ec6019439941fa66",
        "sn": "1000376290074E",
        "category": "wg2",
        "product_name": "Wi-Fi Hub",
        "product_id": "lzjw7vgzngzrzy74",
        "biz_type": 0,
        "model": "EMateGateWay",
        "sub": false,
        "icon": "https://images.tuyaeu.com/smart/icon/ay1556838860681oKmdO/e47c08d07b3801b3ea8890b3f548bc7f.png",
        "mapping": {}
    },
    <other devices redacted>
]

>> Saving list to devices.json
    6 registered devices saved

>> Saving raw TuyaPlatform response to tuya-raw.json

Poll local devices? (Y/n):

Scanning local network for Tuya devices...
    2 local devices discovered

Polling local devices...
    [Gwen                     ] 10.10.0.118        - No Response
    [Kogan Bladeless Purifier ] 10.40.0.13         - [On]  - DPS: {'1': True, '2': '1', '3': 'close', '8': True, '9': 23, '10': 20, '11': '0', '12': 0, '13': 0, '102': False, '103': False, '106': '2', '107': False}
    [Kogan Smart Portable Air ] Error: No IP found
    [WX1 Tap Timer            ] Error: No IP found
    [Wi-Fi Hub                ] 10.40.0.180        - No Response
    [Wi-Fi Socket             ] Error: No IP found

>> Saving device snapshot data to snapshot.json


>> Saving IP addresses to devices.json
    3 device IP addresses found

Done.

(tiny) will@Wills-MacBook-Pro-4 tiny % python -m tinytuya scan

TinyTuya (Tuya device scanner) [1.13.2]

[Loaded devices.json - 6 devices]

Scanning on UDP ports 6666 and 6667 and 7000 for devices for 18 seconds...

Kogan Bladeless Purifier Fan Heater   Product ID = 3permbmoa6lq7zvu  [Valid Broadcast]:
    Address = 10.40.0.13   Device ID = <redacted> (len:22)  Local Key = <redacted>  Version = 3.3  Type = default, MAC = 50:8a:06:f0:15:c1
    Status: {'1': True, '2': '1', '3': 'close', '8': True, '9': 23, '10': 20, '11': '0', '12': 0, '13': 0, '102': False, '103': False, '106': '2', '107': False}
Wi-Fi Hub   Product ID = keyth3n5me5jqu95  [Valid Broadcast]:
    Address = 10.40.0.180   Device ID = <redacted> (len:22)  Local Key = <redacted>  Version = 3.3  Type = default, MAC = 7c:f6:66:c9:09:68
    Access rejected by 10.40.0.180 (check key): Invalid JSON Response from Device: devid not found
Scan completed in 18.055 seconds

Scan Complete!  Found 2 devices.
Broadcasted: 2
Versions: 3.3: 2

>> Saving device snapshot data to snapshot.json

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

  • can't do this as the device does not add. Please check if there are messages from Tuya Local in the Home Assistant log (Settings / System / Logs), and include those too.
2024-05-26 21:14:31.158 DEBUG (MainThread) [custom_components.tuya_local.device] Refreshing device state for Test
2024-05-26 21:14:31.158 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3
2024-05-26 21:14:31.235 DEBUG (MainThread) [custom_components.tuya_local.device] Retrying after exception <class 'AttributeError'> Network Error: Device Unreachable (0/3)
2024-05-26 21:14:31.235 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Bedroom Air Conditioner to 3.4
2024-05-26 21:14:31.287 DEBUG (SyncWorker_11) [custom_components.tuya_local.device] Test refreshed device state: {"Error": "Invalid JSON Response from Device", "Err": "900", "Payload": "devid not found"}
2024-05-26 21:14:31.287 WARNING (SyncWorker_11) [custom_components.tuya_local.device] Test protocol error 900: Invalid JSON Response from Device

Additionally:

2024-05-26 19:35:17.437 DEBUG (MainThread) [custom_components.tuya_local.config_flow] Hub count: 0
2024-05-26 19:35:20.114 DEBUG (MainThread) [custom_components.tuya_local.config_flow] Scanning network to get IP address for bfbd1b453049b3af8fvcvd.
2024-05-26 19:35:20.116 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 88, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp_session/__init__.py", line 199, in factory
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 295, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 71, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 368, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 414, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 518, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tuya_local/config_flow.py", line 375, in async_step_search
    local_device = await self.hass.async_add_executor_job(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tuya_local/config_flow.py", line 603, in scan_for_device
    return tinytuya.find_device(dev_id=id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tinytuya/core.py", line 641, in find_device
    client.bind(("", UDPPORT))
OSError: [Errno 98] Address in use```

however this issue is with the cloud add is gone once i uninstalled rospogrigio/localtuya

If applicable, add screenshots to help explain your problem.

jeeshofone avatar May 26 '24 11:05 jeeshofone

You seem to be getting the same error from tinytuya standalone as you are getting from this integration. Most likely it is a problem with the configuration parameters you are using. The details are slightly different for a hub.

make-all avatar May 26 '24 13:05 make-all

Hi @make-all - thanks for that - what information of the configuration parameters can I provide to assist.

I first try only adding only the hub ending in vcvd: Screenshot 2024-05-27 at 9 14 04 AM

Logs

2024-05-27 09:13:59.059 WARNING (SyncWorker_10) [custom_components.tuya_local.device] Test protocol error 900: Invalid JSON Response from Device

Then I try adding the hub with the sub device on the WX1 (ending in izo5): Screenshot 2024-05-27 at 9 15 26 AM

2024-05-27 09:14:47.747 WARNING (SyncWorker_50) [custom_components.tuya_local.device] Test protocol error 900: Invalid JSON Response from Device

Then I try adding the WX1 as the main device without the hub:

Screenshot 2024-05-27 at 9 14 53 AM

2024-05-27 09:15:19.927 ERROR (MainThread) [custom_components.tuya_local.device] Failed to refresh device state for Test.

jeeshofone avatar May 26 '24 23:05 jeeshofone

Never got it to work. Be interested in how others have successfully integrated this into a local tuya setup.

TheSimTek avatar May 28 '24 06:05 TheSimTek

@Brazen00 added it in https://github.com/make-all/tuya-local/pull/979 - I wonder if they could help us out?

jeeshofone avatar May 28 '24 07:05 jeeshofone

Based on what is tested in the new config flow, device id should be the device id of your hub, and sub device id should be the uuid of the sub device.

make-all avatar May 29 '24 12:05 make-all

Based on what is tested in the new config flow, device id should be the device id of your hub, and sub device id should be the uuid of the sub device.

That was one method I tried in the above troubleshooting description

I have tried it again tonight and found that with the latest version, the process never finishes (I let it go for 5min) This is the only relevant line in the logs 2024-06-04 01:02:15.398 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3

Screenshot 2024-06-04 at 1 13 13 AM I used the UUID of the sub device (same as the sub device id for the sub device id and the device id as the id of the hub. The hub also has a switched outlet device in it. I tested it again the same way with identical results. Also made sure the Tuya app was closed.

The device does work when testing in the Tuya app alone.

jeeshofone avatar Jun 03 '24 15:06 jeeshofone

Would anyone be able to suggest next steps for debugging here?

jeeshofone avatar Jun 26 '24 00:06 jeeshofone

same issue, was it ever resolved?

justinmaiuto avatar Oct 23 '24 12:10 justinmaiuto

I got this working.

Using the cloud config I can "choose device" as the timer and "Choose gateway" as the wifi hub and it displays the "correct" info - the device id is the id of the hub, the local key matches that from the hub, and the sub device id is the id/uuid of the timer. Submit sits there for a while and then "Unable to connect to your device with those details. It could be an intermittent issue, or they may be incorrect.".

However I saw elsewhere somebody was entering node-id as the sub device id. Using tinytuya for me this was B21, and once I put that in instead of the uuid, it worked!

michaelblight avatar Nov 23 '24 04:11 michaelblight

Interesting. The node_id has disappeared from the iot.tuya.com info for my sub devices, but it used to be the same as the uuid. It seems not all hubs are made the same.

make-all avatar Nov 23 '24 07:11 make-all

However I saw elsewhere somebody was entering node-id as the sub device id

I just did that too and it works for me. Thanks @michaelblight

elliotsegler avatar Nov 23 '24 07:11 elliotsegler

I can confirm this is working for me now - Thanks for everyone's help!

jeeshofone avatar Dec 27 '24 04:12 jeeshofone

I am still having no luck. I can get the Device ID / IP Address / Local Key and Sub Device ID to all auto populate - however still no luck getting actually connecting. I tried changing the Sub Device ID from 571 (which was auto populated when adding the device) to B21 and it's still not working.

The node_id is now no longer shown on the Tuya IOT Platform, however the uuid is shown (same as the tap timer device ID). I have tried that as well, however that didn't work either.

Does anyone have another suggestions ?

Stewie923 avatar Jan 19 '25 07:01 Stewie923

Well - I just did a full reboot of Home Assistant (not just a restart) and tried to install again using the cloud setup - and the WX1 appeared immediately.

This is great, after a year of mucking around I now have control of this device.

Thanks to everyone that has provided advice and made the necessary changes.

Stewie923 avatar Jan 20 '25 08:01 Stewie923

Hi guys and gals, could someone provide some basic instructions on how to get this going, I see mention of many different Tuya derived integrations and I’m a bit lost as to which one I should be using, and where this IoT integration api setup is I have two wifi hubs/sockets and then 2x wx2 and 2x wx1 and looking to get soil moisture maybe later this year

JoelSimmo avatar Oct 17 '25 13:10 JoelSimmo