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

Unable to Add New GHome Devices #1868

Open
3 tasks done
ulanking opened this issue Dec 15, 2024 · 0 comments
Open
3 tasks done

Unable to Add New GHome Devices #1868

ulanking opened this issue Dec 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ulanking
Copy link

The problem

Have MANY LocalTuys devices. Purchased several GHome devices. Successfully added the Ghome devices to Tuya Smart. Able to get the stats and details in jSON while in tuya developer. Unable to add them in Local Tuya - each dps reports "-1"

  "dps_strings": [
    "1 (value: -1)",
    "2 (value: -1)",
    "3 (value: -1)",
    "4 (value: -1)",
    "5 (value: -1)",
    "6 (value: -1)",
    "7 (value: -1)",
    "9 (value: -1)",
    "10 (value: -1)",
    "11 (value: -1)",
    "12 (value: -1)",
    "13 (value: -1)",
    "14 (value: -1)",
    "15 (value: -1)",
    "17 (value: -1)",
    "18 (value: -1)",
    "19 (value: -1)",
    "20 (value: -1)"
  ],

Environment

  • Localtuya version: 5.2.1
  • Home Assistant Core version: 2024.12.3
  • Does the device work using the Home Assistant Tuya Cloud component ?
  • Does the device work using the Tinytuya (https://github.com/jasonacox/tinytuya) command line tool ?
  • Was the device working with earlier versions of localtuya ? Which one? N/A
  • Are you using the Tuya/SmartLife App in parallel ?

Steps to reproduce

  1. LocalTuya --> Configure --> Add a new device --> Submit --> select "..." --> Submit --> Enter the required information including the Name, Host, Device ID, local Key, Protocol Version (currently 3.3 but tried the others), and the comma separated Manual DPS --> Submit
  2. It creates the device but all the values are "-1" and nothing functions.

DP dump

{
"result": {
"properties": [
{
"code": "switch_1",
"custom_name": "",
"dp_id": 1,
"name": "Switch 1",
"time": 1731966897302,
"type": "bool",
"value": true
},
{
"code": "switch_2",
"custom_name": "",
"dp_id": 2,
"name": "Switch 2",
"time": 1731966897302,
"type": "bool",
"value": true
},
{
"code": "switch_3",
"custom_name": "",
"dp_id": 3,
"name": "Switch 3",
"time": 1731966897302,
"type": "bool",
"value": true
},
{
"code": "switch_4",
"custom_name": "",
"dp_id": 4,
"name": "Switch 4",
"time": 1731966897302,
"type": "bool",
"value": true
},
{
"code": "switch_5",
"custom_name": "",
"dp_id": 5,
"name": "Switch 5",
"time": 1731966897302,
"type": "bool",
"value": true
},
{
"code": "switch_6",
"custom_name": "",
"dp_id": 6,
"name": "Switch 6",
"time": 1731966897302,
"type": "bool",
"value": true
},
{
"code": "usb_switch_1",
"custom_name": "",
"dp_id": 7,
"name": "Switch USB1",
"time": 1731966897302,
"type": "bool",
"value": true
},
{
"code": "countdown_1",
"custom_name": "",
"dp_id": 9,
"time": 1731966897302,
"type": "value",
"value": 0
},
{
"code": "countdown_2",
"custom_name": "",
"dp_id": 10,
"time": 1731966897302,
"type": "value",
"value": 0
},
{
"code": "countdown_3",
"custom_name": "",
"dp_id": 11,
"time": 1731966897302,
"type": "value",
"value": 0
},
{
"code": "countdown_4",
"custom_name": "",
"dp_id": 12,
"time": 1731966897302,
"type": "value",
"value": 0
},
{
"code": "countdown_5",
"custom_name": "",
"dp_id": 13,
"time": 1731966897302,
"type": "value",
"value": 0
},
{
"code": "countdown_6",
"custom_name": "",
"dp_id": 14,
"time": 1731966897302,
"type": "value",
"value": 0
},
{
"code": "usb_countdown_1",
"custom_name": "",
"dp_id": 15,
"time": 1731966897302,
"type": "value",
"value": 0
},
{
"code": "add_ele",
"custom_name": "",
"dp_id": 17,
"time": 1731979495000,
"type": "value",
"value": 2
},
{
"code": "cur_current",
"custom_name": "",
"dp_id": 18,
"time": 1731966897784,
"type": "value",
"value": 0
},
{
"code": "cur_power",
"custom_name": "",
"dp_id": 19,
"time": 1731966897784,
"type": "value",
"value": 0
},
{
"code": "cur_voltage",
"custom_name": "",
"dp_id": 20,
"time": 1731981296527,
"type": "value",
"value": 1216
},
{
"code": "fault",
"custom_name": "",
"dp_id": 26,
"time": 1731956240124,
"type": "bitmap",
"value": 0
},
{
"code": "relay_status",
"custom_name": "",
"dp_id": 38,
"time": 1731966897413,
"type": "enum",
"value": "memory"
},
{
"code": "light_mode",
"custom_name": "",
"dp_id": 40,
"time": 1731966897413,
"type": "enum",
"value": "relay"
},
{
"code": "child_lock",
"custom_name": "",
"dp_id": 41,
"time": 1731966897413,
"type": "bool",
"value": false
},
{
"code": "cycle_time",
"custom_name": "",
"dp_id": 42,
"time": 1731966897634,
"type": "string",
"value": ""
},
{
"code": "random_time",
"custom_name": "",
"dp_id": 43,
"time": 1731966897510,
"type": "string",
"value": ""
},
{
"code": "switch_inching",
"custom_name": "",
"dp_id": 44,
"name": "Inching Switch",
"time": 1731966897782,
"type": "string",
"value": ""
}
]
},
"success": true,
"t": 1731982941588,
"tid": "1b628096a61d11ef8a4986f0f11a78f3"
}

and from Tiny Tuya:
[PowerStrip24] 192.xxx.xxx.xxx - [On] - DPS: {'1': True, '2': True, '3': True, '4': True, '5': True, '6': True, '7': True, '9': 0, '10': 0, '11': 0, '12': 0, '13': 0, '14': 0, '15': 0, '18': 0, '19': 0, '20': 1220, '38': 'memory', '40': 'relay', '41': False, '42': '', '43': '', '44': ''}

Provide Home Assistant traceback/logs

The only consistent log entries I've seen are below for the device.

2024-12-15 12:44:47.727 ERROR (MainThread) [custom_components.localtuya.pytuya] [ebc...njz] Failed to get status: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/asyncio/tasks.py", line 507, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/locks.py", line 407, in acquire
    await fut
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 863, in detect_available_dps
    data = await self.status()
           ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 795, in status
    status = await self.exchange(DP_QUERY)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 769, in exchange
    msg = await self.dispatcher.wait_for(seqno, payload.cmd)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 450, in wait_for
    await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
  File "/usr/local/lib/python3.13/asyncio/tasks.py", line 506, in wait_for
    async with timeouts.timeout(timeout):
               ~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/timeouts.py", line 116, in __aexit__
    raise TimeoutError from exc_val
TimeoutError
2024-12-15 12:50:34.923 INFO (MainThread) [custom_components.localtuya.common] [ebc...njz] Trying to connect to 192.xxx.xxx.xxx...
2024-12-15 12:50:34.925 WARNING (SyncWorker_2) [homeassistant.helpers.frame] Detected that custom integration 'localtuya' calls async_dispatcher_send from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#async_dispatcher_send at custom_components/localtuya/common.py, line 351: async_dispatcher_send(self._hass, signal, self._status). Please report it to the author of the 'localtuya' custom integration
2024-12-15 12:50:34.932 ERROR (SyncWorker_51) [homeassistant.util.logging] Exception in _new_entity_handler when dispatching 'localtuya_entity_eb5502c366b4a04337quls': ('sensor.patio_lights_custom_color',)
Traceback (most recent call last):
  File "/config/custom_components/localtuya/common.py", line 263, in _new_entity_handler
    self._dispatch_status()
    ~~~~~~~~~~~~~~~~~~~~~^^
  File "/config/custom_components/localtuya/common.py", line 351, in _dispatch_status
    async_dispatcher_send(self._hass, signal, self._status)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/dispatcher.py", line 214, in async_dispatcher_send
    hass.verify_event_loop_thread("async_dispatcher_send")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 474, in verify_event_loop_thread
    frame.report_non_thread_safe_operation(what)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 368, in report_non_thread_safe_operation
    report(
    ~~~~~~^
        f"calls {what} from a thread other than the event loop, "
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
        error_if_integration=True,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 164, in report
    report_usage(
    ~~~~~~~~~~~~^
        what,
        ^^^^^
    ...<4 lines>...
        level=level,
        ^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 242, in report_usage
    _report_integration_frame(
    ~~~~~~~~~~~~~~~~~~~~~~~~~^
        what,
        ^^^^^
    ...<3 lines>...
        integration_behavior is ReportBehavior.ERROR,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 340, in _report_integration_frame
    raise RuntimeError(
    ...<5 lines>...
    )
RuntimeError: Detected that custom integration 'localtuya' calls async_dispatcher_send from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#async_dispatcher_send at custom_components/localtuya/common.py, line 351: async_dispatcher_send(self._hass, signal, self._status). Please report it to the author of the 'localtuya' custom integration

Additional information

Similar situation with a batch of plugs GHome purchased, added in Tuya Smart, can query via the tuya developer but gives a "-1" for all the DSP values

@ulanking ulanking added the bug Something isn't working label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant