1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Add KNX UI entity config to diagnostics (#151620)

This commit is contained in:
Matthias Alphart
2025-09-12 15:41:17 +02:00
committed by GitHub
parent 84140ba414
commit cc64fa639d
3 changed files with 69 additions and 7 deletions

View File

@@ -52,8 +52,10 @@ async def async_get_config_entry_diagnostics(
try:
CONFIG_SCHEMA(raw_config)
except vol.Invalid as ex:
diag["configuration_error"] = str(ex)
diag["yaml_configuration_error"] = str(ex)
else:
diag["configuration_error"] = None
diag["yaml_configuration_error"] = None
diag["config_store"] = knx_module.config_store.data
return diag

View File

@@ -9,7 +9,10 @@
'rate_limit': 0,
'state_updater': True,
}),
'configuration_error': "extra keys not allowed @ data['knx']['wrong_key']",
'config_store': dict({
'entities': dict({
}),
}),
'configuration_yaml': dict({
'wrong_key': dict({
}),
@@ -19,6 +22,7 @@
'current_address': '0.0.0',
'version': '0.0.0',
}),
'yaml_configuration_error': "extra keys not allowed @ data['knx']['wrong_key']",
})
# ---
# name: test_diagnostic_redact[hass_config0]
@@ -35,13 +39,17 @@
'state_updater': True,
'user_password': '**REDACTED**',
}),
'configuration_error': None,
'config_store': dict({
'entities': dict({
}),
}),
'configuration_yaml': None,
'project_info': None,
'xknx': dict({
'current_address': '0.0.0',
'version': '0.0.0',
}),
'yaml_configuration_error': None,
})
# ---
# name: test_diagnostics[hass_config0]
@@ -54,13 +62,17 @@
'rate_limit': 0,
'state_updater': True,
}),
'configuration_error': None,
'config_store': dict({
'entities': dict({
}),
}),
'configuration_yaml': None,
'project_info': None,
'xknx': dict({
'current_address': '0.0.0',
'version': '0.0.0',
}),
'yaml_configuration_error': None,
})
# ---
# name: test_diagnostics_project[hass_config0]
@@ -73,7 +85,50 @@
'rate_limit': 0,
'state_updater': True,
}),
'configuration_error': None,
'config_store': dict({
'entities': dict({
'light': dict({
'knx_es_01J85ZKTFHSZNG4X9DYBE592TF': dict({
'entity': dict({
'device_info': None,
'entity_category': 'config',
'name': 'test',
}),
'knx': dict({
'color_temp_max': 6000,
'color_temp_min': 2700,
'ga_switch': dict({
'passive': list([
]),
'state': '1/0/21',
'write': '1/1/21',
}),
'sync_state': True,
}),
}),
}),
'switch': dict({
'knx_es_9d97829f47f1a2a3176a7c5b4216070c': dict({
'entity': dict({
'device_info': 'knx_vdev_4c80a564f5fe5da701ed293966d6384d',
'entity_category': None,
'name': 'test',
}),
'knx': dict({
'ga_switch': dict({
'passive': list([
]),
'state': '1/0/45',
'write': '1/1/45',
}),
'invert': False,
'respond_to_read': False,
'sync_state': True,
}),
}),
}),
}),
}),
'configuration_yaml': None,
'project_info': dict({
'created_by': 'ETS5',
@@ -91,5 +146,6 @@
'current_address': '0.0.0',
'version': '0.0.0',
}),
'yaml_configuration_error': None,
})
# ---

View File

@@ -120,9 +120,13 @@ async def test_diagnostics_project(
snapshot: SnapshotAssertion,
) -> None:
"""Test diagnostics."""
await knx.setup_integration()
await knx.setup_integration(
config_store_fixture="config_store_light_switch.json",
state_updater=False,
)
knx.xknx.version = "0.0.0"
# snapshot will contain project specific fields in `project_info`
# and UI configuration in `config_store`
assert (
await get_diagnostics_for_config_entry(hass, hass_client, mock_config_entry)
== snapshot