Local Tuya Integration

Local Tuya is in the HACS store. You’ll need to add it from their before it will show up as an Integration.

Is it possible to add new entity to a device after the initial configuration completed? I only found edit option for the already added entities, but no option to add new. I can only add new entities if I delete the whole device and start to add entities from scratch?

1 Like

No. But you might have to do it manually.

@mr.perfect unfortunately some time a few updates ago this functionality was broken and had yet to be resolved. There has been no response even if this was intentional and if so why.

I have it here… However clicking on as new device does not show devices, only the ellipse to add the new device manually.

1 Like

@avd706 I’m not clear on what you are referring to? Devices are either added manually or auto-discovered, are you talking about devices or entities?

Oh, nevermind

I have successfully added Local Tuya to my home assistant,
My issue is when I go to add a device none of my devices populate.
Any idea?
If not then my next question is where do I get all the information to manually add the devices?

Did you try to add a device manually? I only have 1 device and it’s been awhile since I added it, and the Local Tuya add-on changed so I don’t remember what you are prompted for when you choose to manually add a device.

If you could provide some screenshots it would help.

Hi All, I cant find the DP_ID in discovered list, in Tuya developer I can see the the DP_ID codes but in home assistant it is not populated, only ID20 (switch) and ID21 (color mode)


any idea ?

Hi all
2 problems here :frowning:

  1. I have readded a switch (for bath lights turn on-off). Until now when I turned on the switch in HA it stayed in on position until I turn it off. Now it turns on the light and immediately the HA button goes to off position (although the light turns on and stay on)

Here the light is open…
image

How can I fix this? I changed some values after edit the device but the problem remains.

  1. I cannot remove the above device. I uncheck the device as prompt, but I get an error regarding the key and the prompt to check the logs

here are the logs (the id is correct)

Logger: custom_components.localtuya.config_flow
Source: custom_components/localtuya/config_flow.py:247
Integration: LocalTuya (documentation, issues)
First occurred: 22:52:57 (1 occurrences)
Last logged: 22:52:57

Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/localtuya/config_flow.py", line 580, in async_step_configure_device
    self.dps_strings = await validate_input(self.hass, user_input)
  File "/config/custom_components/localtuya/config_flow.py", line 247, in validate_input
    data[CONF_DEVICE_ID],
KeyError: 'device_id'
Logger: homeassistant
Source: custom_components/localtuya/__init__.py:142
Integration: LocalTuya (documentation, issues)
First occurred: 22:52:15 (1 occurrences)
Last logged: 22:52:15

Error doing job: Exception in callback _SelectorDatagramTransport._read_ready()
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 1027, in _read_ready
    self._protocol.datagram_received(data, addr)
  File "/config/custom_components/localtuya/discovery.py", line 70, in datagram_received
    self.device_found(decoded)
  File "/config/custom_components/localtuya/discovery.py", line 79, in device_found
    self._callback(device)
  File "/config/custom_components/localtuya/__init__.py", line 142, in _device_discovered
    device = hass.data[DOMAIN][TUYA_DEVICES][device_id]
KeyError: '11733687b4e62d7dbfab'

How can I remove the device in order to add it again later??

I hope that someone can help.
Thanks


On my home HA instace I have been using local-tuya for quite some time without any issues, but now I am trying to install it on some other HA (with another Tuya account and devices) and I keep getting “Unknown error occured”. Has anyone any idea what could be an issue and how to fix it.

I also tried to put as user ID mail for logiin or ID from the tuya iot platfrom, but no success. Also removed the implementation and reinstalled it without any difference

1 Like

I find the energy monitor slightly off when measuring something where the consumption keeps changing, this might be due to the scanning interval… There is an option to amend this in the integration, but what would be a good number to try? (what is the default?)

Hello,
I have problem configuring local tuya.
I have cloud Tuya integration with 5 termostatic valves running, working OK.
They are connected to wireless Tuya mini-gateway, which connects to wifi, so tuya has its own address range.
I can set up a local-tuya integration (first screen) successfully, but when adding devices, it sees only gateway and I have no clue, how to add custom device.

Please any help
Jan

Tuya hub should be off if you want to connect it with HA. It’s a wifi or zigbee connection?

Hello nsacras,
now i’m on tuya integration and devices are hooked to the wifi zigbee hub.
I have no supported zigbee usb device localy on homeassistant running “Pi-C”.
If that is necessary, i will stick to the chinese cloud, hope they dont harm my valves"-)

thanks
SLMQ

Hi, I have entered my credential in local Tuya taken from my Cloaud API account

Then I am trying to add a device.
image

It is automatically discovered
image
But I still need to enter the local key !


I tried to follow the guide to recover the local key but that’s not working.
Neither looking into folders in my mobile phone nor trying to track the request using the sniffing tool.

Is there an easiest way to retrieve it ?

1 Like

I was able to pull a few of the local keys from the iot.tuya.com a few months back, but I wanted to add a new one today and it seems that Tuya is now charging for using the cloud service to pull the local keys. Haven’t found another way to do it yet :frowning_face:

I found my local key today on iot.tuya.com

Cloud → API Explorer → Smart Home Device System → Device Management → Get Device Details
see screenshot

If you run HA Supervised or Container (or any other Linux based rig) you can also do;

sudo npm i @tuyapi/cli -g

After tuyapi/cli is installed to optain your keys run from cli:

sudo tuya-cli wizard

a. You will be prompted to provide your your API key from tuya.com.
[Enter]
b. Now you have to provide your API secret from tuya.com.
[Enter]
c. Lastly provide a ‘virtual ID’ of a device currently registered in the app
[Enter]

Now you’ll get a list of all currently active tuya based devices including their names, IDs and keys displayed on the console.

i.e:

[
  {
    name: 'Lichtschalter Wohnzimmer OR',
    id: '[some-string]',
    key: '[some-string]'
  },
  {
    name: 'Lichtschalter Gästezimmer',
    id: '[some-string]',
    key: '[some-string]'
  },
  {
    name: 'Lichtschalter Diele 1',
    id: '[some-string]',
    key: '[some-string]'
  }
]

Using sudo tuya-cli wizard is much more comfortable and faster compared to having to login to your tuya account through your web browser and search through your devices for the valid keys.

1 Like