From 31d3d16a68e67f1d7b43ca8909c016fdbd626054 Mon Sep 17 00:00:00 2001 From: Ramil Valitov Date: Fri, 8 Nov 2024 13:16:38 +0300 Subject: [PATCH] [fix] report about required component --- esphome/components/status/__init__.py | 2 ++ esphome/components/status/binary_sensor.py | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/esphome/components/status/__init__.py b/esphome/components/status/__init__.py index e69de29bb2..f0eaa140be 100644 --- a/esphome/components/status/__init__.py +++ b/esphome/components/status/__init__.py @@ -0,0 +1,2 @@ +DEPENDENCIES = ["network"] +CONF_STATUS_ID = "status_id" \ No newline at end of file diff --git a/esphome/components/status/binary_sensor.py b/esphome/components/status/binary_sensor.py index 1f2b7c9d18..b050c0b6ae 100644 --- a/esphome/components/status/binary_sensor.py +++ b/esphome/components/status/binary_sensor.py @@ -5,6 +5,7 @@ from esphome.const import ( DEVICE_CLASS_CONNECTIVITY, ENTITY_CATEGORY_DIAGNOSTIC, ) +from . import CONF_STATUS_ID status_ns = cg.esphome_ns.namespace("status") StatusBinarySensor = status_ns.class_( @@ -15,7 +16,15 @@ CONFIG_SCHEMA = binary_sensor.binary_sensor_schema( StatusBinarySensor, device_class=DEVICE_CLASS_CONNECTIVITY, entity_category=ENTITY_CATEGORY_DIAGNOSTIC, -).extend(cv.COMPONENT_SCHEMA) +).extend(cv.COMPONENT_SCHEMA).extend( + cv.Schema( + { + cv.GenerateID(CONF_STATUS_ID): cv.All( + cv.requires_component("network") + ), + } + ) + ) async def to_code(config):