Tuya local

I would say you should add the light as usual, then unmark the text that says something like “Don’t add more entities”, and then go on and add binary sensor for PIR and motion.

When doing that, I can see some values but they can only be on/off. For example the range will then be on or off, instead of low / middle / high. When using other type of devices I can’t change this either. Is there a different way to do this?

Ref. Local Key.
I have read 3 different ways to get local keys. To the best of my understanding Tuya has updated their side of the software and now we cannot get anymore the local keys. Did I miss something? I wrote to Tuya asking for an official way to obtain these local keys or if this functionality is not supported anymore. If the functionality is not supported anymore I shall return products and not purchase any of Tuya products. Concept for Tuya. Remove functionality loose customers.

1 Like

Out of curiousity I did just give it a try:

Getting the device id’s and local keys following this guide is actually still working.

If you run ‘tuya-cli wizard’ if shows all of the local keys. Once all the setup is done, npm/nodejs etc from the guide posted.
Works great. I add a new device the other day. Showed up on my iot.tuya account and then ran tuya-cli wizard again to grab the local key.

1 Like

I set this up a while ago using tuya-cli wizard and about a month or 2 ago received an email from tuya basically saying my free developer account was closing unless I wanted to pay. I didn’t read it completely because I didn’t plan on getting any more tuya devices so I didn’t care.
Low and behold I bought 2 more tuya led’s for my kids. I ran the tuya-cli wizard anyways even though they closed my account, it worked no problems and now have my kids lights connected to HA.
Thanks to all for the work to create and set this up.

They don’t close the account, they switch you to a very basic account. Enough for most of our needs tho. Had the same email and now I’m good to go for another year for free.

appreciate all information received. with the inf. and encouragement I have been able to get the local keys.
with ‘tuya-cli wizard’ method I get: There was an issue fetching that device. Make sure your account is linked and the ID is correct.
while with the ‘Get device details’ web interface I get local key.

Thanks for the inf. I was able to get the local keys.

1 Like

It’s a struggle but you can get there in the end. I had to spin up a new debían vm, install npm nodejs and all the bits to get the tuya wizard to work. Well worth it though.

Hello all:
Im trying to configure a tuya compatible LED module using tuya local. for now i can control the on/off but cant control the rgb functions, im not sure if you have found a solution for this?

Not sure if you used yaml or the flow but you will need to configure all of the values and it could be a bit of trial and error.
Using either flow or yaml, try these values.

      - platform: light
        friendly_name: Device Light
        id: 4 # Usually 1 or 20
        color_mode: 21 # Optional, usually 2 or 21, default: "none"
        brightness: 22 # Optional, usually 3 or 22, default: "none"
        color_temp: 23 # Optional, usually 4 or 23, default: "none"
        color: 24 # Optional, usually 5 (RGB_HSV) or 24 (HSV), default: "none"
        brightness_lower: 29 # Optional, usually 0 or 29, default: 29
        brightness_upper: 1000 # Optional, usually 255 or 1000, default: 1000
        color_temp_min_kelvin: 2700 # Optional, default: 2700
        color_temp_max_kelvin: 6500 # Optional, default: 6500
        scene: 25 # Optional, usually 6 (RGB_HSV) or 25 (HSV), default: "none"
        music_mode: False # Optional, some use internal mic, others, phone mic. Only internal mic is supported, default: "False"

Hello,

Have you found any solution? If yes, please guide I have few of these switches and I am stuck with IDs to control correct button and control fan speed.

Thanks

Hi all
I have a single tuya switch in wc which I just added and it is working fine. I have problem with a second (2 gang) switch because I can only add 1 of the 2 gangs. Does anybody knows how I could have available both of the gangs?

image

image

edit: I found the solution from another forum member…

Thanks!

RedSnowDonkeyDean Steele

Apr 20

When you use the Local Tuya User Interface (is that a ‘wizard’?) to add the initial device (as a switch), the next window will ask you to add more entities, which is where you select the individual switches and add them in turn. That’s for WiFi switches, though - I don’t have Zigbee switches, so I don’t know if it’s different.

Hey has anyone gotten this integration to send scenes to your lights?
I have some string lights that have 9 scenes i can set them via the cli
but in hass it wont work
image
I updated the scene list in light.py but it doesnt seem to want to send the value to the light
image
They show up in hass


Any help would be appreciated

Figured it out, if you have Atomi outdoor string lights you need to set the color mode to the scene dps

2 Likes

Why was @Eeekfz’s reply hidden? I have been trying to follow Tuya’s v2 Home Assistant progress and this comment seems to provide useful information on that.

I guess because this particular thread is about Tuya Local/Local Tuya and “advertisments” to promote a different approach to Tuya on HA is unethical here besides of simply off-topic.

Tuya Official Home Assistant Integration has its own thread on the forum.

@postlund i’ve added example for covers to yaml

- host: 192.168.1.x
  device_id: xxxxx
  local_key: xxxxx
  friendly_name: Tuya Device
  protocol_version: "3.3"
  entities:
    - platform: cover
      friendly_name: Device Cover
      id: 2
      open_close_cmds: ["on_off"] # Optional, default: "on_off"
      positioning_mode: ["none"] # Optional, default: "none"
      currpos_dps: 3 # Optional, required only for "position" mode
      setpos_dps: 4  # Optional, required only for "position" mode
      span_time: 25  # Full movement time: Optional, required only for "timed" mode

and got error:
Invalid config for [localtuya]: extra keys not allowed @ data[‘localtuya’][0][‘entities’][0][‘currpos_dps’]. Got 3
extra keys not allowed @ data[‘localtuya’][0][‘entities’][0][‘open_close_cmds’]. Got [‘on_off’]
extra keys not allowed @ data[‘localtuya’][0][‘entities’][0][‘positioning_mode’]. Got [‘none’]
extra keys not allowed @ data[‘localtuya’][0][‘entities’][0][‘setpos_dps’]. Got 4
extra keys not allowed @ data[‘localtuya’][0][‘entities’][0][‘span_time’]. Got 25
value must be one of [‘binary_sensor’] for dictionary value @ data[‘localtuya’][0][‘entities’][0][‘platform’]. Got ‘cover’. (See /config/configuration.yaml, line 362).

what is correct format for yaml?

When HA is running fine the local tuya integration seems to work fine… If I however restart it I seem to lose devices:

Logger: custom_components.localtuya.common
Source: custom_components/localtuya/pytuya/init.py:637
Integration: LocalTuya integration (documentation, issues)
First occurred: 19:16:15 (113 occurrences)
Last logged: 19:26:13

[bff…qdi] Connect to 192.168.0.187 failed

Traceback (most recent call last): File “/config/custom_components/localtuya/common.py”, line 139, in _make_connection self._interface = await pytuya.connect( File “/config/custom_components/localtuya/pytuya/init.py”, line 637, in connect _, protocol = await loop.create_connection( File “/usr/local/lib/python3.9/asyncio/base_events.py”, line 1056, in create_connection raise exceptions[0] File “/usr/local/lib/python3.9/asyncio/base_events.py”, line 1041, in create_connection sock = await self._connect_sock( File “/usr/local/lib/python3.9/asyncio/base_events.py”, line 955, in _connect_sock await self.sock_connect(sock, address) File “/usr/local/lib/python3.9/asyncio/selector_events.py”, line 502, in sock_connect return await fut File “/usr/local/lib/python3.9/asyncio/selector_events.py”, line 537, in _sock_connect_cb raise OSError(err, f’Connect call failed {address}’) OSError: [Errno 113] Connect call failed (‘192.168.0.187’, 6668)

Anybody else seeing this? Why would connection fail on restart? I assuming the keys, etc, are managed by the device itself, nothing to do with HA?

Edit: I just restarted HA and all devices are back again… So obviously not a key issue.
Edit2: Although the devices are back, and I unable to control them… The report as being ‘on’ (and they are), but I cant switch them off.