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

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