2019-04-17 12:06:00 +02:00
|
|
|
import esphome.codegen as cg
|
2022-11-23 22:42:20 +13:00
|
|
|
import esphome.config_validation as cv
|
2022-01-25 20:18:41 +02:00
|
|
|
from esphome.const import (
|
2022-11-23 22:42:20 +13:00
|
|
|
CONF_BLOCK,
|
2022-01-25 20:18:41 +02:00
|
|
|
CONF_DEVICE,
|
|
|
|
CONF_FRAGMENTATION,
|
2022-11-23 22:42:20 +13:00
|
|
|
CONF_FREE,
|
|
|
|
CONF_ID,
|
2022-01-25 20:18:41 +02:00
|
|
|
CONF_LOOP_TIME,
|
|
|
|
)
|
2019-04-17 12:06:00 +02:00
|
|
|
|
2021-03-07 16:03:16 -03:00
|
|
|
CODEOWNERS = ["@OttoWinter"]
|
|
|
|
DEPENDENCIES = ["logger"]
|
2019-04-17 12:06:00 +02:00
|
|
|
|
2022-02-08 00:45:27 +01:00
|
|
|
CONF_DEBUG_ID = "debug_id"
|
2021-03-07 16:03:16 -03:00
|
|
|
debug_ns = cg.esphome_ns.namespace("debug")
|
2022-01-25 20:18:41 +02:00
|
|
|
DebugComponent = debug_ns.class_("DebugComponent", cg.PollingComponent)
|
|
|
|
|
|
|
|
|
2023-04-26 22:03:30 +02:00
|
|
|
CONFIG_SCHEMA = cv.All(
|
|
|
|
cv.Schema(
|
|
|
|
{
|
|
|
|
cv.GenerateID(): cv.declare_id(DebugComponent),
|
|
|
|
cv.Optional(CONF_DEVICE): cv.invalid(
|
|
|
|
"The 'device' option has been moved to the 'debug' text_sensor component"
|
|
|
|
),
|
|
|
|
cv.Optional(CONF_FREE): cv.invalid(
|
|
|
|
"The 'free' option has been moved to the 'debug' sensor component"
|
|
|
|
),
|
|
|
|
cv.Optional(CONF_BLOCK): cv.invalid(
|
|
|
|
"The 'block' option has been moved to the 'debug' sensor component"
|
|
|
|
),
|
|
|
|
cv.Optional(CONF_FRAGMENTATION): cv.invalid(
|
|
|
|
"The 'fragmentation' option has been moved to the 'debug' sensor component"
|
|
|
|
),
|
|
|
|
cv.Optional(CONF_LOOP_TIME): cv.invalid(
|
|
|
|
"The 'loop_time' option has been moved to the 'debug' sensor component"
|
|
|
|
),
|
|
|
|
}
|
|
|
|
).extend(cv.polling_component_schema("60s")),
|
|
|
|
)
|
2019-04-17 12:06:00 +02:00
|
|
|
|
|
|
|
|
2021-05-24 10:58:29 +02:00
|
|
|
async def to_code(config):
|
2019-04-22 21:56:30 +02:00
|
|
|
var = cg.new_Pvariable(config[CONF_ID])
|
2021-05-24 10:58:29 +02:00
|
|
|
await cg.register_component(var, config)
|