ESPHome Tuya 4Gang Switches

esphome:
name: aziot-switch
friendly_name: AZIOT_Switch
project:
name: esphome.web
version: dev

bk72xx:
board: cb3s

Enable logging

logger:

Enable Home Assistant API

api:
encryption:

ota:

  • platform: esphome

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: “Aziot-Switch Fallback Hotspot”
password: “ur pass”

captive_portal:

switch:

  • platform: gpio
    name: Light
    pin: P14
    id: relay_1

  • platform: gpio
    name: Fan
    pin: P6
    id: relay_2

  • platform: gpio
    name: Lamp
    pin: P9
    id: relay_3

  • platform: gpio
    name: Socket
    pin: P8
    id: relay_4
    restore_mode: ALWAYS_ON

  • platform: restart
    name: Restart

binary_sensor:

  • platform: status
    name: Status

  • platform: gpio
    pin:
    number: P24
    mode: INPUT_PULLUP
    inverted: True
    name: Light
    on_press:

    • switch.toggle: relay_1
  • platform: gpio
    pin:
    number: P10
    mode: INPUT_PULLUP
    inverted: True
    name: Fan
    on_press:

    • switch.toggle: relay_2
  • platform: gpio
    pin:
    number: P7
    mode: INPUT_PULLUP
    inverted: True
    name: Lamp
    on_press:

    • switch.toggle: relay_3
  • platform: gpio
    pin:
    number: P26
    mode: INPUT_PULLUP
    inverted: True
    name: Socket
    on_press:

    • switch.toggle: relay_4

status_led:
pin:
number: P11
inverted: true
mode:
output: true

sensor:

  • platform: wifi_signal
    name: “AZIOT 4Gang WiFi Signal Strength”
    update_interval: 300s
    device_class: signal_strength
    entity_category: diagnostic
    filters:

    • lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
      unit_of_measurement: " %"
  • platform: uptime
    name: Uptime
    disabled_by_default: false
    force_update: false
    unit_of_measurement: s
    icon: mdi:timer-outline
    accuracy_decimals: 0
    device_class: duration
    state_class: total_increasing
    entity_category: diagnostic
    update_interval: 60s

  • platform: internal_temperature
    id: esp_internal_temperature
    name: “Internal Temperature”
    unit_of_measurement: °C
    accuracy_decimals: 1
    device_class: temperature
    state_class: measurement
    entity_category: diagnostic
    update_interval: 60s

text_sensor:

  • platform: wifi_info
    ip_address:
    name: IP
    ssid:
    name: SSID
  • platform: version
    name: Version
    hide_timestamp: true
    disabled_by_default: false
    icon: mdi:new-box
    entity_category: diagnostic

web_server:
port: 80
local: True

2 Likes

Post your code in code tags
RTFM
The forum editor completely screws up your formatting to make it unreadable.

1 Like

And please let us know exactly what device this is. A link to AliExpress would help.

1 Like

Right, now post your code properly.

1 Like

how to send my yaml file

esphome:
  name: aziot-switch
  friendly_name: AZIOT_Switch
  project:
    name: esphome.web
    version: dev

bk72xx:
  board: cb3s

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:

ota:

platform: esphome
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Aziot-Switch Fallback Hotspot"
    password: "ur pass"

captive_portal:

switch:
  - platform: gpio
    name: Light
    pin: P14
    id: relay_1

  - platform: gpio
    name: Fan
    pin: P6
    id: relay_2

  - platform: gpio
    name: Lamp
    pin: P9
    id: relay_3

  - platform: gpio
    name: Socket
    pin: P8
    id: relay_4
    restore_mode: ALWAYS_ON

  - platform: restart
    name: Restart

binary_sensor:
  - platform: status
    name: Status

  - platform: gpio
    pin:
      number: P24
      mode: INPUT_PULLUP
      inverted: True
    name: Light
    on_press:
      switch.toggle: relay_1

  - platform: gpio
    pin:
      number: P10
      mode: INPUT_PULLUP
      inverted: True
    name: Fan
    on_press:
      switch.toggle: relay_2

  - platform: gpio
    pin:
      number: P7
      mode: INPUT_PULLUP
      inverted: True
    name: Lamp
    on_press:
      switch.toggle: relay_3

  - platform: gpio
    pin:
      number: P26
      mode: INPUT_PULLUP
      inverted: True
    name: Socket
    on_press:
      switch.toggle: relay_4

status_led:
  pin:
    number: P11
    inverted: true
  mode: output
  output: true

sensor:
  - platform: wifi_signal
    name: "AZIOT 4Gang WiFi Signal Strength"
    update_interval: 300s
    device_class: signal_strength
    entity_category: diagnostic
    filters:
      lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: " %"

  - platform: uptime
    name: Uptime
    disabled_by_default: false
    force_update: false
    unit_of_measurement: s
    icon: mdi:timer-outline
    accuracy_decimals: 0
    device_class: duration
    state_class: total_increasing
    entity_category: diagnostic
    update_interval: 60s

  - platform: internal_temperature
    id: esp_internal_temperature
    name: "Internal Temperature"
    unit_of_measurement: °C
    accuracy_decimals: 1
    device_class: temperature
    state_class: measurement
    entity_category: diagnostic
    update_interval: 60s

text_sensor:
  - platform: wifi_info
    ip_address:
      name: IP
    ssid:
      name: SSID

  - platform: version
    name: Version
    hide_timestamp: true
    disabled_by_default: false
    icon: mdi:new-box
    entity_category: diagnostic

web_server:
  port: 80
  local: True

how do i go about flashing these myself? any guide to follow?
i’ll buy them next week are the still flashable?

Hi, this expects opening up the unit and accessing the pins physically right?
I have some of these and on opening up, see that tuya has made the disassembly tougher than earlier devices, but not impossible, need to desolder some 7 pins which connect to the wifi board. Didn’t do the desoldering yet, looking up for anything similar to tuya convert exists so might not need to open up some 20 of these. But if it comes to that, yeah…

Hi @gpbipin
Any luck with flashing this remotely with ESPHome? I’m in the same situation as you are

@gavashkarraju did you open the device to flash them with ESPHome?

Hi everyone, I’ve added the DP mappings of various Aziot/Homemate products to “Tuya Local” integration available via HACS. So using the latest release, all Aziot switch will work with local control when configured with local key taken from Tuya IoT cloud.

PR - Added support for Aziot 8 & 7 Node smart switches by pranjal-joshi · Pull Request #3606 · make-all/tuya-local · GitHub