Code:
esphome:
name: e16t
platform: ESP32
board: esp32dev
platformio_options:
board_build.extra_flags:
# WIFI_CONTROL_SELF_MODE = 0
# WIFI_CONTROL_SELF_MODE = 1
- "-DWIFI_CONTROL_SELF_MODE=0"
external_components:
- source:
type: git
url: https://github.com/hzkincony/esphome-tuya-wifi-mcu
ref: v1.1.0
uart:
tx_pin: 33
rx_pin: 14
id: tuya_mcu_uart
baud_rate: 9600
tuya_wifi_mcu:
# tuya mcu product id
product_id: tfj1dtlneyxp5uya
uart_id: tuya_mcu_uart
wifi_reset_pin: 5
wifi_led_pin: 12
# Example configuration entry for ESP32
i2c:
sda: 16
scl: 15
scan: true
id: bus_a
# Example configuration entry
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
# Example configuration entry
pcf8574:
- id: 'pcf8574_hub_out_1' # for output channel 1-8
address: 0x21
- id: 'pcf8574_hub_out_2' # for output channel 9-16
address: 0x25
- id: 'pcf8574_hub_in_1' # for input channel 1-8
address: 0x22
- id: 'pcf8574_hub_in_2' # for input channel 9-16
address: 0x24
# Individual outputs
switch:
- platform: gpio
name: "e16t_output1"
id: "e16t_output1"
pin:
pcf8574: pcf8574_hub_out_1
number: 0
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output1-tuya
dp_id: 1
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output1"
- platform: gpio
name: "e16t_output2"
id: "e16t_output2"
pin:
pcf8574: pcf8574_hub_out_1
number: 1
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output2-tuya
dp_id: 2
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output2"
- platform: gpio
name: "e16t_output3"
id: "e16t_output3"
pin:
pcf8574: pcf8574_hub_out_1
number: 2
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output3-tuya
dp_id: 3
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output3"
- platform: gpio
name: "e16t_output4"
id: "e16t_output4"
pin:
pcf8574: pcf8574_hub_out_1
number: 3
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output4-tuya
dp_id: 4
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output4"
- platform: gpio
name: "e16t_output5"
id: "e16t_output5"
pin:
pcf8574: pcf8574_hub_out_1
number: 4
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output5-tuya
dp_id: 5
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output5"
- platform: gpio
name: "e16t_output6"
id: "e16t_output6"
pin:
pcf8574: pcf8574_hub_out_1
number: 5
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output6-tuya
dp_id: 6
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output6"
- platform: gpio
name: "e16t_output7"
id: "e16t_output7"
pin:
pcf8574: pcf8574_hub_out_1
number: 6
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output7-tuya
dp_id: 101
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output7"
- platform: gpio
name: "e16t_output8"
id: "e16t_output8"
pin:
pcf8574: pcf8574_hub_out_1
number: 7
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output8-tuya
dp_id: 102
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output8"
- platform: gpio
name: "e16t_output9"
id: "e16t_output9"
pin:
pcf8574: pcf8574_hub_out_2
number: 0
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output9-tuya
dp_id: 103
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output9"
- platform: gpio
name: "e16t_output10"
id: "e16t_output10"
pin:
pcf8574: pcf8574_hub_out_2
number: 1
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output10-tuya
dp_id: 104
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output10"
- platform: gpio
name: "e16t_output11"
id: "e16t_output11"
pin:
pcf8574: pcf8574_hub_out_2
number: 2
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output11-tuya
dp_id: 105
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output11"
- platform: gpio
name: "e16t_output12"
id: "e16t_output12"
pin:
pcf8574: pcf8574_hub_out_2
number: 3
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output12-tuya
dp_id: 106
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output12"
- platform: gpio
name: "e16t_output13"
id: "e16t_output13"
pin:
pcf8574: pcf8574_hub_out_2
number: 4
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output13-tuya
dp_id: 107
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output13"
- platform: gpio
name: "e16t_output14"
id: "e16t_output14"
pin:
pcf8574: pcf8574_hub_out_2
number: 5
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output14-tuya
dp_id: 108
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output14"
- platform: gpio
name: "e16t_output15"
id: "e16t_output15"
pin:
pcf8574: pcf8574_hub_out_2
number: 6
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output15-tuya
dp_id: 109
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output15"
- platform: gpio
name: "e16t_output16"
id: "e16t_output16"
pin:
pcf8574: pcf8574_hub_out_2
number: 7
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t-output16-tuya
dp_id: 110
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "e16t_output16"
binary_sensor:
- platform: gpio
name: "e16t-input1"
id: "e16t_input1"
pin:
pcf8574: pcf8574_hub_in_1
number: 0
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI01 Tuya
dp_id: 111
bind_binary_sensor_id: e16t_input1
internal: true
- platform: gpio
name: "e16t-input2"
id: "e16t_input2"
pin:
pcf8574: pcf8574_hub_in_1
number: 1
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI02 Tuya
dp_id: 112
bind_binary_sensor_id: e16t_input2
internal: true
- platform: gpio
name: "e16t-input3"
id: "e16t_input3"
pin:
pcf8574: pcf8574_hub_in_1
number: 2
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI03 Tuya
dp_id: 113
bind_binary_sensor_id: e16t_input3
internal: true
- platform: gpio
name: "e16t-input4"
id: "e16t_input4"
pin:
pcf8574: pcf8574_hub_in_1
number: 3
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI04 Tuya
dp_id: 114
bind_binary_sensor_id: e16t_input4
internal: true
- platform: gpio
name: "e16t-input5"
id: "e16t_input5"
pin:
pcf8574: pcf8574_hub_in_1
number: 4
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI05 Tuya
dp_id: 115
bind_binary_sensor_id: e16t_input5
internal: true
- platform: gpio
name: "e16t-input6"
id: "e16t_input6"
pin:
pcf8574: pcf8574_hub_in_1
number: 5
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI06 Tuya
dp_id: 116
bind_binary_sensor_id: e16t_input6
internal: true
- platform: gpio
name: "e16t-input7"
id: "e16t_input7"
pin:
pcf8574: pcf8574_hub_in_1
number: 6
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI07 Tuya
dp_id: 117
bind_binary_sensor_id: e16t_input7
internal: true
- platform: gpio
name: "e16t-input8"
id: "e16t_input8"
pin:
pcf8574: pcf8574_hub_in_1
number: 7
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI08 Tuya
dp_id: 118
bind_binary_sensor_id: e16t_input8
internal: true
- platform: gpio
name: "e16t-input9"
id: "e16t_input9"
pin:
pcf8574: pcf8574_hub_in_2
number: 0
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI09 Tuya
dp_id: 119
bind_binary_sensor_id: e16t_input9
internal: true
- platform: gpio
name: "e16t-input10"
id: "e16t_input10"
pin:
pcf8574: pcf8574_hub_in_2
number: 1
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI10 Tuya
dp_id: 120
bind_binary_sensor_id: e16t_input10
internal: true
- platform: gpio
name: "e16t-input11"
id: "e16t_input11"
pin:
pcf8574: pcf8574_hub_in_2
number: 2
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI11 Tuya
dp_id: 121
bind_binary_sensor_id: e16t_input11
internal: true
- platform: gpio
name: "e16t-input12"
id: "e16t_input12"
pin:
pcf8574: pcf8574_hub_in_2
number: 3
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI12 Tuya
dp_id: 122
bind_binary_sensor_id: e16t_input12
internal: true
- platform: gpio
name: "e16t-input13"
id: "e16t_input13"
pin:
pcf8574: pcf8574_hub_in_2
number: 4
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI13 Tuya
dp_id: 123
bind_binary_sensor_id: e16t_input13
internal: true
- platform: gpio
name: "e16t-input14"
id: "e16t_input14"
pin:
pcf8574: pcf8574_hub_in_2
number: 5
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI14 Tuya
dp_id: 124
bind_binary_sensor_id: e16t_input14
internal: true
- platform: gpio
name: "e16t-input15"
id: "e16t_input15"
pin:
pcf8574: pcf8574_hub_in_2
number: 6
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI15 Tuya
dp_id: 125
bind_binary_sensor_id: e16t_input15
internal: true
- platform: gpio
name: "e16t-input16"
id: "e16t_input16"
pin:
pcf8574: pcf8574_hub_in_2
number: 7
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: e16t DI16 Tuya
dp_id: 126
bind_binary_sensor_id: e16t_input16
internal: true
# Enable logging
logger:
# Enable Home Assistant API
api: