Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
BETTESWORTHConstruction
Hausautomation

Tuya-Geräte in Home Assistant: Lokal steuern mit LocalTuya und Local Key

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Kurzantwort: Die offizielle Tuya-Integration von Home Assistant arbeitet cloudbasiert und ist daher nicht für einen vollständig lokalen Betrieb geeignet. Für die lokale Kommunikation benötigen Sie stattdessen eine Custom Integration wie LocalTuya, die Device ID, Local Key und passende Data Points des Geräts verwendet.

„100 Prozent lokal“ ist allerdings nicht bei jedem Tuya-Gerät garantiert. Unterstützung hängt von Gerät, Firmware, Tuya-Protokoll, Gerätetyp und verfügbaren Data Points ab. Außerdem kann ein Local Key nach einem Reset oder erneuten Pairing wechseln.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Offizielle Tuya-Integration oder LocalTuya?

Lösung Kommunikation Geeignet für
Tuya Tuya-Cloud, IoT-Klasse „Cloud Push“ Schnelle Einbindung ohne lokale Einrichtung
LocalTuya Direkt im lokalen Netzwerk Lokale Steuerung mit Device ID, Local Key und DPs

Die offizielle Integration unterstützt zwar viele Home-Assistant-Plattformen, jedoch nicht lock und remote. Welche Funktionen tatsächlich verfügbar sind, hängt zusätzlich vom Tuya-SDK und vom jeweiligen Gerät ab. Für einen cloudfreien Betrieb sollten Sie sie nicht mit LocalTuya verwechseln: Der Name tuya steht in Home Assistant für die eingebaute Cloud-Integration.

Voraussetzungen und Grenzen

  • Das Gerät muss in der offiziellen App Tuya Smart oder Smart Life eingerichtet sein. Hersteller-Apps mit eigenem Branding können beim Auslesen oder bei der Unterstützung abweichen.
  • Für ein einzelnes Gerät benötigen Sie mindestens Device ID und Local Key. Der Local Key ist der gerätespezifische Schlüssel für die LAN-Kommunikation.
  • LocalTuya unterstützt laut Projektangaben die Gerätetypen Switches, Lights, Covers, Fans, Climates und Vacuums sowie Energie-Messwerte bei kompatiblen Geräten.
  • Unterstützt werden Tuya-Protokolle 3.1 bis 3.4. Ein vorhandener Local Key bedeutet nicht automatisch, dass alle Funktionen des Geräts lokal verfügbar sind.
  • Bei Zigbee- oder anderen hubabhängigen Untergeräten kann zusätzlich eine node_id erforderlich sein. Die normale Device ID reicht dann nicht immer aus.

Prüfen Sie vor einer größeren Umstellung, ob Ihr konkretes Gerät im LocalTuya-Repository beziehungsweise in der Dokumentation von tuya-local beschrieben ist.

#1 Best Overall
Sparkleiot Tuya WiFi Smart Plug Works with Alexa Google Assistant IFTTT for Voice Control Mini Smart Outlet Plug with Timer Function,No Hub Required,Only 2.4GHz Wi-Fi,FCC/Rohs Listed Socket(2 Pack)
  • Smart home outlet only support wi-fi 2.4 GHz,does not support 5 GHz or BT;Please ensure the stability and security of the wi-fi 2.4 GHz network
  • Smart life plug compatible with Alexa Google Home and IFTTT which help to manage your home devices through voice control,does not support SmartThings or HomeKit
  • This round tuya smart plug is recommended to be installed on a three-pin socket, it is not recommended to install two plugs side by side on a two-pin socket
  • The maximum load current of the smart home plug is 10A,overload protection and a fire-retardant casing ensure complete protection for you and your devices;please take care of your plug, do not drop it to avoid noise during use
  • No hub or subscription required,simply plug your electrical appliances into smart outlet and connect to Smart Life APP/Tuya APP under a secured 2.4GHz Wi-Fi network

Local Key aus dem Tuya-Portal auslesen

Variante 1: Tuya Developer Portal

  1. Öffnen Sie im Tuya Developer Portal den Bereich Cloud > Devices und notieren Sie die Device IDs.
  2. Wechseln Sie zu Cloud > API Explorer > Devices Management > Query Device Details in Bulk.
  3. Geben Sie die Device IDs kommasepariert ein.
  4. Suchen Sie in der Antwort nach dem Feld local_key.

Wenn keine Geräte angezeigt werden, kontrollieren Sie die Server- beziehungsweise Datenzentrumsregion im Auswahlfeld oben rechts. Die Region muss zu Ihrem Tuya-Konto und den Geräten passen.

Tuya weist darauf hin, dass local_key bei bestimmten Gerätetypen aus Sicherheitsgründen leer zurückgegeben werden kann. Die Geräte-Details-API ist außerdem nicht für Sub-Devices wie Zigbee-Untergeräte geeignet. Details beschreibt die Tuya-Supportdokumentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Variante 2: TinyTuya

Alternativ können Sie TinyTuya verwenden. Nach der Installation starten Sie den Wizard mit:

python -m tinytuya wizard

Der Wizard fragt unter anderem nach folgenden Werten:

Rank #2
Govee Smart Plug, WiFi Outlet Compatible with Alexa & Google Assts, 4 pcs | Smart Home Plugs, 15A WiFi Outlet, Timer Function and Group Controller, No Hub Required, ETL & FCC Certified, 2.4G Only
  • Stability Upgrade: Supports Bluetooth or WiFi connection, which is more stable and faster than plugs that can only be connected through WiFi. No disconnection worries, control all your home appliances and devices anytime & anywhere.
  • Smart Voice Control: WiFi Plugs Work with Amazon Alexa and Google Assistant, so you can control the smart home devices using simple voice commands. Free hands by using smart plugs and enjoy the funny interactive process. Note: Don't support 5G WiFi.
  • Scheduling & Group Controller: Create customized schedules to power your electronic appliances on/off automatically for helping save energy and money. And with a single tough of one button, you can manage multiple smart plugs simultaneously.
  • Multiple Safeguards & Small Size: With ETL & FCC certified, the quality of smart plug is assessed. Our product is rated: 10A, 1200W and support 120V. Compact and flexible design can save space, smart home plugs fit for every corner of your room.
  • Easy Install and Use: Download the Govee Home App and search for H5083, you can pair smart outlet successfully in minutes without barrier in smart home; share with your family on Govee app via phones so you can enjoy the smart life together.
Enter API Key from tuya.com:
Enter API Secret from tuya.com:
Enter any Device ID currently registered in Tuya App (used to pull full list) or 'scan' to scan for one:
Enter Your Region:
Download DP Name mappings? (Y/n):
Poll local devices? (Y/n):

Der API-Key entspricht der Access ID beziehungsweise Client ID; das API-Secret entspricht Access Secret beziehungsweise Client Secret. Als Region wählen Sie die Datenzentrumsregion des Tuya-Portals, beispielsweise Central Europe Data Center.

TinyTuya speichert die Ergebnisse in devices.json:

  • id: Device ID
  • key: Local Key
  • node_id: Sub-Device-ID bei hubabhängigen Geräten
  • mapping: erkannte Data-Point-Beschreibung

Behandeln Sie den Local Key wie ein Passwort. Veröffentlichen Sie ihn nicht in Foren, Screenshots oder Git-Repositories.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

LocalTuya installieren

Am einfachsten erfolgt die Installation über HACS. Alternativ kopieren Sie bei einer manuellen Installation den Ordner localtuya einschließlich seines Inhalts nach:

custom_components/localtuya

Der Pfad liegt im Home-Assistant-Konfigurationsverzeichnis. Starten Sie Home Assistant nach der manuellen Installation neu, falls die Integration nicht unmittelbar erkannt wird.

Rank #3
EIGHTREE 15A Smart Plug Works with Alexa & Google Home, Smart Outlet 4 Pack | WiFi Plugs for Smart Home, Voice & App Remote Control, Smart Outlet Timer, No Hub Required, FCC & ETL Certified, 2.4GHz Only
  • 【15A High Power Smart Plug】Upgrade your smart home with a 15A/1800W smart plug designed for coffee makers, air fryers, heaters, and other high-power appliances. Provides safer control for devices that require more power than standard smart outlets.
  • 【Fast Setup & Stable Connection】No hub required. Simply download the Smart Life app, turn on Bluetooth, and connect to 2.4GHz WiFi for quick setup and reliable control, Enjoy a faster and more stable smart home experience. Note: 2.4GHz WiFi Only!
  • 【Mini Space-Saving Design】With a compact round shape and only 1.2-inch thickness, this wifi plug easily fits behind furniture, in narrow spaces, or crowded outlets, keeping your home clean and organized while adding smart control.
  • 【Voice Control Anytime】Through this smart plug that works with Alexa & Google Home,enjoy hands-free control with Alexa and Google Home. Just say “Alexa, turn on the coffee maker” or “Hey Google, turn off the fan” to control your devices.
  • 【Remote Control Anytime, Anywhere】Control your home devices from anywhere using the Smart Life app. Turn electronics on or off remotely, check device status, and avoid leaving appliances powered on when you are away from home.

Wichtig: Seit LocalTuya 4.0.0 wird keine YAML-Konfiguration mehr unterstützt. Die Einrichtung erfolgt ausschließlich über den Config Flow.

LocalTuya in Home Assistant einrichten

  1. Öffnen Sie Settings > Integrations.
  2. Klicken Sie auf + Add Integration und suchen Sie nach LocalTuya.
  3. Hinterlegen Sie optional ein Tuya-Cloud-API-Konto. Wenn Sie dies nicht möchten, wählen Sie Do not configure a Cloud API account.
  4. Öffnen Sie anschließend bei der Integration Configure.
  5. Wählen Sie Add or Edit a device. Bei Bedarf können Sie das Gerät auch manuell über das …-Element auswählen.
  6. Tragen Sie mindestens Friendly Name und Local Key ein. Mit konfigurierter Cloud API werden Geräte- und Schlüsselwerte automatisch abgerufen; ohne Cloud API müssen sie manuell eingetragen werden.
  7. Klicken Sie auf Submit. LocalTuya testet nun die lokale Verbindung.
  8. Legen Sie die Entities einzeln an. Wählen Sie dazu die passenden Data Points aus dem Dropdown mit den erkannten DPs und deren aktuellem Status.
  9. Nach der letzten Entity lassen Sie Do not add more entities aktiviert, um die Einrichtung abzuschließen.

Das optionale Cloud-API-Konto macht LocalTuya nicht zu einer Cloud-Steuerung. Laut Projektbeschreibung wird die API hauptsächlich beim Start und zum Aktualisieren eines Local Keys verwendet. Ohne Cloud API kann LocalTuya ebenfalls betrieben werden, sofern Sie Device ID, Local Key und die weiteren Werte selbst bereitstellen.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

App während der Einrichtung schließen

Beenden Sie die Tuya- beziehungsweise Smart-Life-App auf dem Smartphone, bevor Sie das Gerät in LocalTuya konfigurieren. Die App kann die lokale Verbindung beanspruchen und dadurch die Einrichtung oder den Verbindungstest stören.

Werden Data Points nicht korrekt angekündigt, kann im Einrichtungsdialog Manual DPS To Add verwendet werden. Laut LocalTuya ist dieser Workaround oft nicht nötig, wenn das Gerät zuvor einmal mit der Tuya-App initialisiert und die App danach geschlossen wurde. Manuell ergänzte DPs erscheinen während der Einrichtung mit dem Wert -1.

Rank #4
Sale
GHome Smart Plug Mini, WiFi Smart Outlet Plug Works with Alexa and Google Home, Timer Outlet with APP Control, 2.4GHz Network Only, No Hub Required, ETL FCC Listed (4 Pack), White
  • FAST, STABLE CONNECTION: Simply plug in and keep the smart outlet connected to your stable 2.4GHz network. Enhanced WiFi + Bluetooth connection is faster and more stable. Note: Don't support 5G WiFi.
  • HAND-FREE VOICE CONTROL: Smart plugs that work with Alexa & Google Home Assistant. Just use simple voice commands to control your devices. Tips: please connect smart plug to the GHome app first—cannot link directly to Alexa/Google Home.
  • SCHEDULES & AUTO-OFF TIMER: Easy to set timers and add schedules to connected devices circularly or randomly, making them work as scheduled like auto-off and auto-on.
  • APP REMOTE & GROUP CONTROL: Use your smartphone to turn home appliances on and off anytime, anywhere. Set up a group for all outlet timer indoor, control them with just one tap, and manage multiple smart outlet plugs simultaneously.
  • CERTIFIED SAFETY & COMPACT DESIGN: This wifi outlet plug combines assured reliability and a small size. It is ETL and FCC certified, rated at 10A, 1200W, and 120V, and its space-saving compact design fits perfectly into any corner of your home.

Vollständig offline: Netzwerk richtig sperren

Lokale Kommunikation allein bedeutet nicht, dass ein Gerät ohne Internet funktioniert. Einige Geräte bleiben in einem sogenannten Zombie State, wenn nur der ausgehende Internetzugriff blockiert wird. Sie antworten dann trotz korrektem Local Key nicht mehr lokal.

Die von LocalTuya dokumentierte Reihenfolge ist:

  1. Betreiben Sie das Gerät zunächst mit aktiver Internetverbindung.
  2. Lesen Sie Device ID und Local Key aus.
  3. Richten Sie LocalTuya ein und prüfen Sie die lokale Steuerung.
  4. Blockieren Sie anschließend sowohl den Internetzugriff als auch die DNS-Kommunikation des Geräts zu Ihrem lokalen DNS- beziehungsweise Router-DNS-Server, beispielsweise 192.168.1.1.

Eine reine Firewall-Regel für ausgehendes Internet reicht daher bei problematischen Geräten nicht aus. Die konkrete Umsetzung hängt von Router, VLAN- und Firewall-System ab. Lassen Sie Home Assistant und das Tuya-Gerät im selben erreichbaren lokalen Netz, sofern Ihre Netzwerkarchitektur keine abweichende Routing-Regel vorsieht.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Weisen Sie dem Gerät möglichst eine feste DHCP-Zuordnung zu. Die automatische Erkennung mit Auto kann fehlschlagen, wenn die Tuya-App gleichzeitig lokal verbunden ist, LocalTuya installiert ist oder das Netzwerk aus mehreren Subnetzen besteht. Eine feste IP erleichtert außerdem die Wiederverbindung.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Fehlerbehebung

Gerät wird nicht gefunden

  • Prüfen Sie, ob Home Assistant und Gerät im selben erreichbaren Netzwerk liegen.
  • Kontrollieren Sie Device ID, Local Key und Region.
  • Schließen Sie die Tuya-App vollständig.
  • Verwenden Sie eine feste DHCP-Zuordnung statt Auto.
  • Bei einem Hub-Gerät prüfen Sie zusätzlich die node_id.

Gerät ist erreichbar, reagiert aber nicht auf Befehle

Nach einem Stromausfall können manche Geräte erreichbar sein, aber keine Tuya-Kommandos akzeptieren. LocalTuya bietet dafür DPIDs to send in RESET command. Als häufige Beispielwerte nennt die Dokumentation 18,19,20. Verwenden Sie diese Werte nicht blind: Falsche DPIDs können verhindern, dass das Gerät den Zombie State verlässt.

Best Value
Sale
Kasa Smart Plug Ultra Mini 15A, EP10P2, Smart Home Wi-Fi Outlet | Works with Alexa & Google Home, No Hub Required, UP Certified, 2.4GHz Wi-Fi Only, 2-Pack, White
  • Voice control: Kasa smart plugs that work with Alexa and Google Home Assistant. Enjoy the hands free convenience of controlling any home electronic appliances with your voice via Amazon Alexa or Google Assistant
  • Easy set up and use: 2.4GHz Wi-Fi connection required. Plug in, open the Kase app, follow the simple instructions and enjoy
  • Scheduling: Use timer or countdown schedules set your smart plug to automatically turn on and off any home electronic appliances such as lamps, fan, humidifier, Christmas lights etc.
  • Smart Outlet Control from Anywhere: Turn electronics on and off from anywhere with your smartphone using the Kasa app, whether you are at home, in the office or on vacation.
  • Trusted and Reliable: Kasa is trusted by over 6 Million users and being the Reader’s Choice of PCMag 2020. UL certified for safety use. 2-year warranty.

Der Local Key funktioniert nach dem Neu-Anlernen nicht mehr

Ein erneutes Pairing oder Zurücksetzen kann den Local Key ändern. Lesen Sie den Schlüssel nach dem erneuten Anlernen erneut aus und aktualisieren Sie die LocalTuya-Konfiguration.

Energie-, Spannungs- oder Verbrauchswerte sind falsch

Ein Scan-Intervall ist hauptsächlich für Energie- und Leistungswerte relevant. Werte unter 10 Sekunden können Stabilitätsprobleme verursachen; für Energiemesswerte werden 30 Sekunden empfohlen.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Bei manchen Geräten sind Spannung und Verbrauch als einzelne Sensoren um den Faktor zehn skaliert und müssen mit 0.1 multipliziert werden. Als Switch-Attribute voltage, current und current_consumption sind die Werte laut Dokumentation bereits durch zehn geteilt.

Mehr Diagnose benötigt

Aktivieren Sie am Gerät Enable debugging for this device. Für ausführlichere Logs können Sie in Home Assistant folgende Logger-Konfiguration ergänzen:

logger:
  default: warning
  logs:
    custom_components.localtuya: debug
    custom_components.localtuya.pytuya: debug

Bei der offiziellen Cloud-Integration laden Sie Diagnosedaten über Settings > Devices & services > Tuya > Gerät auswählen > Drei-Punkte-Menü unter Device information > Download diagnostics. Besonders relevant sind die Schlüssel status, status_range und function.

Was „ohne China-Cloud“ praktisch bedeutet

Mit LocalTuya werden Steuerbefehle und Statusabfragen im Normalbetrieb lokal zwischen Home Assistant und Gerät übertragen. Das reduziert die Abhängigkeit von Tuya-Servern und kann auch bei einem Internetausfall funktionieren. Es ist aber keine pauschale Garantie für jedes Gerät:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Ein Gerät kann lokale Kommunikation trotz Local Key nicht vollständig unterstützen.
  • Firmware-Updates, erneutes Pairing oder ein Werksreset können die lokale Einrichtung verändern.
  • Bestimmte Funktionen können fehlen, weil die benötigten DPs nicht verfügbar oder nicht korrekt zugeordnet sind.
  • Bei manchen Geräten ist der Local Key nicht abrufbar.
  • Ein Cloud-API-Konto kann optional hinterlegt sein; wer die Cloud-Abhängigkeit minimieren möchte, nutzt die Option ohne Cloud-Konto und trägt die Gerätedaten manuell ein.

Die technisch sauberste Vorgehensweise ist deshalb: Gerät und lokale Funktionen zuerst mit Internetverbindung einrichten, lokale Steuerung testen, anschließend Netzwerkzugriffe gezielt sperren und danach Automationen sowie Wiederverbindungen prüfen.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.