Skip to content

Commit

Permalink
Add Download diagnostics support
Browse files Browse the repository at this point in the history
  • Loading branch information
mletenay committed Oct 25, 2023
1 parent acc4dbc commit fa7ef78
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions custom_components/goodwe/diagnostics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Diagnostics support for Goodwe."""
from __future__ import annotations

from dataclasses import asdict
from typing import Any

from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant

from . import GoodweUpdateCoordinator
from .const import DOMAIN, KEY_DEVICE_INFO, KEY_INVERTER


async def async_get_config_entry_diagnostics(
hass: HomeAssistant, config_entry: ConfigEntry
) -> dict[str, Any]:
"""Return diagnostics for a config entry."""
inverter = hass.data[DOMAIN][config_entry.entry_id][KEY_INVERTER]
device_info = hass.data[DOMAIN][config_entry.entry_id][KEY_DEVICE_INFO]

diagnostics_data = {
"config_entry": config_entry.as_dict(),
"inverter": {
"model_name": inverter.model_name,
"firmware": inverter.firmware,
"arm_firmware": inverter.arm_firmware,
"dsp1_version": inverter.dsp1_version,
"dsp2_version": inverter.dsp2_version,
"dsp_svn_version": inverter.dsp_svn_version,
"arm_version": inverter.arm_version,
"arm_svn_version": inverter.arm_svn_version,
},
}

return diagnostics_data

0 comments on commit fa7ef78

Please sign in to comment.