diff --git a/homeassistant/components/shelly/sensor.py b/homeassistant/components/shelly/sensor.py index 7ae709ae84f..57e60c8fc48 100644 --- a/homeassistant/components/shelly/sensor.py +++ b/homeassistant/components/shelly/sensor.py @@ -907,6 +907,9 @@ RPC_SENSORS: Final = { device_class=SensorDeviceClass.SIGNAL_STRENGTH, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, + removal_condition=lambda config, _status, key: ( + config[key]["sta"]["enable"] is False + ), entity_category=EntityCategory.DIAGNOSTIC, use_polling_coordinator=True, ), diff --git a/tests/components/shelly/conftest.py b/tests/components/shelly/conftest.py index af373f33c23..9d7bb9404f8 100644 --- a/tests/components/shelly/conftest.py +++ b/tests/components/shelly/conftest.py @@ -159,6 +159,7 @@ MOCK_CONFIG = { "ui_data": {}, "device": {"name": "Test name"}, }, + "wifi": {"sta": {"enable": True}}, } MOCK_SHELLY_COAP = {