Local Tuya Help

So with all the Tuya Uncertainty, I tried to change my lights to LocalTuya, After going to get the local keys from the IOT site, I tried to load in my lights by matching the Device Id to the Local Key. All of this worked, and I loaded 17 lights. Then a few hours later they all became unavailable. I looked in the forums and saw that to try to uninstall the integration and reinstall it, so I did that. The lights are still coming up at unavailable.
I think I have the newest version of Local Tuya

image

But the lights are still unavailable.

image

Any Ideas on what to do next? Any Local Processing Gurus out there?

Any help is appreciated.

Did you try to reload Localtuya in Configuration → Settings → YAML configuration reloading?

And is Localtuya the only active controlling interface for your devices or do you have another one?

In my case two simoultaneous control attempts from different sources caused devices to become unavailable (exception was the smartphone app, which at least in my case works parallel with Localtuya, but some users report that even the active smartphnoe app kills the Localtuya connection).

Hi thanks for the help, I did not try relapsing from yanl. I am not sure how to do that. Would you please send info on how to do that?

You cannot use tuya app and LocalTuya in parallel, close all tuya apps from phones.

Configuration → Settings → YAML configuration reloading → Reload LocalTuya integration

Right I saw that in the previous threads, I dont have Smartlife running at all or anything. but I guess the solution might be to reload local tuy afrom config yaml? How would I go about doing that?

That is not true. I have the official Tuya integration and local Tuya running perfectly in parallel for at least 1 month now. Both integrations control the same devices. Obviously they create different entities in HA, so it is a bit pointless to do so, but it is perfectly possible. I also have all my Tuya local devices in the smartlife app. They all work in parallel, each can controlt he same device, they do not interfere at all.

I was using the official Tuya integration, but got annoyed with all the delayed status updates, so I installed the Tuya local to try it out. I added all my tuya devices in Tuya local without removing them from the official Tuya integration or without disabling the official Tuya integration. In Tuya local I created new entities with the same name, but just added the _local suffix. This just works, no issue whatsoever.

I liked Tuya local so much I ended up updating all my automations and lovelace cards, but I still keep the official Tuya around mostly for scenes (which I use for my IR remote) as well as a backup in case something would ever go wrong with Tuya local.

I can control any device now with either the official Tuya integration or Tuya local. Like I said, there is no point in doing that, but you can safely try out Tuya local without having to remove the official Tuya or remove your devices from the Tuya app.

Here you can see just a snapshot of my devices. I have just 1 bathroom light, 1 entitiy is from the official Tuya, the other is from the Tuya local integration. They both work and both control the same light. And all these devices are still also in the smartlife app.

1 Like

ok did a reload of settings > local tuya yaml , but did not bring them back from being unavailable. sighs, any other ideas? thank you all for your help.

Maybe stupid suggestion, but did you try power cycling the Tuya devices?

Do the devices still report as online in the IOT developer account? If you repaired them in the smartlife app, the local keys change. Did you check if somehow the local keys changed?

Ok, Checked the Local Keys, they did n ot change.
I then opened Smartlife and powered on the device with my phone, then off
I also turned it on and off manually but nothing either.
Neither of those two worked. I also restarted HA just for fun to see what would happen.
neither it worked. Batting 1000 here.

I can try removing it entirely and re-adding it again, but don’t think that will lead to any different outcome, any other ideas?

Thank for the help.

Sorry, I am at a loss also. Final guess: did you check the IP address didn’t change? Maybe your router assigned a new IP address?

