Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Holman WX1 Tap Timer won't Add to configuration #1951

Open
jeeshofone opened this issue May 26, 2024 · 7 comments
Open

Holman WX1 Tap Timer won't Add to configuration #1951

jeeshofone opened this issue May 26, 2024 · 7 comments
Labels
awaiting feedback Needs more information bug Something isn't working

Comments

@jeeshofone
Copy link

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 #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 jeeshofone added the bug Something isn't working label May 26, 2024
make-all added a commit that referenced this issue May 26, 2024
Allow the config to proceed even when local network scan throws an error.

Issue #1951
@make-all
Copy link
Owner

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.

@jeeshofone
Copy link
Author

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.

@TheSimTek
Copy link

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

@jeeshofone
Copy link
Author

@Brazen00 added it in #979 - I wonder if they could help us out?

@make-all
Copy link
Owner

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 make-all added the awaiting feedback Needs more information label Jun 1, 2024
@jeeshofone
Copy link
Author

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
Copy link
Author

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

timlaing pushed a commit to timlaing/tuya-local that referenced this issue Aug 8, 2024
Allow the config to proceed even when local network scan throws an error.

Issue make-all#1951
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback Needs more information bug Something isn't working
Projects
Status: 🏗 Stalled
Development

No branches or pull requests

3 participants