From 30c3d41309388d6d0f3aff3509a68fb0211ee07b Mon Sep 17 00:00:00 2001 From: golles Date: Wed, 9 Nov 2022 16:55:08 +0000 Subject: [PATCH] Add diagnostics option --- .github/ISSUE_TEMPLATE/issue.yaml | 9 ++++++++- custom_components/kamstrup_403/diagnostics.py | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 custom_components/kamstrup_403/diagnostics.py diff --git a/.github/ISSUE_TEMPLATE/issue.yaml b/.github/ISSUE_TEMPLATE/issue.yaml index 5e0f28f..6e04b8c 100644 --- a/.github/ISSUE_TEMPLATE/issue.yaml +++ b/.github/ISSUE_TEMPLATE/issue.yaml @@ -56,9 +56,16 @@ body: id: logs attributes: label: Home Assistant log - description: Paste your full log here. + description: Paste your full log here, [how to enable logs](../blob/main/README.md#collect-logs). render: shell + - type: textarea + id: diagnostics + attributes: + label: Diagnostics + description: Paste your diagnostics content here, [how to get diagnostics](https://www.home-assistant.io/integrations/diagnostics/). + render: json + - type: textarea id: additional-information attributes: diff --git a/custom_components/kamstrup_403/diagnostics.py b/custom_components/kamstrup_403/diagnostics.py new file mode 100644 index 0000000..c6dd9b0 --- /dev/null +++ b/custom_components/kamstrup_403/diagnostics.py @@ -0,0 +1,18 @@ +"""Diagnostics support for kamstrup_403.""" + +from homeassistant.config_entries import ConfigEntry +from homeassistant.core import HomeAssistant + +from . import DOMAIN, KamstrupUpdateCoordinator + + +async def async_get_config_entry_diagnostics( + hass: HomeAssistant, config_entry: ConfigEntry +) -> dict: + """Return diagnostics for a config entry.""" + coordinator: KamstrupUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id] + + return { + "config_entry": config_entry.as_dict(), + "data": coordinator.data, + }