From c8a9ad3ee93b84149ce62a87827c2540b5caaffa Mon Sep 17 00:00:00 2001 From: Alex X Date: Thu, 18 Apr 2024 19:13:40 +0300 Subject: [PATCH] Move system log to the first place in the diagnostics --- custom_components/hass_diagnostics/diagnostics.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/custom_components/hass_diagnostics/diagnostics.py b/custom_components/hass_diagnostics/diagnostics.py index fbd87e3..6eec2a5 100644 --- a/custom_components/hass_diagnostics/diagnostics.py +++ b/custom_components/hass_diagnostics/diagnostics.py @@ -11,6 +11,10 @@ async def async_get_config_entry_diagnostics( ): info = {} + # global system_log + if system_log := hass.data[SYSTEM_LOG]: + info[SYSTEM_LOG] = [i.to_dict() for i in system_log.records.values()] + component: EntityComponent = hass.data["entity_components"]["sensor"] for entity in component.entities: if isinstance(entity, SmartLog): @@ -20,8 +24,4 @@ async def async_get_config_entry_diagnostics( if entity.extra_state_attributes: info[SETUP_TIME] = entity.extra_state_attributes[SETUP_TIME] - # global system_log - if system_log := hass.data[SYSTEM_LOG]: - info[SYSTEM_LOG] = [i.to_dict() for i in system_log.records.values()] - return info