Skip to content

Commit

Permalink
Add basic diagnostics implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
iMicknl committed Jan 7, 2024
1 parent 1e25b45 commit 6de936d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
1 change: 0 additions & 1 deletion custom_components/sagemcom_fast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class HomeAssistantSagemcomFastData:

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Set up Sagemcom from a config entry."""

host = entry.data[CONF_HOST]
username = entry.data[CONF_USERNAME]
password = entry.data[CONF_PASSWORD]
Expand Down
45 changes: 45 additions & 0 deletions custom_components/sagemcom_fast/diagnostics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""Provides diagnostics for Sagemcom F@st."""
from __future__ import annotations

from typing import Any

from homeassistant.components.diagnostics import async_redact_data
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceEntry

# from . import HomeAssistantSagemcomFastData
# from .const import DOMAIN

TO_REDACT = []


async def async_get_config_entry_diagnostics(
hass: HomeAssistant, entry: ConfigEntry
) -> dict[str, Any]:
"""Return diagnostics for a config entry."""
# entry_data: HomeAssistantSagemcomFastData = hass.data[DOMAIN][entry.entry_id]

data = {
"device_info": {},
}

return async_redact_data(data, TO_REDACT)


async def async_get_device_diagnostics(
hass: HomeAssistant, entry: ConfigEntry, device: DeviceEntry
) -> dict[str, Any]:
"""Return diagnostics for a device entry."""
# entry_data: HomeAssistantSagemcomFastData = hass.data[DOMAIN][entry.entry_id]

data = {
"device": {
"controllable_name": device.hw_version,
"firmware": device.sw_version,
"model": device.model,
},
"app_launch": {},
}

return async_redact_data(data, TO_REDACT)

0 comments on commit 6de936d

Please sign in to comment.