11-03-2024, 02:37 PM
Hello. I'm configuring the KC868-A8 board with Esphome and the Tuya license. However, I found some errors and would like to share them for a possible solution. KC868-A8 board esphome + Tuya
It's giving an error that I don't know exactly. error image attached.
# Basic Config
esphome:
name: kc868-a8-contato-web-dht-tuya2
platform: ESP32
board: esp32dev
external_components:
- source:
type: git
url: https://github.com/hzkincony/esphome-tuya-iot
ref: v1.2.0
# Enable logging
logger:
baud_rate: 0
api:
encryption:
key: "It2KB/xCg0EuwXMc1KyiTXRTSjr0hdQXmxQXnwIVmOE="
ota:
- platform: esphome
password: "70604538ddb4bdb4362c2d63114dfb1d"
i2c:
sda: 4
scl: 5
scan: true
id: bus_a
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
# Add web server
web_server:
port: 80
auth:
username: admin
password: "admin"
text_sensor:
- platform: homeassistant
name: "Casa Inteligente"
id: home_assistant_text
entity_id: input_text.test
pcf8574:
- id: 'pcf8574_hub_out_1' # for output channel 1-8
address: 0x24
- id: 'pcf8574_hub_in_1' # for input channel 1-8
address: 0x22
time:
- platform: homeassistant
id: homeassistant_time
# Individual outputs
switch:
- platform: gpio
name: "light1"
id: light1
pin:
pcf8574: pcf8574_hub_out_1
number: 0
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output1", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output1", false);
- platform: gpio
name: "light2"
id: light2
pin:
pcf8574: pcf8574_hub_out_1
number: 1
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output2", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output2", false);
- platform: gpio
name: "light3"
id: light3
pin:
pcf8574: pcf8574_hub_out_1
number: 2
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output3", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output3", false);
- platform: gpio
name: "light4"
id: light4
pin:
pcf8574: pcf8574_hub_out_1
number: 3
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output4", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output4", false);
- platform: gpio
name: "light5"
id: light5
pin:
pcf8574: pcf8574_hub_out_1
number: 4
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output5", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output5", false);
- platform: gpio
name: "light6"
id: light6
pin:
pcf8574: pcf8574_hub_out_1
number: 5
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output6", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output6", false);
- platform: gpio
name: "light7"
id: light7
pin:
pcf8574: pcf8574_hub_out_1
number: 6
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output7", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output7", false);
- platform: gpio
name: "light8"
id: light8
pin:
pcf8574: pcf8574_hub_out_1
number: 7
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output8", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output8", false);
binary_sensor:
- platform: gpio
name: "input1"
on_press:
then:
- switch.toggle: light1
pin:
pcf8574: pcf8574_hub_in_1
number: 0
mode: INPUT
inverted: true
- platform: gpio
name: "input2"
on_press:
then:
- switch.toggle: light2
pin:
pcf8574: pcf8574_hub_in_1
number: 1
mode: INPUT
inverted: true
- platform: gpio
name: "input3"
on_press:
then:
- switch.toggle: light3
pin:
pcf8574: pcf8574_hub_in_1
number: 2
mode: INPUT
inverted: true
- platform: gpio
name: "input4"
on_press:
then:
- switch.toggle: light4
pin:
pcf8574: pcf8574_hub_in_1
number: 3
mode: INPUT
inverted: true
- platform: gpio
name: "input5"
on_press:
then:
- switch.toggle: light5
pin:
pcf8574: pcf8574_hub_in_1
number: 4
mode: INPUT
inverted: true
- platform: gpio
name: "input6"
on_press:
then:
- switch.toggle: light6
pin:
pcf8574: pcf8574_hub_in_1
number: 5
mode: INPUT
inverted: true
- platform: gpio
name: "input7"
on_press:
then:
- switch.toggle: light7
pin:
pcf8574: pcf8574_hub_in_1
number: 6
mode: INPUT
inverted: true
- platform: gpio
name: "input8"
on_press:
then:
- switch.toggle: light8
pin:
pcf8574: pcf8574_hub_in_1
number: 7
mode: INPUT
inverted: true
- platform: gpio
name: "a8-s3"
pin:
number: 32
inverted: true
- platform: gpio
name: "a8-s4"
pin:
number: 33
inverted: true
one_wire:
- platform: gpio
pin: GPIO14
sensor:
- platform: dallas_temp
name: "Temperatura QCC"
id: temperatura_1
address: 0x06136e7e1f64ff28 # Endereço específico do sensor
accuracy_decimals: 1 # Precisão do sensor em casas decimais
update_interval: 30s # Intervalo de atualização dos dados
- platform: dht
pin: GPIO13 # Ajuste para o pino que você está usando
model: DHT22 # Substitua pelo modelo do seu sensor (DHT11, DHT22, AM2301, etc.)
temperature:
name: "Temperatura externa"
humidity:
name: "Umidade externa"
update_interval: 30s # Ajuste o intervalo de atualização conforme necessário
tuya_iot:
id: tuya_iot_component
product_id: xxx
device_id: xxx
device_secret: xxx
region: us # eu, us, eus, weu, in, cn
# eu: Central Europe Data Center
# us: US West Data Center
# eus: US East Data Center
# weu: Western Europe Data Center
# in: India Data Center
# cn: Chinese Data Center
on_event:
- event_name: property/set
then:
- lambda: !lambda |-
// Append the required switch in switch_map to respond to commands issued by Tuya.
static std::map<float, switch_::Switch*> switch_map {
{ 1, id(light1) },
{ 2, id(light2) },
{ 3, id(light3) },
{ 4, id(light4) },
{ 5, id(light5) },
{ 6, id(light6) },
{ 7, id(light7) },
{ 8, id(light8) },
};
......>
It's giving an error that I don't know exactly. error image attached.
# Basic Config
esphome:
name: kc868-a8-contato-web-dht-tuya2
platform: ESP32
board: esp32dev
external_components:
- source:
type: git
url: https://github.com/hzkincony/esphome-tuya-iot
ref: v1.2.0
# Enable logging
logger:
baud_rate: 0
api:
encryption:
key: "It2KB/xCg0EuwXMc1KyiTXRTSjr0hdQXmxQXnwIVmOE="
ota:
- platform: esphome
password: "70604538ddb4bdb4362c2d63114dfb1d"
i2c:
sda: 4
scl: 5
scan: true
id: bus_a
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
# Add web server
web_server:
port: 80
auth:
username: admin
password: "admin"
text_sensor:
- platform: homeassistant
name: "Casa Inteligente"
id: home_assistant_text
entity_id: input_text.test
pcf8574:
- id: 'pcf8574_hub_out_1' # for output channel 1-8
address: 0x24
- id: 'pcf8574_hub_in_1' # for input channel 1-8
address: 0x22
time:
- platform: homeassistant
id: homeassistant_time
# Individual outputs
switch:
- platform: gpio
name: "light1"
id: light1
pin:
pcf8574: pcf8574_hub_out_1
number: 0
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output1", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output1", false);
- platform: gpio
name: "light2"
id: light2
pin:
pcf8574: pcf8574_hub_out_1
number: 1
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output2", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output2", false);
- platform: gpio
name: "light3"
id: light3
pin:
pcf8574: pcf8574_hub_out_1
number: 2
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output3", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output3", false);
- platform: gpio
name: "light4"
id: light4
pin:
pcf8574: pcf8574_hub_out_1
number: 3
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output4", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output4", false);
- platform: gpio
name: "light5"
id: light5
pin:
pcf8574: pcf8574_hub_out_1
number: 4
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output5", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output5", false);
- platform: gpio
name: "light6"
id: light6
pin:
pcf8574: pcf8574_hub_out_1
number: 5
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output6", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output6", false);
- platform: gpio
name: "light7"
id: light7
pin:
pcf8574: pcf8574_hub_out_1
number: 6
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output7", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output7", false);
- platform: gpio
name: "light8"
id: light8
pin:
pcf8574: pcf8574_hub_out_1
number: 7
mode: OUTPUT
inverted: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output8", true);
on_turn_off:
- lambda: !lambda |-
id(tuya_iot_component).property_report("output8", false);
binary_sensor:
- platform: gpio
name: "input1"
on_press:
then:
- switch.toggle: light1
pin:
pcf8574: pcf8574_hub_in_1
number: 0
mode: INPUT
inverted: true
- platform: gpio
name: "input2"
on_press:
then:
- switch.toggle: light2
pin:
pcf8574: pcf8574_hub_in_1
number: 1
mode: INPUT
inverted: true
- platform: gpio
name: "input3"
on_press:
then:
- switch.toggle: light3
pin:
pcf8574: pcf8574_hub_in_1
number: 2
mode: INPUT
inverted: true
- platform: gpio
name: "input4"
on_press:
then:
- switch.toggle: light4
pin:
pcf8574: pcf8574_hub_in_1
number: 3
mode: INPUT
inverted: true
- platform: gpio
name: "input5"
on_press:
then:
- switch.toggle: light5
pin:
pcf8574: pcf8574_hub_in_1
number: 4
mode: INPUT
inverted: true
- platform: gpio
name: "input6"
on_press:
then:
- switch.toggle: light6
pin:
pcf8574: pcf8574_hub_in_1
number: 5
mode: INPUT
inverted: true
- platform: gpio
name: "input7"
on_press:
then:
- switch.toggle: light7
pin:
pcf8574: pcf8574_hub_in_1
number: 6
mode: INPUT
inverted: true
- platform: gpio
name: "input8"
on_press:
then:
- switch.toggle: light8
pin:
pcf8574: pcf8574_hub_in_1
number: 7
mode: INPUT
inverted: true
- platform: gpio
name: "a8-s3"
pin:
number: 32
inverted: true
- platform: gpio
name: "a8-s4"
pin:
number: 33
inverted: true
one_wire:
- platform: gpio
pin: GPIO14
sensor:
- platform: dallas_temp
name: "Temperatura QCC"
id: temperatura_1
address: 0x06136e7e1f64ff28 # Endereço específico do sensor
accuracy_decimals: 1 # Precisão do sensor em casas decimais
update_interval: 30s # Intervalo de atualização dos dados
- platform: dht
pin: GPIO13 # Ajuste para o pino que você está usando
model: DHT22 # Substitua pelo modelo do seu sensor (DHT11, DHT22, AM2301, etc.)
temperature:
name: "Temperatura externa"
humidity:
name: "Umidade externa"
update_interval: 30s # Ajuste o intervalo de atualização conforme necessário
tuya_iot:
id: tuya_iot_component
product_id: xxx
device_id: xxx
device_secret: xxx
region: us # eu, us, eus, weu, in, cn
# eu: Central Europe Data Center
# us: US West Data Center
# eus: US East Data Center
# weu: Western Europe Data Center
# in: India Data Center
# cn: Chinese Data Center
on_event:
- event_name: property/set
then:
- lambda: !lambda |-
// Append the required switch in switch_map to respond to commands issued by Tuya.
static std::map<float, switch_::Switch*> switch_map {
{ 1, id(light1) },
{ 2, id(light2) },
{ 3, id(light3) },
{ 4, id(light4) },
{ 5, id(light5) },
{ 6, id(light6) },
{ 7, id(light7) },
{ 8, id(light8) },
};
......>