Update sensor.py

This commit is contained in:
Masterz69 2024-04-02 19:39:32 +03:00 committed by GitHub
parent d149aaa2d3
commit 06c0b32cea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,7 +11,10 @@ DEPENDENCIES = ["uart"]
ultrasonic_uart_ns = cg.esphome_ns.namespace("ultrasonic_uart")
UltrasonicSensorComponent_UART = ultrasonic_uart_ns.class_(
"UltrasonicSensorComponent_UART", sensor.Sensor, cg.PollingComponent, uart.UARTDevice,
"UltrasonicSensorComponent_UART",
sensor.Sensor,
cg.PollingComponent,
uart.UARTDevice,
)
CONFIG_SCHEMA = (
@ -36,6 +39,7 @@ FINAL_VALIDATE_SCHEMA = uart.final_validate_device_schema(
stop_bits=1,
)
async def to_code(config):
var = await sensor.new_sensor(config)
await cg.register_component(var, config)