Hi,
Local tuya integration works flawlessly but you have to make it local first. In my experience with tuya light switches, the problem is that all tuya devices are connected to the cloud regardless of local tuya integration. People tried to solve this problem with tuya convert but tuya strikes back and made switches that are very hard or nearly impossible to convert.
But I found a way how to get rid of tuya cloud and truly use local tuya integration. I tested this on my tuya wifi smart light switches.
Things you need:
tuya wifi smart light switch
smart life app
router handling all your local wifi devices - not isp router
adguard
local tuya
tuya iot account
I will explain this on a wifi smart switch but I believe that it can be done on other tuya devices connected to cloud.
When you install smart switch put it in pairing mode and add a new device on smart life app. After that go on tuya iot platform and get a local key for that device. With local key add this device to local tuya integration.
Now, if you check your smart life app you will see that device is still on line in smart life app.
To disconnect devices from the cloud you need a local router. I have a router that acts as a gateway to my isp router and all wifi devices are connected on it.
You have to install and configure adguard for handling local dns request.
On my local wifi router under dns1 and dns2 for wifi and lan I wrote ip address of my homeassistant server as it handles local dns request. Its important to write both dns with the the same address because devices will use google servers if they cant connect with first dns.
After that my tuya switches cant connect to the cloud any more. If they can check dns requests in adguard and block tuya. On my smart life app all devices are offline, but as I configured them first using local tuya integration i can use them locally.
And on more thing. I have multi way switches. ie in hallway, meaning two or more switches are control one light. I used this solution

https://community.home-assistant.io/t/emulate-a-three-way-switch/167863/2?u=dadopq

In the end this is my solution how to make my tuya switches truly mine without soldering,uploading firmware, or using tuya convert. And they do work as local devices.

1 Like

This would work for couple of weeks maybe but these devices are required to connect to cloud regularly, they become zombie if they can’t. If you check localtuya repository, there is an explanation on this

Oke, I will see in a couple of weeks how will they behave. A few switches are offline for a week or two but they are working fine. For others I had to add second dns.

Actually, you are right, double checked now over here: https://github.com/rospogrigio/localtuya

As long as internet connection is restricted and dns lookup is forwarded, it will work without internet.

NOTE - Nov 2020: If you plan to integrate these devices on a network that has internet and blocking their internet access, you must also block DNS requests (to the local DNS server, e.g. 192.168.1.1). If you only block outbound internet, then the device will sit in a zombie state; it will refuse / not respond to any connections with the localkey. Therefore, you must first connect the devices with an active internet connection, grab each device localkey, and implement the block.

This is the same thing I did, but I didnt know about this link. But lets test it for a few weeks, month. If this works we should spread the word.

1 Like

Hi,

I have a wifi door sensor that is configured in tuya integration. But it’s not getting auto detected by local tuya integration and I am not able to integrate it manually via local tuya as well.

Please guide me, how can I integrate in local tuya integration.

Regards

How did you get on with this?

I’m finding that once I disable internet / DNS rules the device still works until the device is powered off ie (power cut) then the device will not come back online.

I have also read that the tuya devices need to connect to the cloud when they boot up. has anyone experienced this?

I had a tuya switch go into zombie after a couple months for no apparent reason, whilst others continued working fine. I could not recover it and couldn’t be bothered doing factory reset and starting again, I ended up just swapping it for an esphome flashed switch…the tuya devices are extremely offensive on the network even when using localtuya :confused: I would say they are easily the most offensive that I have, with only tp-link and google coming somewhat close

Problem 1: Ignores DHCP DNS, can’t block DNS (common for many IoT, not just tuya)
Solution 1: force redirect to local adguard home using dnsmasq on router (udm pro)
Problem 2: When adguard replies 0.0.0.0 for everything, tuya begins retrying at an outrageous rate indefinitely (at least once per second per device)
Solution 2: UDM pro drop all except NTP from tuya devices (only helps with preventing DNS logs from being 90% tuya - the requests still happen, they just get blocked earlier in the signal path)
This seemed to work OK for a couple months, still not happy with the spamming of requests though
Problem 3: Random zombie state outta nowhere
Solution 3: replace with less offensive device

At this point I’ve flashed or swapped most tuya devices as I couldn’t find a better solution. Is it possible to emulate the cloud response locally or something, at least to the extent that the devices are satisfied enough to not retry non-stop? I haven’t looked into what it’s sending exactly

Hi,
i have configured the latest local tuya integration.
All works fine and the Device was successfully imported to Homeassistant.
I use a Contact Sensor (Model PB-69W-1).

Now, when the device is offline (i think it’s the deepsleep mode) the device is marked as unavailable in HomeAssistant. If the Windows was opened, then after 5 Seconds the Device will be online an set the status open. After 10 Seconds, the Sensor is unavailable again in HA. I can’t ping the Device in this status.
Is there a way to disable the “not available” Status?

Regards
Herbert.