mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 01:08:03 +01:00
Set entity-category to diagnostic for debug component (#3209)
Co-authored-by: Stewart Morgan <stewart@arnos-vale.net> Co-authored-by: root <root@build.servers.arnos-vale.net>
This commit is contained in:
parent
657b1c60ae
commit
b9398897c1
2 changed files with 29 additions and 6 deletions
|
@ -6,6 +6,7 @@ from esphome.const import (
|
||||||
CONF_FRAGMENTATION,
|
CONF_FRAGMENTATION,
|
||||||
CONF_BLOCK,
|
CONF_BLOCK,
|
||||||
CONF_LOOP_TIME,
|
CONF_LOOP_TIME,
|
||||||
|
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||||
UNIT_MILLISECOND,
|
UNIT_MILLISECOND,
|
||||||
UNIT_PERCENT,
|
UNIT_PERCENT,
|
||||||
UNIT_BYTES,
|
UNIT_BYTES,
|
||||||
|
@ -18,14 +19,34 @@ DEPENDENCIES = ["debug"]
|
||||||
|
|
||||||
CONFIG_SCHEMA = {
|
CONFIG_SCHEMA = {
|
||||||
cv.GenerateID(CONF_DEBUG_ID): cv.use_id(DebugComponent),
|
cv.GenerateID(CONF_DEBUG_ID): cv.use_id(DebugComponent),
|
||||||
cv.Optional(CONF_FREE): sensor.sensor_schema(UNIT_BYTES, ICON_COUNTER, 0),
|
cv.Optional(CONF_FREE): sensor.sensor_schema(
|
||||||
cv.Optional(CONF_BLOCK): sensor.sensor_schema(UNIT_BYTES, ICON_COUNTER, 0),
|
unit_of_measurement=UNIT_BYTES,
|
||||||
|
icon=ICON_COUNTER,
|
||||||
|
accuracy_decimals=0,
|
||||||
|
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||||
|
),
|
||||||
|
cv.Optional(CONF_BLOCK): sensor.sensor_schema(
|
||||||
|
unit_of_measurement=UNIT_BYTES,
|
||||||
|
icon=ICON_COUNTER,
|
||||||
|
accuracy_decimals=0,
|
||||||
|
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||||
|
),
|
||||||
cv.Optional(CONF_FRAGMENTATION): cv.All(
|
cv.Optional(CONF_FRAGMENTATION): cv.All(
|
||||||
cv.only_on_esp8266,
|
cv.only_on_esp8266,
|
||||||
cv.require_framework_version(esp8266_arduino=cv.Version(2, 5, 2)),
|
cv.require_framework_version(esp8266_arduino=cv.Version(2, 5, 2)),
|
||||||
sensor.sensor_schema(UNIT_PERCENT, ICON_COUNTER, 1),
|
sensor.sensor_schema(
|
||||||
|
unit_of_measurement=UNIT_PERCENT,
|
||||||
|
icon=ICON_COUNTER,
|
||||||
|
accuracy_decimals=1,
|
||||||
|
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
cv.Optional(CONF_LOOP_TIME): sensor.sensor_schema(
|
||||||
|
unit_of_measurement=UNIT_MILLISECOND,
|
||||||
|
icon=ICON_TIMER,
|
||||||
|
accuracy_decimals=0,
|
||||||
|
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
cv.Optional(CONF_LOOP_TIME): sensor.sensor_schema(UNIT_MILLISECOND, ICON_TIMER, 0),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from esphome.components import text_sensor
|
from esphome.components import text_sensor
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
from esphome.const import CONF_DEVICE
|
from esphome.const import CONF_DEVICE, ENTITY_CATEGORY_DIAGNOSTIC
|
||||||
|
|
||||||
from . import CONF_DEBUG_ID, DebugComponent
|
from . import CONF_DEBUG_ID, DebugComponent
|
||||||
|
|
||||||
|
@ -11,7 +11,9 @@ DEPENDENCIES = ["debug"]
|
||||||
CONFIG_SCHEMA = cv.Schema(
|
CONFIG_SCHEMA = cv.Schema(
|
||||||
{
|
{
|
||||||
cv.GenerateID(CONF_DEBUG_ID): cv.use_id(DebugComponent),
|
cv.GenerateID(CONF_DEBUG_ID): cv.use_id(DebugComponent),
|
||||||
cv.Optional(CONF_DEVICE): text_sensor.text_sensor_schema(),
|
cv.Optional(CONF_DEVICE): text_sensor.text_sensor_schema(
|
||||||
|
entity_category=ENTITY_CATEGORY_DIAGNOSTIC
|
||||||
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue