# Tuya local for dummies

**URL:** <https://discourse.nodered.org/t/tuya-local-for-dummies/74010>\
**Category:** Hardware\
**Tags:** home-assistant\
**Created:** [21 January 2023 13:21 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010 "2023-01-21T13:21:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [21 January 2023 13:21 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/1 "2023-01-21T13:21:08Z")

</div>

Hi folks,

Every time when I start googling for din-rail devices with wifi, I always come across nice looking devices from Tuya. A few examples:

- A [circuit breaker](https://nl.aliexpress.com/item/1005004723376502.html?spm=a2g0o.productlist.main.5.4c2b430bl8LCqa&algo_pvid=c8e1cbb0-1c84-430b-80c0-7487ec295bc0&algo_exp_id=c8e1cbb0-1c84-430b-80c0-7487ec295bc0-2&pdp_ext_f=%7B%22sku_id%22%3A%2212000030883636368%22%7D&pdp_npi=2%40dis%21EUR%2155.09%2124.79%21%21%21%21%21%402145274c16743059012315281d06ca%2112000030883636368%21sea&curPageLogUid=DQkr1KziKBhe) with metering function:

- Circuit breakers for [multiple](https://nl.aliexpress.com/item/1005004205169078.html?spm=a2g0o.productlist.main.71.3a7b7454Zx8hUb&algo_pvid=cb642bff-d3ac-4ff4-8c50-8ce4601f2b56&algo_exp_id=cb642bff-d3ac-4ff4-8c50-8ce4601f2b56-35&pdp_ext_f=%7B%22sku_id%22%3A%2212000028371696310%22%7D&pdp_npi=2%40dis%21EUR%21117.4%2156.35%21%21%21%21%21%402100b18f16743061649568767d070b%2112000028371696310%21sea&curPageLogUid=XGhjHpD6ZOGZ) phases:

But it is completely not clear if it is possible to control these devices locally, without using the Tuya cloud platform. It seems that recent Tuya firmware updates now make it impossible to flash Tasmoto on them. Moreover not all Tuya devices/features are supported by Tasmoto firmware. So that is not my cup of tea.

I see that HomeAssistant users have [localtuya](https://github.com/rospogrigio/localtuya), but not sure if that is also some kind of hack or not.

Would be nice if somebody could enlighten me. Can I somehow control such devices locally from Node-RED without cloud solutions, without hacks that could be become useless in the future?

Thanks!!  
Bart

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [21 January 2023 13:25 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/2 "2023-01-21T13:25:50Z")

</div>

If you want to use locally (and likely via MQTT) then check the [zigbee2mqtt supported-devices page](https://www.zigbee2mqtt.io/supported-devices/)

And if it has zigbee but is not listed, then you can also [add support](https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html)

If you want to be future proofing, look for Matter and/or Thread devices (few and far between at the moment tho I'm afraid)

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [21 January 2023 13:56 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/3 "2023-01-21T13:56:36Z")

</div>

> [@Steve-Mcl](#):
>
> If you want to be future proofing, look for Matter and/or Thread devices

Thanks for that Steve, interesting!

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [21 January 2023 14:21 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/4 "2023-01-21T14:21:54Z")

</div>

> [@BartButenaers](#):
>
> localtuya

And node-red has

- [node-red-contrib-tuya-auth - npm](https://www.npmjs.com/package/node-red-contrib-tuya-auth)
- [node-red-contrib-tuya-local - npm](https://www.npmjs.com/package/node-red-contrib-tuya-local)

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [21 January 2023 15:00 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/5 "2023-01-21T15:00:31Z")

</div>

Hey Steve,  
Thanks for the links!

Yes I see that they have Zigbee versions of those devices, but I like them because they also offer _ **WIFI** _. Which means I don't have to setup and maintain two wireless networks. But not sure if their wifi devices can also be controlled locally.

That node-red-contrib-tuya-local node is based on the [tuyapi](https://github.com/codetheweb/tuyapi) library, which show this on their readme page:

 ![Screenshot_20230121-155905_Chrome](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/6/b6bbf67edea46306a63b2d9cebef88a91f5db175.jpeg)

No clue how this can be local stuff...  
And also not sure which devices it supports.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [21 January 2023 15:05 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/6 "2023-01-21T15:05:49Z")

</div>

From the readme of

> [@Steve-Mcl](#):
>
> node-red-contrib-tuya-auth - npm

> node tuya-socket that communicates with tuya devices directly on the local area network not using the cloud service. Note some devices use encryption some don't, if you see "data format engine" change the version 3.3 in the nodes dialog to 3.1 which encrypts only on send.

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [21 January 2023 16:04 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/7 "2023-01-21T16:04:42Z")

</div>

If I'm reading correctly, these packages need Home Assistant and I don't wish to set it up for only Tuya connectivity as I've shunned HA so far. Is it possible to use the newer Tuya devices without HA at all?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [21 January 2023 16:12 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/8 "2023-01-21T16:12:12Z")

</div>

That's not the conclusion I came to. There is an example of using one of the nodes with HA but I _think_ that's all it is (I could be wrong as I have no tuya devices)

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [21 January 2023 17:09 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/9 "2023-01-21T17:09:51Z")

</div>

Got a message from my co-worker. He says that it is some kind of hack, so not Tuya supported. And that in the past Tuya already has changed their protocol to try to prohibit it.

That is a pitty because that is no good foundation to build your house on...

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [21 January 2023 17:39 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/10 "2023-01-21T17:39:29Z")

</div>

Its a shame that these are not more easily hackable as the products look quite good.

I got some tuya Wi-Fi blinds motors (as they were cheap). Tried following various instructions to setup with local control but the web site didn't match the instructions and I never managed to get the required keys etc.

So I then went all in, and replaced the Wi-Fi module with an esp12f flashed with Tasmota. However I couldn't get full control as the built in MCU needed "something" sending to it to complete the setup, which would only be possible using the original tuya app.

In the end I just hard wired GPIOs from the ESP to the buttons to allow control over MQTT.

😥

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [21 January 2023 17:46 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/11 "2023-01-21T17:46:41Z")

</div>

@Sean-McG,  
Thanks for sharing your experience! That is indeed what I was afraid of...

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [21 January 2023 19:35 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/12 "2023-01-21T19:35:50Z")

</div>

Guess you could make your own - [Like here](https://hackaday.io/project/183312-power-monitoring/log/201842-hardware)

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [21 January 2023 20:00 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/13 "2023-01-21T20:00:45Z")

</div>

> [@BartButenaers](#):
>
> Tuya already has changed their protocol to try to prohibit it.

End of story for me and Tuya is no longer a candidate for anything in my realm.

Thanks, @BartButenaers

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [21 January 2023 21:37 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/14 "2023-01-21T21:37:29Z")

</div>

No idea if this is still valid. I haven't read it in depth so I also have no idea if connection to the Tuya Cloud is required but this explains some of this stuff  
[Tuya SDK for beginners: Intro to Tuya Cloud API - NotEnoughTech](https://notenoughtech.com/home-automation/tuya-cloud-api/)

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [24 January 2023 02:10 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/15 "2023-01-24T02:10:16Z")

</div>

> **[26.9US $ 30% OFF|Sonoff Spm Wifi Smart Stackable Power Meter 20a/gang...](https://www.aliexpress.us/item/3256804464585853.html?pdp_npi=2%40dis%21GBP%21%EF%BF%A136.14%21%EF%BF%A125.30%21%21%21%21%21%40211b5e2116745259344263045ea7ad%2112000029981429993%21btf&_t=pvid%3Aa1e86adf-155a-4fe4-91a9-ce694132ad4b&afTraceInfo=1005004650900605 __pc__ pcBridgePPC __xxxxxx__ 1674525934&spm=a2g0o.ppclist.product.mainProduct&gatewayAdapt=nld2usa4itemAdapt&_randl_shipto=US)**
>
> Smarter Shopping, Better Living! Aliexpress.com

I saw this and thought of you 😃

Din mount - Power monitoring and switching with ethernet and has some support in Tasmota not sure about firmwares, apparently it can also be used via DIY mode (HTTP requests)

Worth looking at this for more info - [Sonoff SPM: 2560Amps! - NotEnoughTech](https://notenoughtech.com/home-automation/sonoff-spm/)

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [24 January 2023 03:17 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/16 "2023-01-24T03:17:34Z")

</div>

Hey @BartButenaers

Not sure if you are aware - but basically TUYA have evolved from running on just ESP chips (8266, ESP32 etc etc) and now run on a variety of chips (which is why there has been the difficulty in flashing them with the alternative firmware)

There are now a couple of projects out there that have broken through this barrier and support the majority of the 2nd and early 3rd generation repalcement chips that Tuya was running on.

Most of the projects rely on this project as their basis

> **[GitHub - tuya-cloudcutter/tuya-cloudcutter: A tool that disconnects Tuya...](https://github.com/tuya-cloudcutter/tuya-cloudcutter)**
>
> A tool that disconnects Tuya devices from the cloud, allowing them to run completely locally. - GitHub - tuya-cloudcutter/tuya-cloudcutter: A tool that disconnects Tuya devices from the cloud, allo...

This essentially permanently disconnects the device from the Tuya cloud and allows you to address it locally using any number of engines

Other projects build on this to enable alternative firmware to be loaded onto the cloud free chips - the best of which is

> **[GitHub - openshwprojects/OpenBK7231T\_App: Open source firmware...](https://github.com/openshwprojects/OpenBK7231T_App/)**
>
> Open source firmware (Tasmota/Esphome replacement) for BK7231T, BK7231N, BL2028N, T34, XR809, W800/W801, W600/W601 and BL602 - GitHub - openshwprojects/OpenBK7231T\_App: Open source firmware (Tasmot...

Which then provides a very familiar (Tasmota) like environment

ESPHome has also been ported to work on these

So do not despair ! It is currently like the early days with Tasmota in terms of having to wade through the differnet build processes etc - but they are all rapidly evolving.

Craig

---

<div class="post-metadata">

**Author:** ![IanH](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ianh/32/95002_2.png) [@IanH](https://discourse.nodered.org/u/IanH)\
**Post date:** [24 January 2023 08:33 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/17 "2023-01-24T08:33:37Z")

</div>

Bart, I haven't used Tuya, but I have used [Shelly devices](https://www.shelly.cloud). They now have a selection of DIN mounted relays etc as well as brick type relays (mount behind a light switch or Power point).  
Connectivity is through WiFi with a lot of newer devices having BT as well. Those with PM in name include Power Monitoring.  
The brick devices are easy configured to work through a web interface, cloud or independent of cloud. I have them set up to work using my MQTT server, and no cloud. I expect the DIN rail devices have similar interface but are more expensive then the brick devices.  
Hope that is a help

---

<div class="post-metadata">

**Author:** ![jmorris644](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmorris644/32/31964_2.png) [@jmorris644](https://discourse.nodered.org/u/jmorris644)\
**Post date:** [24 January 2023 13:57 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/18 "2023-01-24T13:57:15Z")

</div>

Bart,

I have used Tasmota extensively on Tuya devices when they were ESP8266/32s. Eventually had to do a hardware flash. I believe that @btsimonh is working on a solution. Maybe he will chime in or you can reach out to him.

---

<div class="post-metadata">

**Author:** ![btsimonh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/btsimonh/32/3318_2.png) [@btsimonh](https://discourse.nodered.org/u/btsimonh)\
**Post date:** [24 January 2023 15:53 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/19 "2023-01-24T15:53:31Z")

</div>

Hello Bart :).

if the price is good enough to scrap it, order one, and see what it contains.  
If BK7231 based, then OpenBeken is a good choice. The community around it is very active at the moment, and the maintainer is _very_ responsive.  
I have about 6 OpenBK devices, and was contributing regularly until my robot project distracted me (some brilliant stuff to come from that for Node-Red I/O on RPi)....  
On OpenBK, the IR, SSDP, MQTT fixes, and general other stuff was mine....

Cloudcutter is a faff, but I don't think there is any indication of Tuya having closed the hole. I've not kept up with developments, but they were progressing towards some kind of auto-cracker. Worst come to the worst, you'll need to solder and extract the firmware. Once you have done that, you may as well flash them over serial. (may be easier than setting up cloudcutter - my RPi is still suffering from that experience).

as always, very best regards, Simon

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [25 January 2023 03:26 UTC](https://discourse.nodered.org/t/tuya-local-for-dummies/74010/20 "2023-01-25T03:26:08Z")

</div>

@btsimonh - Cloud Cutter seems to have gotten a lot better lately - i installed it to a Ubuntu VM and had it up and running and flashing devices OTA within about 20 minutes the other day

Its nice if you do not want to have to open up the device (or can't) in some cases

There are also a number of 3D printed devices out there - such as this one

> **[TYWE3S Pogo Pin Programming Adapter by Stephenlofgren](https://www.thingiverse.com/thing:4099748)**
>
> I purchased an outdoor smart plug and wasn't able to get my soldering iron in to the pins. Similarly other adapters on Thingiverse were obstructed by other components that were very close to the TYWE3S module.  
> This adapter uses pogo pins and test...

- to remove the need for soldering in most cases and just go straight to OpenBeken

Craig

[Next page](https://discourse.nodered.org/t/tuya-local-for-dummies/74010.md?page=2)
