mirror of
https://github.com/tjhorner/upsy-desky.git
synced 2026-01-09 15:37:54 -05:00
32 lines
786 B
Python
32 lines
786 B
Python
import esphome.codegen as cg
|
|
import esphome.config_validation as cv
|
|
from esphome.components import text_sensor
|
|
from esphome.const import (
|
|
ENTITY_CATEGORY_DIAGNOSTIC,
|
|
ICON_NEW_BOX,
|
|
)
|
|
|
|
project_version = cg.esphome_ns.namespace("project_version")
|
|
ProjectVersionTextSensor = project_version.class_(
|
|
"ProjectVersionTextSensor", text_sensor.TextSensor, cg.Component
|
|
)
|
|
|
|
CONFIG_SCHEMA = (
|
|
text_sensor.text_sensor_schema(
|
|
icon=ICON_NEW_BOX,
|
|
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
|
)
|
|
.extend(
|
|
{
|
|
cv.GenerateID(): cv.declare_id(ProjectVersionTextSensor),
|
|
}
|
|
)
|
|
.extend(cv.COMPONENT_SCHEMA)
|
|
)
|
|
|
|
|
|
async def to_code(config):
|
|
var = await text_sensor.new_text_sensor(config)
|
|
await cg.register_component(var, config)
|
|
|