1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 06:33:51 +00:00

Move remaining SENSOR_SCHEMA to use sensor_schema() (#4471)

This commit is contained in:
Jesse Hills
2023-02-20 16:22:37 +13:00
committed by GitHub
parent 247916fe89
commit 50fbbf2d3b
9 changed files with 79 additions and 61 deletions

View File

@@ -14,14 +14,17 @@ MCP3008Sensor = mcp3008_ns.class_(
CONF_REFERENCE_VOLTAGE = "reference_voltage"
CONF_MCP3008_ID = "mcp3008_id"
CONFIG_SCHEMA = sensor.SENSOR_SCHEMA.extend(
{
cv.GenerateID(): cv.declare_id(MCP3008Sensor),
cv.GenerateID(CONF_MCP3008_ID): cv.use_id(MCP3008),
cv.Required(CONF_NUMBER): cv.int_,
cv.Optional(CONF_REFERENCE_VOLTAGE, default="3.3V"): cv.voltage,
}
).extend(cv.polling_component_schema("1s"))
CONFIG_SCHEMA = (
sensor.sensor_schema(MCP3008Sensor)
.extend(
{
cv.GenerateID(CONF_MCP3008_ID): cv.use_id(MCP3008),
cv.Required(CONF_NUMBER): cv.int_,
cv.Optional(CONF_REFERENCE_VOLTAGE, default="3.3V"): cv.voltage,
}
)
.extend(cv.polling_component_schema("1s"))
)
async def to_code(config):