Remove deprecated MQTT via_hub device option (#185917)

This commit is contained in:
Jan Bouwhuis
2026-10-12 09:52:37 +02:00
committed by GitHub
parent a396bc3a93
commit 6711ad919e
3 changed files with 41 additions and 3 deletions
+2 -1
View File
@@ -131,7 +131,8 @@ def validate_device_has_at_least_one_identifier(value: ConfigType) -> ConfigType
MQTT_ENTITY_DEVICE_INFO_SCHEMA = probatio.All(
cv.deprecated(CONF_DEPRECATED_VIA_HUB, CONF_VIA_DEVICE),
# Remove in HA Core 2027.4, together with CONF_DEPRECATED_VIA_HUB
cv.removed(CONF_DEPRECATED_VIA_HUB, raise_if_present=False),
probatio.Schema(
{
probatio.Optional(CONF_IDENTIFIERS, default=list): probatio.All(
+1 -2
View File
@@ -2574,8 +2574,6 @@ ABBREVIATIONS_WHITE_LIST = [
# MQTT client/server/trigger settings
# Integration info
"CONF_SUPPORT_URL",
# Undocumented device configuration
"CONF_DEPRECATED_VIA_HUB",
"CONF_VIA_DEVICE",
# Already short
"CONF_FAN_MODE_LIST",
@@ -2587,6 +2585,7 @@ ABBREVIATIONS_WHITE_LIST = [
"CONF_SCHEMA",
"CONF_TEMP_STEP",
# Removed
"CONF_DEPRECATED_VIA_HUB",
"CONF_WHITE_VALUE",
# Config entry only settings
"CONF_BROKER",
+38
View File
@@ -1577,6 +1577,44 @@ async def test_entity_device_info_with_identifier(
)
async def test_discovery_with_removed_via_hub_option(
hass: HomeAssistant,
mqtt_mock_entry: MqttMockHAClientGenerator,
device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry,
caplog: pytest.LogCaptureFixture,
) -> None:
"""Test discovery of a sensor with the removed via_hub device option."""
await mqtt_mock_entry()
data = json.dumps(
{
"name": "test",
"state_topic": "test-topic",
"unique_id": "veryunique",
"device": {
"identifiers": ["helloworld"],
"name": "Hello World",
"via_hub": "hub-id",
},
}
)
async_fire_mqtt_message(hass, "homeassistant/sensor/bla/config", data)
await hass.async_block_till_done()
assert entity_registry.async_get_entity_id(sensor.DOMAIN, DOMAIN, "veryunique")
entry_id = hass.config_entries.async_entries(DOMAIN)[0].entry_id
device = device_registry.async_get_device_by_identifier(
(DOMAIN, "helloworld"), entry_id
)
assert device is not None
assert device.via_device_id is None
assert (
device_registry.async_get_device_by_identifier((DOMAIN, "hub-id"), entry_id)
is None
)
assert "The 'via_hub' option has been removed" in caplog.text
async def test_entity_device_info_update(
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
) -> None: