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):