esphome:
name: abc
friendly_name: abc
includes:
- my_custom_component.h
esp32:
board: esp32dev
framework:
type: arduino
# Enable Home Assistant API
api:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Abc Fallback Hotspot"
password: "123456789"
captive_portal:
# Enable logging
logger:
level: DEBUG
on_message:
# level: DEBUG
# then:
# - uart.write: !lambda |-
# std::vector<unsigned char> data;
# data.insert(data.end(), message, message + strlen(message));
# data.insert(data.end(), {13, 10});
# return data;
- uart.write: !lambda |-
std::vector<unsigned char> data;
data.insert(data.end(), message, message + strlen(message));
data.insert(data.end(), {13, 10});
return data;
text_sensor:
- platform: custom
lambda: |-
auto my_custom = new MyCustomComponent(id(uart_bus));
App.register_component(my_custom);
return {my_custom->uart_text_sensors};
text_sensors:
name: "UartSensor"
uart:
id: uart_bus
tx_pin: GPIO22
rx_pin: GPIO26
baud_rate: 9600
debug:
direction: RX
dummy_receiver: false
after:
delimiter: "\r\n"
sequence:
- lambda: UARTDebug::log_string(direction, bytes);
web_server:
port: 80
sensor:
- platform: uptime
name: Uptime
这个是esp32的
可以的话大佬顺便也试试esp8266看能不能成功 |