diff --git a/Makefile b/Makefile index da1ba7d..40ae30b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -__VERSION__ = "0.0.1" +__VERSION__ = "0.0.4" bump: bump2version --allow-dirty --current-version $(__VERSION__) patch Makefile custom_components/weatherlink/const.py custom_components/weatherlink/manifest.json diff --git a/custom_components/weatherlink/const.py b/custom_components/weatherlink/const.py index b5d7d70..6cb6a23 100644 --- a/custom_components/weatherlink/const.py +++ b/custom_components/weatherlink/const.py @@ -1,5 +1,6 @@ """Constants for the Weatherlink integration.""" DOMAIN = "weatherlink" +VERSION = "0.0.4" CONF_API_TOKEN = "conf_api_token" diff --git a/custom_components/weatherlink/diagnostics.py b/custom_components/weatherlink/diagnostics.py new file mode 100644 index 0000000..248da71 --- /dev/null +++ b/custom_components/weatherlink/diagnostics.py @@ -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 diff --git a/custom_components/weatherlink/manifest.json b/custom_components/weatherlink/manifest.json index a8324c8..9289bac 100644 --- a/custom_components/weatherlink/manifest.json +++ b/custom_components/weatherlink/manifest.json @@ -8,7 +8,7 @@ "zeroconf": [], "homekit": {}, "dependencies": [], - "version": "0.0.1", + "version": "0.0.4", "codeowners": [ "@strandb" ], diff --git a/setup.cfg b/setup.cfg index 18a24e3..3de33d9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.0.1 +current_version = 0.0.4 [flake8] exclude = .venv,.git,.tox,docs,venv,bin,lib,deps,build