-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from astrandb/Diag
Add support for diagnostics download
- Loading branch information
Showing
5 changed files
with
38 additions
and
3 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
"""Constants for the Weatherlink integration.""" | ||
|
||
DOMAIN = "weatherlink" | ||
VERSION = "0.0.4" | ||
|
||
CONF_API_TOKEN = "conf_api_token" |
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,34 @@ | ||
"""Diagnostics support for Weatherlink.""" | ||
from __future__ import annotations | ||
|
||
from homeassistant.components.diagnostics import async_redact_data | ||
from homeassistant.config_entries import ConfigEntry | ||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator | ||
|
||
from .const import CONF_API_TOKEN, DOMAIN | ||
|
||
TO_REDACT = { | ||
CONF_PASSWORD, | ||
CONF_USERNAME, | ||
CONF_API_TOKEN, | ||
"apitoken", | ||
"DID", | ||
} | ||
|
||
|
||
async def async_get_config_entry_diagnostics( | ||
hass: HomeAssistant, config_entry: ConfigEntry | ||
) -> dict: | ||
"""Return diagnostics for a config entry.""" | ||
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id][ | ||
"coordinator" | ||
] | ||
|
||
diagnostics_data = { | ||
"info": async_redact_data(config_entry.data, TO_REDACT), | ||
"data": async_redact_data(coordinator.data, TO_REDACT), | ||
} | ||
|
||
return diagnostics_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
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