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

LOHAS devices (and Tuya stack) driving me crazy #1890

Open
unlucio opened this issue Jan 12, 2025 · 1 comment
Open

LOHAS devices (and Tuya stack) driving me crazy #1890

unlucio opened this issue Jan 12, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@unlucio
Copy link

unlucio commented Jan 12, 2025

The problem

Hello,
I have 4 spotlights and a bulb from Lohas:
Screenshot_2025-01-12_at_14_30_57
I can control them using the Tuya app, and they appear in my Tuya developer portal. However, when I try to add the to localtuya I keep getting the following error:
Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists.
Screenshot 2025-01-12 at 15 20 51

I briefly managed to add 3 of the RGBW spotlights and the bulb using protocol 3.1, but they stopped responding briefly afterward.

During the brief moment they worked with localtuya they didn't seem to really match the the control pannel in HA.
Brightness, for example:
I set them all to full bright, and I saw them in full bright, yet the slider in HA sprang back to 23%.
The colors and white temperature were off too.

Despite this, they all continue to work fine in the Tuya mobile app.

During the short time I was able to control them with this module, I set a warmer white point on one of the spotlights. Now, I can’t return it to match the same white color as the others. Even if I set it back to 5000K using Home Assistant and the Tuya integration, it still appears orangish, closer to 4000K.

Environment

  • Localtuya version: 5.2.2
  • Home Assistant Core version: 2025.1.2
  • [] Does the device work using the Home Assistant Tuya Cloud component ? Yes (although the one with the off-white, does not get back to 5000k)
  • [] Does the device work using the Tinytuya (https://github.com/jasonacox/tinytuya) command line tool? IDK: meeting around with python in the console is not really my thing. I tried with https://github.com/TuyaAPI/ and they give weird and confusing results with that too: mostly connection reset, but yet Nmap finds port 6668 open on all of them. I was able to list the datapoints for one of them once (protocol 3.1), and then nothing
  • [] Was the device working with earlier versions of localtuya? I never tried before, it took me a while to find some documentation to wrap my head around the tuys datapints, and I'm still confused about them.
  • [] Are you using the Tuya/SmartLife App in parallel? Not while working on LocalTuya. I kept the app closed (and I’m certain it wasn’t running in the background) while trying to set up LocalTuya. I also deactivated the Tuya integration.
    I only opened the app after the spotlights stopped responding to LocalTuya. At that point, I tried to fix the one stuck on off-white and return it to white. I can control all the devices just fine from the Tuya app, although the “broken white one” is still “broken.”

Steps to reproduce

I'm a bit confused by this whole thing, I'll do what I can but really I'm just:

  1. Open HA UI
  2. Settings --> Device & Services --> LocalTuya integration
    3.Click on CONFUGURE
  3. Add a new device
  4. select one of those lights from the list
  5. verify Name, Host, ID, and LocalKey are as expected (and they are)
  6. Submit to move to the next screen
  7. I get the error
  8. change protocol version
  9. get the error again
  10. and so on

That time I was able to move to the next screen I sed the following datapoints:
Brightness (only for white color) --> 3
Color Temperature --> 4
Color Mode --> 2
Color --> 5
As I found them on the Tuya Developer portal:
Screenshot 2025-01-12 at 14 30 57

DP dump

As mentioned I'd rather not mess with python stuff and the shell, and they don't "answer me" despite nmap showing open ports.
I did screenshot the dropdown that time it worked from the UI:
Screenshot 2025-01-12 at 15 42 47

Additional information

I've been trying to set this integration up for months as I wasn't able to find clear documentation about the protocols and the data points. Today I was finally able to setup 2 LED strips, and I got stuck on these devices.
I'm still quite confused by the whole Tuya stack :(.

@unlucio unlucio added the bug Something isn't working label Jan 12, 2025
@unlucio
Copy link
Author

unlucio commented Jan 12, 2025

And now even the 2 strips I thought i configured stopped working:

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:245
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 20:36:15 (5 occurrences)
Last logged: 20:36:17

[281471456338144] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2795, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2838, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/adaptive_lighting/hass_utils.py", line 62, in service_func_proxy
    await existing_service.job.target(call)
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1006, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
        hass, entity, func, data, call.context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1078, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 644, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/usr/src/homeassistant/homeassistant/components/group/light.py", line 179, in async_turn_on
    await self.hass.services.async_call(
    ...<5 lines>...
    )
  File "/usr/src/homeassistant/homeassistant/core.py", line 2795, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2838, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/adaptive_lighting/hass_utils.py", line 62, in service_func_proxy
    await existing_service.job.target(call)
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1031, in entity_service_call
    raise result from None
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1628, in async_request_call
    return await coro
           ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1078, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 644, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/config/custom_components/localtuya/light.py", line 358, in async_turn_on
    if self.__is_color_rgb_encoded():
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/config/custom_components/localtuya/light.py", line 285, in __is_color_rgb_encoded
    return len(self.dps_conf(CONF_COLOR)) > 12
           ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
This error originated from a custom integration.

Logger: custom_components.localtuya.common
Source: custom_components/localtuya/pytuya/__init__.py:846
integration: LocalTuya integration (documentation, issues)
First occurred: 20:36:15 (1 occurrences)
Last logged: 20:36:15

[bfe...bp6] Failed to set DPs {21: 'white', 22: 1000, 23: 506}
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/common.py", line 335, in set_dps
    await self._interface.set_dps(states)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 846, in set_dps
    return await self.exchange(CONTROL, dps)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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

These are the logs I found.

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