1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-01 08:28:15 +01:00
Kuba Szczodrzyński a9630ac847
Support for LibreTiny platform (RTL8710, BK7231 & other modules) (#3509)
Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
Co-authored-by: Sam Neirinck <git@samneirinck.com>
Co-authored-by: David Buezas <dbuezas@users.noreply.github.com>
Co-authored-by: Stroe Andrei Catalin <catalin2402@gmail.com>
Co-authored-by: Sam Neirinck <github@samneirinck.be>
Co-authored-by: Péter Sárközi <xmisterhu@gmail.com>
Co-authored-by: Hajo Noerenberg <hn@users.noreply.github.com>
2023-09-05 10:16:08 +12:00

32 lines
835 B
Python

import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import text_sensor
from esphome.const import (
CONF_VERSION,
ENTITY_CATEGORY_DIAGNOSTIC,
ICON_CELLPHONE_ARROW_DOWN,
)
from .const import CONF_LIBRETINY, LTComponent
DEPENDENCIES = ["libretiny"]
CONFIG_SCHEMA = cv.Schema(
{
cv.GenerateID(CONF_LIBRETINY): cv.use_id(LTComponent),
cv.Optional(CONF_VERSION): text_sensor.text_sensor_schema(
icon=ICON_CELLPHONE_ARROW_DOWN,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
}
)
async def to_code(config):
lt_component = await cg.get_variable(config[CONF_LIBRETINY])
if CONF_VERSION in config:
sens = await text_sensor.new_text_sensor(config[CONF_VERSION])
cg.add(lt_component.set_version_sensor(sens))