Remove Shelly RSSI sensor if Wi-FI is not configured (#108390)

* Remove Shelly RSSI sensor if Wi-FI is not configured

* fix tests
This commit is contained in:
Simone Chemelli 2024-01-30 21:18:54 +01:00 committed by GitHub
parent 7fbfd44636
commit 6174aa4e59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View File

@ -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,
),

View File

@ -159,6 +159,7 @@ MOCK_CONFIG = {
"ui_data": {},
"device": {"name": "Test name"},
},
"wifi": {"sta": {"enable": True}},
}
MOCK_SHELLY_COAP = {