Local control Tuya ZigBee devices without internet (LocalTuya)

HACS → Integrations → menu (tree dots top right) → Custom repositories
Add text https://github.com/leeyuentuen/localtuya to field “Repository”.
Category → Integration

In configuration.yaml type:

localtuya: # https://github.com/leeyuentuen/localtuya
  - host: 192.168.43.234
    device_id: 63455650e868e76a56d5
    local_key: db40c12220a110e9
    friendly_name: WiFivykl3knopki
    protocol_version: "3.3"
    entities:
      - platform: switch
        friendly_name: WiFivykl3knopki_kl1
        id: 1
      - platform: switch
        friendly_name: WiFivykl3knopki_kl2
        id: 2
      - platform: switch
        friendly_name: WiFivykl3knopki_kl3
        id: 3
  
  - host: 192.168.43.228
    device_id: bf86dcb75e6b43bb898wev
    local_key: f672c2d227b29109
    friendly_name: WiFi автомат WIFIMCB
    protocol_version: "3.3"
    entities:
      - platform: switch
        friendly_name: WIFIMCB_switch
        id: 1
        
      - platform: sensor
        friendly_name: WIFIMCB_countdown
        id: 7
        
      - platform: sensor
        friendly_name: WIFIMCB_status
        id: 14
  
  
  - host: 192.168.43.229
    device_id: bf27a4370ab31e50012hrz
    local_key: 36c2070bc6b515c1
    friendly_name: Relay WiFi
    protocol_version: "3.3"
    entities:
      - platform: switch
        friendly_name: Relay WiFi switch
        id: 1
        
      - platform: sensor
        friendly_name: Relay WiFi countdown
        id: 9
        
      - platform: sensor
        friendly_name: Relay WiFi status
        id: 38
  
  
  
  - host: 192.168.43.237
    device_id: bff933c1ce40432fb7poig
    local_key: f7dda3b01b8edf4d
    friendly_name: Tuya Gateway
    protocol_version: "3.3"
    is_gateway: true # This tells it is to be treated as a gateway and skip adding entities

      
  - parent_gateway: bff933c1ce40432fb7poig # This tells it is a sub-device dependent on a parent gateway
    device_id: 84fd27fffe609f39 # The cid of sub-device
    friendly_name: Relay ZigBee
    entities:
      - platform: switch
        friendly_name: Relay ZigBee switch
        id: 1
        
      - platform: sensor
        friendly_name: Relay ZigBee countdown
        id: 7
        
      - platform: sensor
        friendly_name: Relay ZigBee status
        id: 14
        
      - platform: sensor
        friendly_name: Relay ZigBee inching
        id: 19

  - parent_gateway: bff933c1ce40432fb7poig # This tells it is a sub-device dependent on a parent gateway
    device_id: 540f57fffeffd005 # The cid of sub-device
    friendly_name: Vibration Sensor
    entities:
      - platform: sensor
        friendly_name: vibr_shock_state
        id: 1
        
      - platform: sensor
        friendly_name: vibr_battery_percentage
        id: 4
        
      - platform: sensor
        friendly_name: vibr_sensitivity
        id: 6

      - platform: sensor
        friendly_name: Vibration Sensor 100
        id: 100

  - parent_gateway: bff933c1ce40432fb7poig # This tells it is a sub-device dependent on a parent gateway
    device_id: a4c138ff16215474 # The cid of sub-device
    friendly_name: Cover1
    entities:    
      - platform: cover
        friendly_name: Device Cover 1
        id: 1
        current_position_dp: 3 # Optional, required only for "position" mode
        set_position_dp: 2  # Optional, required only for "position" mode
        span_time: 25  # Full movement time: Optional, required only for "timed" mode


  - parent_gateway: bff933c1ce40432fb7poig # This tells it is a sub-device dependent on a parent gateway
    device_id: a4c1387c13ccbd7a # The cid of sub-device
    friendly_name: Air Housekeeper
    entities:
      - platform: sensor
        friendly_name: air_pm25
        id: 2
        device_class: pm25
        unit_of_measurement: "мкг/м3"
        
      - platform: sensor
        friendly_name: air_temp
        id: 18
        scaling: 0.1
        device_class: temperature
        unit_of_measurement: "°C"
        
      - platform: sensor
        friendly_name: air_humidity
        id: 19
        scaling: 0.1
        device_class: humidity
        unit_of_measurement: "%"
        
      - platform: sensor
        friendly_name: air формальдегиды
        id: 20
        device_class: carbon_dioxide
        unit_of_measurement: "м.д."
        
      - platform: sensor
        friendly_name: air_voc
        id: 21
        device_class: volatile_organic_compounds
        unit_of_measurement: "ppm"
        
      - platform: sensor
        friendly_name: air_co2
        id: 22
        device_class: carbon_dioxide
        unit_of_measurement: "ppm"


  - parent_gateway: bff933c1ce40432fb7poig # This tells it is a sub-device dependent on a parent gateway
    device_id: a4c138d5e24027d4 # The cid of sub-device
    friendly_name: Датчик протечки
    entities:
      - platform: binary_sensor
        friendly_name: wl_state
        id: 1
        device_class: moisture
        state_on: "alarm"
        state_off: "normal"
        
      - platform: sensor
        friendly_name: wl_battery_percentage
        id: 4
        device_class: battery
        unit_of_measurement: "%"


In this page are writen how to install and where is device_id and local_key: https://github.com/leeyuentuen/localtuya

I found IDs in Tuya API → Device Control → Get Device Specification Attribute. Maybe this url work: Tuya Smart Developer Center

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?