-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced diagnostics download feature
- Loading branch information
1 parent
de615df
commit 6b1ad5e
Showing
3 changed files
with
41 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""Diagnostics support for Daikin Diagnostics.""" | ||
from __future__ import annotations | ||
from typing import Any | ||
|
||
from homeassistant.config_entries import ConfigEntry | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers.device_registry import DeviceEntry | ||
|
||
from .const import DOMAIN, DAIKIN_API, DAIKIN_DEVICES | ||
|
||
|
||
async def async_get_config_entry_diagnostics( | ||
hass: HomeAssistant, entry: ConfigEntry | ||
) -> dict[str, Any]: | ||
"""Return diagnostics for a config entry.""" | ||
data = {} | ||
daikin_api = hass.data[DOMAIN][DAIKIN_API] | ||
data["tokenset"] = {**entry.data} | ||
data["json_data"] = daikin_api.json_data | ||
return data | ||
|
||
|
||
async def async_get_device_diagnostics( | ||
hass: HomeAssistant, entry: ConfigEntry, device: DeviceEntry | ||
) -> dict[str, Any]: | ||
"""Return diagnostics for a device entry.""" | ||
data = {} | ||
dev_id = next(iter(device.identifiers))[1] | ||
daikin_device = hass.data[DOMAIN][DAIKIN_DEVICES][dev_id] | ||
data["device"] = device | ||
data["device_json_data"] = daikin_device.getDescription() | ||
return data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters