LocalTuya 2.0 — The Next Generation of Local Tuya Control
Maintained by BildaSystem.cz
Why? • Features • Install • Roadmap • Docs
🇬🇧 English | 🇨🇿 Čeština
The original LocalTuya was a game-changer for Tuya device owners. But development stalled, bugs piled up, and Home Assistant kept evolving. We stepped in to keep LocalTuya alive.
| Pain Point | What Happened |
|---|---|
| 🐛 HA 2024/2025 breaking changes | Crashes, deprecation warnings, broken config flows |
| 🔧 Protocol 3.5 devices | Not supported, newer devices didn't work |
| 😤 Changing device IP/key | Click through ALL entities one by one |
| 📦 No device templates | Configure 15 DPs manually for every bulb |
| 🔐 Complex cloud setup | Need developer account, API keys, etc. |
LocalTuya 2.0 fixes all of this and more. We're committed to keeping local Tuya control alive and thriving.
💡 Philosophy: Your smart home should work locally, without cloud dependencies. That's why LocalTuya exists, and that's why we maintain it.
No Tuya developer account needed! Just scan a QR code:
- Open Smart Life app → Me → Settings → User Code
- Enter the code in LocalTuya 2.0
- Scan QR with app → Done!
- All your devices and local_keys are fetched automatically
Full support for the latest Tuya protocol:
- GCM encryption for secure communication
- 6699 packet prefix handling
- Proper heartbeat with retry logic
- Works with newest Tuya devices
Keep your entities organized in large installations:
- Set a prefix per device (e.g., "Living Room", "Bedroom #1")
- All entities get prefixed automatically
- Example:
Living Room Temperatureinstead of justTemperature - Perfect for multiple devices of the same type
- Scaling factor - multiply raw values (e.g.,
0.1for temperature) - Device class - proper icons and units in HA
- Enum support (v7.8+) - translate raw values to friendly names
- Raw:
0,1,2→ Display:Off,Heating,Cooling
- Raw:
Pre-configured templates for common devices:
- Auto-detection by product_id
- One-click setup - no manual DP configuration
- Community templates - growing library
Currently supported:
- 🌡️ Inkbird ITC-308-WIFI - Temperature controller (heating/cooling)
- 💡 Smart Mini Bulb RGB+CCT (Protocol 3.5)
- ⭐ Smart Star Projector
- 🌬️ Tesla Air Purifier Mini
- 💧 Tesla Dehumidifier XL
- 🔌 Tesla Power Strip PS300
- 🌬️ BlitzWolf Air Cleaner
- 🐾 Nedis Pet Feeder - Auto feeder with portions
- 🐾 Pet Feeder DU3L - Advanced pet feeder
- ⚡ KWS-302WF Energy Meter
- 🔌 Circuit Breaker 63A
- 🪟 Roleta M313EIRWT
- ...and more coming!
💡 Have a device? Open an issue with your device info and we'll add a template!
Change host, local_key, or protocol without reconfiguring entities:
Settings → Devices → LocalTuya 2.0 → Configure
→ Select device → Quick edit
→ Done in 10 seconds!
Fetch all local_keys with one click:
- No manual copy-paste from Tuya IoT
- Shows which keys changed
- Smart sync - only updates modified keys
Run alongside original LocalTuya:
- Different domain (
localtuya_bildass) - Test before migrating
- Zero conflicts
- EU - Central Europe
- EU West - Western Europe
- US - Western America
- US East - Eastern America
- CN - China
- IN - India
- SG - Singapore (new!)
- Open HACS → Integrations
- Click ⋮ → Custom repositories
- Add:
https://github.com/Bildass/localtuya - Category: Integration
- Find LocalTuya 2.0 → Download
- Restart Home Assistant
cd /config/custom_components
git clone https://github.com/Bildass/localtuya.git temp
mv temp/custom_components/localtuya_bildass .
rm -rf temp
# Restart Home AssistantWe're actively developing LocalTuya 2.0. Here's what's coming:
| Feature | Status | Description |
|---|---|---|
| Water Heater Platform | 📋 Planned | Support for smart kettles, water heaters |
| More Device Templates | 🔄 Ongoing | Community-contributed device configs |
| Entity Customization | 💭 Idea | More options for entity appearance |
| Version | Feature |
|---|---|
| v7.8.0 | 🏷️ Entity naming prefix + 📊 Sensor enum support |
| v7.7.0 | 🌡️ Inkbird ITC-308-WIFI template |
| v7.6.0 | Number entity scaling, device class, units |
| v7.5.0 | Config flow refactoring (modular architecture) |
| v7.4.0 | 🔐 QR Code Authentication - no developer account needed! |
| v7.3.20 | Fixed template name display in options flow |
| v7.0.0 | Complete pytuya rewrite + Protocol 3.5 |
- Matter bridge - expose LocalTuya devices to Matter
- Device diagnostics - built-in network analyzer
- Firmware version detection - track device updates
- Scenes support - Tuya scene activation
📣 Have a feature request? Open an issue or start a discussion!
- Install via HACS (see above)
- Add Integration: Settings → Devices & Services → Add → LocalTuya 2.0
- Configure Cloud API (optional but recommended):
- Get credentials from Tuya IoT Platform
- Region, Client ID, Client Secret, User ID
- Add Devices: Cloud Sync auto-fills device info!
| Platform | Examples |
|---|---|
| switch | Smart plugs, relays, power strips |
| light | Bulbs, LED strips, dimmers |
| cover | Blinds, curtains, garage doors |
| fan | Ceiling fans, air purifiers |
| climate | Thermostats, AC controllers |
| vacuum | Robot vacuums |
| sensor | Temperature, humidity, power monitoring |
| binary_sensor | Motion, door/window, leak |
| number | Brightness, speed setpoints |
| select | Modes, presets |
| Protocol | Encryption | Status |
|---|---|---|
| 3.1 | AES-ECB | ✅ Supported |
| 3.2 | AES-ECB | ✅ Supported |
| 3.3 | AES-ECB | ✅ Supported |
| 3.4 | AES-GCM | ✅ Supported |
| 3.5 | AES-GCM | ✅ Full Support |
# configuration.yaml
logger:
default: warning
logs:
custom_components.localtuya_bildass: debug
custom_components.localtuya_bildass.pytuya: debugGood news: You can run both versions simultaneously!
- Install LocalTuya 2.0 via HACS
- Export existing config (local_keys are precious!)
- Add devices to LocalTuya 2.0
- Test everything
- Remove original when satisfied
| Original | LocalTuya 2.0 |
|---|---|
switch.localtuya_xxx |
switch.localtuya_bildass_xxx |
light.localtuya_xxx |
light.localtuya_bildass_xxx |
Update references in: Automations, Scripts, Dashboards, Templates
📚 Full migration guide: See Migration Guide section below.
- v7.8.0 - Sensor enum device_class support, Entity naming prefix
- v7.7.0 - Inkbird ITC-308-WIFI temperature controller template
- v7.6.0 - Number entity scaling, device class, unit of measurement support
- v7.5.0 - Config flow refactoring - split into 6 modular files (mixins)
- v7.4.0 - 🔐 QR Code Authentication - no developer account needed!
- v7.3.20 - Fix template name display in options flow
- v7.3.19 - Add all Tuya regions (SG, EU West, US East) with friendly names
- v7.3.18 - Heartbeat optimization, optimistic UI updates
- v7.3.17 - Remove rate limiting (caused delays)
- v7.3.16 - Smart Mini Bulb template, product_id detection fix
- v7.0.0 - Complete pytuya rewrite, Protocol 3.5 support, Device Library
- v6.0.0 - Quick Edit, Entity List, Cloud Sync, Async API
📜 Older versions...
- v5.5.0 - Removed broken QR auth, simplified flow
- v5.4.0 - Parallel installation, domain change
- v5.3.1 - HA 2025.x compatibility
| Feature | Original LocalTuya | LocalTuya 2.0 |
|---|---|---|
| Protocol 3.5 | ❌ | ✅ |
| QR Code Auth | ❌ | ✅ No dev account! |
| Device templates | ❌ | ✅ |
| Quick Edit | ❌ | ✅ |
| Cloud Key Sync | ❌ | ✅ |
| Entity prefix | ❌ | ✅ |
| Sensor enum | ❌ | ✅ |
| HA 2024/2025 | ✅ | |
| Parallel install | ❌ | ✅ |
| Active development | ❌ Stalled | ✅ Active |
We welcome contributions!
- 🐛 Report bugs - Open an issue
- 💡 Request features - Start a discussion
- 📚 Add device templates - Share your working configs
- 🌍 Translations - Help localize the integration
- 🔧 Code - PRs welcome!
git clone https://github.com/Bildass/localtuya.git
cd localtuya
# Create feature branch
git checkout -b feature/amazing-feature
# Make changes, commit, push
git push origin feature/amazing-feature
# Open PR- 🌐 Website: bildassystem.cz
- 📧 Email: info@bildassystem.cz
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
Built upon the excellent work of:
- rospogrigio/localtuya - Original project
- jasonacox/tinytuya - Protocol implementation
- make-all/tuya-local - Inspiration for QR auth research
Community Contributors:
- @galentx - Inkbird ITC-308-WIFI template, enum support & entity prefix ideas
- Everyone who reports bugs, suggests features, and shares device configs!
LocalTuya 2.0
Keeping local Tuya control alive.
© 2024-2025 BildaSystem.cz
Fork of rospogrigio/localtuya • Licensed under GPL-3.0
Good news: You can run both versions simultaneously! And you don't need to re-fetch local_keys - they're already in your config!
- Install LocalTuya 2.0 via HACS (don't remove original yet)
- Export your existing device data (see below)
- Add the integration: Settings → Devices & Services → Add → LocalTuya 2.0
- Re-add devices using your exported data (no Cloud API needed!)
- Test everything works
- Remove original LocalTuya when satisfied
Your existing device configurations (including precious local_key values) are stored in Home Assistant's config storage.
Create export_localtuya.py in /config:
#!/usr/bin/env python3
"""Export LocalTuya device configurations for migration to LocalTuya 2.0"""
import json
from pathlib import Path
config_path = Path('/config/.storage/core.config_entries')
with open(config_path, 'r') as f:
data = json.load(f)
devices = []
for entry in data['data']['entries']:
if entry.get('domain', '').lower() == 'localtuya':
device_data = entry.get('data', {})
devices.append({
'name': entry.get('title', 'Unknown'),
'device_id': device_data.get('device_id'),
'local_key': device_data.get('local_key'),
'host': device_data.get('host'),
'protocol_version': device_data.get('protocol_version', '3.3'),
'entities': device_data.get('entities', [])
})
output_path = Path('/config/localtuya_export.json')
with open(output_path, 'w') as f:
json.dump(devices, f, indent=2)
print(f"✅ Exported {len(devices)} devices to {output_path}")Run via SSH: python3 /config/export_localtuya.py
- Open
/config/.storage/core.config_entries - Search for
"domain": "localtuya" - Copy relevant entries
For each device:
- Settings → Devices & Services → LocalTuya 2.0 → Configure
- Add new device
- Enter details from export: Device ID, Host, Local Key, Protocol
- Configure entities using DP numbers from export
- Repeat
⏱️ ~2-3 minutes per device with prepared data
Your entity IDs will change:
| Original | LocalTuya 2.0 |
|---|---|
switch.localtuya_xxx |
switch.localtuya_bildass_xxx |
light.localtuya_xxx |
light.localtuya_bildass_xxx |
Update in: Automations, Scripts, Dashboards, Templates, Groups
- Set static IPs for Tuya devices in router
- Keep export file as backup
- Migrate in batches if many devices
- Test each batch before continuing
For devices with power measurement (smart plugs, power strips):
# configuration.yaml
sensor:
- platform: template
sensors:
smart_plug_voltage:
friendly_name: "Smart Plug Voltage"
value_template: "{{ state_attr('switch.localtuya_bildass_plug', 'voltage') }}"
unit_of_measurement: 'V'
device_class: voltage
smart_plug_current:
friendly_name: "Smart Plug Current"
value_template: "{{ state_attr('switch.localtuya_bildass_plug', 'current') }}"
unit_of_measurement: 'mA'
device_class: current
smart_plug_power:
friendly_name: "Smart Plug Power"
value_template: "{{ state_attr('switch.localtuya_bildass_plug', 'current_consumption') }}"
unit_of_measurement: 'W'
device_class: power