Local Tuya Help

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.

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.

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.

Not with localtuya but you can create a template based sensor and set it as true, if localtuya is true, otherwise false

Thanks for the Info.
But how can i saved the last state?
If Window is open, the state is open for 10 Seconds. After 10 Seconds the device is unavailable. And the same when the Window is closed. 10 Seconds is closed after that state is unavailable too. So i must check the last correct state.

Regards
Herbert

{{ states('binary_sensor.bla_bla') == true }}

Try this in developer tools

THis show always false when the device is unavailable.

Now i have create a helper switch and an automation.
If Sensor change from unavailable or off > on = Window open (Helper on)
If Sensor change from unavailable or on > off = Window closed (Helper off)

Regards
Herbert

Hi,

I found the Local Tuya integration works great for a while. Had it for a year and now its completely crapped itself. From an initial look (have not had the time to dig into it), it seems like certain devices stopped receiving on/off signals. Some devices seemed offline and were, some showed offline but weren’t. I looked at the developer portal and had to renew for another 6 months but still now having issues. I am sure I will eventual fix these issues.

My main question to everyone here is:

What is your plan once you have done your 1.5years of “trial” license for Tuya dev. I don’t really want to be spending hours re-configuring this every year. Is this what people are just accepting? Seems to me like buying the Core IOT package which you need to have is cost prohibitive.

Penny for your thoughts? :slight_smile:

Luckily I registered my dev account with Tuya long before October 15, 2021. Thus there seems to be no such thing like an expiry date for my account. It simply works with Local Tuya without any hiccups. Getting a new key after a device reset is not bringing up any problems. Just did it for some switches after a power blackout a few days ago. Even adding new devices is working flawlessly (at least for the time being).

The price tag for their subscriptions for end users is simply ridiculous or they don’t want end users to register a developer account. The company behind Tuya is driven by greed and nothing more than greed.

Their disguise to be end user friendly by developing that “official” Tuya integration for HA, developed to control Powered by Tuya (PBT) devices using the officially maintained Tuya Open API was a joke right from the beginning and little more than a marketing move to lure unsuspecting potential Tuya device buyers into an overpriced liable to pay subscription. Their pompous announcement for it here with the forum was a joke: As soon as their integration got officially implemented into HA and the misery started the Tuya “support team” on the forum just disappeared leaving the HA devs, the forum admins and the community alone with a desperate user base…

As for me personally I never recommend Tuya devices to anybody anymore after they started that paid subscription scheme except for ZigBee products labeled also as “Tuya based” since those just connect to all sorts of ZigBee coordinators compatible with Z2M for HA with no need for their Smart Life App nor their proprietary ZigBee gateway.

After your existing devices have died but latest after your “trial” license has expired switch to Zigbee or else and avoid Tuya wherever you can :rofl: