18 lines
629 B
Python
18 lines
629 B
Python
import esphome.codegen as cg
|
|
import esphome.config_validation as cv
|
|
from esphome.components import text_sensor
|
|
from esphome.const import CONF_ID
|
|
|
|
empty_text_sensor_ns = cg.esphome_ns.namespace('empty_text_sensor')
|
|
EmptyTextSensor = empty_text_sensor_ns.class_('EmptyTextSensor', text_sensor.TextSensor, cg.Component)
|
|
|
|
CONFIG_SCHEMA = text_sensor.TEXT_SENSOR_SCHEMA.extend({
|
|
cv.GenerateID(): cv.declare_id(EmptyTextSensor)
|
|
}).extend(cv.COMPONENT_SCHEMA)
|
|
|
|
|
|
def to_code(config):
|
|
var = cg.new_Pvariable(config[CONF_ID])
|
|
yield text_sensor.register_text_sensor(var, config)
|
|
yield cg.register_component(var, config)
|
|
|