Local control Tuya ZigBee devices without internet (LocalTuya)

This guide provides a method to get full integration of Tuya WiFi and Zigbee devices behind a Tyua Zigbee Gateway working in Home Assistant.

This guide is about having BOTH local control and Cloud connectivity at the same time with the standard hardware.

This gives full local control AND cloud control of your devices at the same time.

No device hacks, firmware flashes or custom gateways needed.

BACKGROUND

In my setup, all Zigbee devices are paired with a Mercator Ikuu Zigbee Pro Hub SGW003 as my Zigbee gateway.
This is a rebranded generic Tuya TYGWZ-01 Ethernet Smart Gateway, also rebranded as LIDL, Silvercrest, Pearl.de, Revolt, Elesion and many more.

Note:
You don’t need this whole integration if you use a 3rd Party Zigbee stick in HA.
By using a 3rd party Zigbee stick, you already have full local control over all of your Zigbee devices.
Your Zigbee devices are paired to the Zigbee stick.

However, by using a 3rd party (non-Tuya) Zigbee stick, you will lose the ability to use the Tuya Cloud services, apps & automations, if that’s something you want.

If you want BOTH local control and Cloud connectivity at the same time, this guide is what you want.

GOALS

  1. Simplify on-boarding new Tuya WiFi & Zigbee devices to Home Assistant with Local Control.
    AND
  2. Retain existing Tuya Cloud integration so current automations and integrations are not disturbed.

NEEDS

You must have:

  1. A Tuya Smart Life App Account on a mobile device: All in One App | Tuya Smart

  2. A Tuya Developer Account: https://iot.tuya.com
    A good getting started guide is https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md

  3. An API key setup for your Developer account will give you:

ASSUMPTIONS

  • Your Tuya devices are online and already paired with Tuya Smart Home app.
  • Your devices are functioning normally via the Tuya Smart Home app.

LOCALTUYA SETUP

@umu_ugg has created an excellent LocalTuya HACS project which allows local control of sub-devices behind a gateway.

LocalTuya is a HACS integration that serves as a hub for your Tuya devices.

After setup, whether using cloud or no cloud, you can locally manage and control all your Tuya-based devices through Home Assistant.

Cloud Integration

LocalTuya uses the cloud only to obtain device data and pre-fill the required fields to simplify device setup.
LocalTuya does not use the Cloud for any automation or device controls.
LocalTuya can also be used independently of the cloud.
All existing Tuya Cloud integrations remain functional so current automations and integrations are not disturbed.

Features of this LocalTuya fork

  • Auto-Discover Devices - Discovers Tuya devices on your network
  • Auto-Configure Device Features - Requires a cloud API setup
  • Bulk Device Onboarding - Requires a cloud API setup
  • Supports protocol 3.5 devices.
  • Support sub-devices devices that works through gateways e.g. ZigBee and BLE.
    ^ Sub Devices automatically discoverable if Cloud API account is set up.
  • Configure devices with templates ready-config yaml file shareable.
    ^ Configured devices are exportable through config-flow.
  • Platforms humidifers, button and siren are supported.
  • Supports Multi-Hubs aka multi accounts.

INSTALLATION

Option 1:

  1. Visit GitHub - xZetsubou/hass-localtuya: 🔹 A Home Assistant integration to handle Tuya devices locally "fork from localtuya"
  2. Click the ‘Open HACS Repository on MY-HA’ button

Option 2:

  1. HACS → Integrations → menu (tree dots top right) → Custom repositories
  2. Add https://github.com/xZetsubou/hass-localtuya to field “Repository”.
  3. Category → Integration

Manual installation:

  1. Download the latest version from GitHub releases extract the file.
  2. Copy custom_components directory into your HA config directory.
1 Like

Are you sure that is the main?
this one is ahead of the repository you posted:

(and yours is forked from that one)

Suggest to not share id/etc…

If you are connecting a ZigBee device I would just use ZigBee2MQTT. I guess if you are stuck with a Tuya ZigBee hub then maybe that isn’t an option. However, adding a ZigBee coordinator should be pretty inexpensive and in the end would save a lot of hassle with the whole Tuya IoT platform.

Yes! Another repo does not have ZigBee

Ah, I see…

But I concur with timnolte,

Zigbee=Zigbee, and has nothing to do with Tuya…

I use Tuya local only for wifi (tcp) access

This guide is unfortuinatelly no longer valid as the integration no longer supports YAML configuration (since version 4.0.0). See this NOTE.

any update on how to do the same in the new version?

What exactly is not clear from the instructions from the repository?

Is this now in the regular rospogrigio/localtuya repository, or do we need the leeyuentuen repository to do this?

If the Leeyuentuen repositor, does that mean we need to remove the rospogrigio repository, and does the mean I loose all my configured entities?

Jan 2024 - I have made a major update to the guide above with the fresh information below.


This guide provides a method to get full integration of Tuya WiFi and Zigbee devices behind a Tyua Zigbee Gateway working in Home Assistant.

This guide is about having BOTH local control and Cloud connectivity at the same time with the standard hardware.

This gives full local control AND cloud control of your devices at the same time.

No device hacks, firmware flashes or custom gateways needed.

BACKGROUND

In my setup, all Zigbee devices are paired with a Mercator Ikuu Zigbee Pro Hub SGW003 as my Zigbee gateway.
This is a rebranded generic Tuya TYGWZ-01 Ethernet Smart Gateway, also rebranded as LIDL, Silvercrest, Pearl.de, Revolt, Elesion and many more.

Note:
You don’t need this whole integration if you use a 3rd Party Zigbee stick in HA.
By using a 3rd party Zigbee stick, you already have full local control over all of your Zigbee devices.
Your Zigbee devices are paired to the Zigbee stick.

However, by using a 3rd party (non-Tuya) Zigbee stick, you will lose the ability to use the Tuya Cloud services, apps & automations, if that’s something you want.

If you want BOTH local control and Cloud connectivity at the same time, this guide is what you want.

GOALS

  1. Simplify on-boarding new Tuya WiFi & Zigbee devices to Home Assistant with Local Control.
    AND
  2. Retain existing Tuya Cloud integration so current automations and integrations are not disturbed.

NEEDS

You must have:

  1. A Tuya Smart Life App Account on a mobile device: All in One App | Tuya Smart

  2. A Tuya Developer Account: https://iot.tuya.com
    A good getting started guide is https://github.com/codetheweb/tuyapi/blob/d88fd6c84b228b42f0b6aedd84f0ac3cdb1a5523/docs/SETUP.md

  3. An API key setup for your Developer account will give you:

ASSUMPTIONS

  • Your Tuya devices are online and already paired with Tuya Smart Home app.
  • Your devices are functioning normally via the Tuya Smart Home app.

LOCALTUYA SETUP

@umu_ugg has created an excellent LocalTuya HACS project which allows local control of sub-devices behind a gateway.

LocalTuya is a HACS integration that serves as a hub for your Tuya devices.

After setup, whether using cloud or no cloud, you can locally manage and control all your Tuya-based devices through Home Assistant.

Cloud Integration

LocalTuya uses the cloud only to obtain device data and pre-fill the required fields to simplify device setup.
LocalTuya does not use the Cloud for any automation or device controls.
LocalTuya can also be used independently of the cloud.
All existing Tuya Cloud integrations remain functional so current automations and integrations are not disturbed.

Features of this LocalTuya fork

  • Auto-Discover Devices - Discovers Tuya devices on your network
  • Auto-Configure Device Features - Requires a cloud API setup
  • Bulk Device Onboarding - Requires a cloud API setup
  • Supports protocol 3.5 devices.
  • Support sub-devices devices that works through gateways e.g. ZigBee and BLE.
    ^ Sub Devices automatically discoverable if Cloud API account is set up.
  • Configure devices with templates ready-config yaml file shareable.
    ^ Configured devices are exportable through config-flow.
  • Platforms humidifers, button and siren are supported.
  • Supports Multi-Hubs aka multi accounts.

INSTALLATION

Option 1:

  1. Visit GitHub - xZetsubou/hass-localtuya: 🔹 A Home Assistant integration to handle Tuya devices locally "fork from localtuya"
  2. Click the ‘Open HACS Repository on MY-HA’ button

Option 2:

  1. HACS → Integrations → menu (tree dots top right) → Custom repositories
  2. Add https://github.com/xZetsubou/hass-localtuya to field “Repository”.
  3. Category → Integration

Manual installation:

  1. Download the latest version from GitHub releases extract the file.
  2. Copy custom_components directory into your HA config directory.

Hi, how did you manage to connect more than 1 subdevice behind the zigbee gateway?

@VladoKubik There is no special trick to it - The LocalTuya fork that I linked above fully supports sub-devices behind a Zigbee gateway.

Hit the “Configure” button to select a new sub-device from the list.

image

Hi TimU , Which zigbee channel does your Mercator Hub use ? , and is it possible to change channel in this hub ?
BR

My Tuya Smart Life app is reporting channel 15. I can’t see any (obvious) way to change it.

The Mercator hub was purchased locally in Australia if that makes a difference.

Ok, thanks, yeah i saw somewhere a hack was needed to change, same goes for the LIDL-Controller here in EU, i already have my Aqara on 15 :roll_eyes:
But i would love to have another Zigbee-Controller in Local-Tuya

There are so many Tuya Zigbee gateways/hubs out there – I assume this should work with all of them, right?

While I do prefer ZHA/Z2M, I have a case where my Tuya Zigbee rollershades don’t report battery life, and for those I am looking to purchase a Tuya hub.

@Bagunda @TimU Did you try to add a Zigbee gateway without a sub-device? I’m trying to add Lidl white-brand Tuya Zigbee Gateway. It can’t add it if I don’t specify data points 101 and 102 (which I’ve found on the Tuya IoT platform for my device), and if I do specify them I need to choose an entity and there is no “hub” or “gateway” entity. Can you show me your configurations in a bit more detail?