mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
Improve enphase_envoy diagnostics error handling to retain collected data (#142255)
Improve enphase_envoy Diagnostics error handling to retain collected data
This commit is contained in:
parent
ae0f27c42f
commit
6da37691ff
@ -66,6 +66,7 @@ async def _get_fixture_collection(envoy: Envoy, serial: str) -> dict[str, Any]:
|
||||
]
|
||||
|
||||
for end_point in end_points:
|
||||
try:
|
||||
response = await envoy.request(end_point)
|
||||
fixture_data[end_point] = response.text.replace("\n", "").replace(
|
||||
serial, CLEAN_TEXT
|
||||
@ -76,6 +77,8 @@ async def _get_fixture_collection(envoy: Envoy, serial: str) -> dict[str, Any]:
|
||||
"code": response.status_code,
|
||||
}
|
||||
)
|
||||
except EnvoyError as err:
|
||||
fixture_data[f"{end_point}_log"] = {"Error": repr(err)}
|
||||
return fixture_data
|
||||
|
||||
|
||||
@ -160,10 +163,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
fixture_data: dict[str, Any] = {}
|
||||
if entry.options.get(OPTION_DIAGNOSTICS_INCLUDE_FIXTURES, False):
|
||||
try:
|
||||
fixture_data = await _get_fixture_collection(envoy=envoy, serial=old_serial)
|
||||
except EnvoyError as err:
|
||||
fixture_data["Error"] = repr(err)
|
||||
|
||||
diagnostic_data: dict[str, Any] = {
|
||||
"config_entry": async_redact_data(entry.as_dict(), TO_REDACT),
|
||||
|
@ -1373,8 +1373,67 @@
|
||||
]),
|
||||
}),
|
||||
'fixtures': dict({
|
||||
'/admin/lib/tariff_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/api/v1/production/inverters_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/api/v1/production_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/info_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/ivp/ensemble/dry_contacts_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/ivp/ensemble/generator_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/ivp/ensemble/inventory_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/ivp/ensemble/power_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/ivp/ensemble/secctrl_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/ivp/ensemble/status_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/ivp/meters/readings_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/ivp/meters_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/ivp/sc/pvlimit_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/ivp/ss/dry_contact_settings_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/ivp/ss/gen_config_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/ivp/ss/gen_schedule_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/ivp/ss/pel_settings_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/production.json?details=1_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/production.json_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
'/production_log': dict({
|
||||
'Error': "EnvoyError('Test')",
|
||||
}),
|
||||
}),
|
||||
'raw_data': dict({
|
||||
'varies_by': 'firmware_version',
|
||||
}),
|
||||
|
Loading…
x
Reference in New Issue
Block a user