Add device info to samsungtv diagnostics (#66728)
* Add device-info to samsungtv diagnostics * Adjust tests Co-authored-by: epenet <epenet@users.noreply.github.com>pull/66736/head
parent
72fad87aef
commit
a9aefb66b5
|
@ -1,18 +1,27 @@
|
|||
"""Diagnostics support for SamsungTV."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_TOKEN
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .bridge import SamsungTVLegacyBridge, SamsungTVWSBridge
|
||||
from .const import DOMAIN
|
||||
|
||||
TO_REDACT = {CONF_TOKEN}
|
||||
|
||||
|
||||
async def async_get_config_entry_diagnostics(
|
||||
hass: HomeAssistant, entry: ConfigEntry
|
||||
) -> dict:
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a config entry."""
|
||||
diag_data = {"entry": async_redact_data(entry.as_dict(), TO_REDACT)}
|
||||
|
||||
return diag_data
|
||||
bridge: SamsungTVLegacyBridge | SamsungTVWSBridge = hass.data[DOMAIN][
|
||||
entry.entry_id
|
||||
]
|
||||
return {
|
||||
"entry": async_redact_data(entry.as_dict(), TO_REDACT),
|
||||
"device_info": await hass.async_add_executor_job(bridge.device_info),
|
||||
}
|
||||
|
|
|
@ -55,5 +55,15 @@ async def test_entry_diagnostics(
|
|||
"title": "Mock Title",
|
||||
"unique_id": "any",
|
||||
"version": 2,
|
||||
}
|
||||
},
|
||||
"device_info": {
|
||||
"id": "uuid:be9554b9-c9fb-41f4-8920-22da015376a4",
|
||||
"device": {
|
||||
"modelName": "82GXARRS",
|
||||
"name": "[TV] Living Room",
|
||||
"networkType": "wireless",
|
||||
"type": "Samsung SmartTV",
|
||||
"wifiMac": "aa:bb:cc:dd:ee:ff",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue