From 2b89054aa3a86b4c635cb7a975b1eccd62eb19b7 Mon Sep 17 00:00:00 2001 From: Mick Vleeshouwer Date: Sun, 7 Jan 2024 23:06:14 +0100 Subject: [PATCH] Add diagnostics (#92) * Add new devices * Add diagnostics log --- README.md | 14 +++++--- .../sagemcom_fast/diagnostics.py | 33 +++++++++++++++++++ 2 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 custom_components/sagemcom_fast/diagnostics.py diff --git a/README.md b/README.md index 94b18df..aa0048c 100644 --- a/README.md +++ b/README.md @@ -41,25 +41,31 @@ The encryption method differs per device. Please refer to the table below to und ## Supported devices -Have a look at the table below for more information about supported devices. +Have a look at the table below for more information about supported devices. The Sagemcom F@st series is used by multiple cable companies, where some cable companies did rebrand the router. Examples are the b-box from Proximus, Home Hub from bell and the Smart Hub from BT. | Router Model | Provider(s) | Authentication Method | Comments | | --------------------- | -------------------- | --------------------- | ----------------------------- | | Sagemcom F@st 3864 | Optus | sha512 | username: guest, password: "" | | Sagemcom F@st 3865b | Proximus (b-box3) | md5 | | -| Sagemcom F@st 3890V3 | Delta / Zeelandnet | md5 | | +| Sagemcom F@st 3890V3 | Delta / Zeelandnet | sha512 | | +| Sagemcom F@st 3896 | | sha512 | username: admin | | Sagemcom F@st 4360Air | KPN | md5 | | +| Sagemcom F@st 4353 | Belong Gateway | md5 | username: admin, password: "" | | Sagemcom F@st 5250 | Bell (Home Hub 2000) | md5 | username: guest, password: "" | | Sagemcom F@st 5280 | | sha512 | | +| Sagemcom F@st 5359 | KPN (Box 12) | sha512 | username: admin | | Sagemcom F@st 5364 | BT (Smart Hub) | md5 | username: guest, password: "" | | SagemCom F@st 5366SD | Eir F3000 | md5 | | | Sagemcom F@st 5370e | Telia | sha512 | | +| Sagemcom F@st 5380 | TDC | md5 | | | Sagemcom F@st 5566 | Bell (Home Hub 3000) | md5 | username: guest, password: "" | +| Sagemcom F@st 5688T | Salt (FibreBox_X6) | sha512 | username: admin | +| Sagemcom F@st 5689 | Bell (Home Hub 4000) | md5 | username: admin, password: "" | | Sagemcom F@st 5655V2 | MásMóvil | md5 | | -| Sagemcom F@st 5657 | | md5 | | +| Sagemcom F@st 5657IL | | md5 | | | Speedport Pro | Telekom | md5 | username: admin | -> Contributions welcome. If you router model is supported by this package, but not in the list above, please create [an issue](https://github.com/iMicknl/ha-sagemcom-fast/issues/new) or pull request. +> Contributions welcome. If you router model is supported by this package, but not in the list above, please create [an issue](https://github.com/iMicknl/ha-sagemcom-fast/issues/new) or directly pull request. ## Advanced diff --git a/custom_components/sagemcom_fast/diagnostics.py b/custom_components/sagemcom_fast/diagnostics.py new file mode 100644 index 0000000..83a2e5d --- /dev/null +++ b/custom_components/sagemcom_fast/diagnostics.py @@ -0,0 +1,33 @@ +"""Provides diagnostics for Overkiz.""" +from __future__ import annotations + +from typing import Any + +from homeassistant.config_entries import ConfigEntry +from homeassistant.core import HomeAssistant + +from . import HomeAssistantSagemcomFastData +from .const import DOMAIN, LOGGER + + +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] + client = entry_data.coordinator.client + + full_dump = None + try: + await client.login() + full_dump = await client.get_value_by_xpath("*") + except Exception as exception: # pylint: disable=broad-except + LOGGER.exception(exception) + + return False + finally: + await client.logout() + + data = {"raw": full_dump} + + return data