hass-core/homeassistant/components/goodwe/diagnostics.py
Sid 0d66d298ec
Enable Ruff RET504 (#114528)
* Enable Ruff RET504

* fix test

* Use noqa instead of cast

* fix sonos RET504

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-06 11:07:37 +02:00

34 lines
1 KiB
Python

"""Diagnostics support for Goodwe."""
from __future__ import annotations
from typing import Any
from goodwe import Inverter
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from .const import DOMAIN, KEY_INVERTER
async def async_get_config_entry_diagnostics(
hass: HomeAssistant, config_entry: ConfigEntry
) -> dict[str, Any]:
"""Return diagnostics for a config entry."""
inverter: Inverter = hass.data[DOMAIN][config_entry.entry_id][KEY_INVERTER]
return {
"config_entry": config_entry.as_dict(),
"inverter": {
"model_name": inverter.model_name,
"rated_power": inverter.rated_power,
"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,
},
}