mirror of
https://github.com/home-assistant/core.git
synced 2025-09-10 07:11:37 +02:00
Include device data in Withings diagnostics (#150816)
This commit is contained in:
committed by
GitHub
parent
419315d9cf
commit
2f8ddae24d
@@ -2,16 +2,23 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import asdict
|
||||
from typing import Any
|
||||
|
||||
from yarl import URL
|
||||
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.components.webhook import async_generate_url as webhook_generate_url
|
||||
from homeassistant.const import CONF_WEBHOOK_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import CONF_CLOUDHOOK_URL, WithingsConfigEntry
|
||||
|
||||
TO_REDACT = {
|
||||
"device_id",
|
||||
"hashed_device_id",
|
||||
}
|
||||
|
||||
|
||||
async def async_get_config_entry_diagnostics(
|
||||
hass: HomeAssistant, entry: WithingsConfigEntry
|
||||
@@ -53,4 +60,8 @@ async def async_get_config_entry_diagnostics(
|
||||
"received_sleep_data": withings_data.sleep_coordinator.data is not None,
|
||||
"received_workout_data": withings_data.workout_coordinator.data is not None,
|
||||
"received_activity_data": withings_data.activity_coordinator.data is not None,
|
||||
"devices": async_redact_data(
|
||||
[asdict(v) for v in withings_data.device_coordinator.data.values()],
|
||||
TO_REDACT,
|
||||
),
|
||||
}
|
||||
|
@@ -1,6 +1,18 @@
|
||||
# serializer version: 1
|
||||
# name: test_diagnostics_cloudhook_instance
|
||||
dict({
|
||||
'devices': list([
|
||||
dict({
|
||||
'battery': 'high',
|
||||
'device_id': '**REDACTED**',
|
||||
'device_type': 'Scale',
|
||||
'first_session_date': None,
|
||||
'hashed_device_id': '**REDACTED**',
|
||||
'last_session_date': '2023-09-04T22:39:39+00:00',
|
||||
'model': 5,
|
||||
'raw_model': 'Body+',
|
||||
}),
|
||||
]),
|
||||
'has_cloudhooks': True,
|
||||
'has_valid_external_webhook_url': True,
|
||||
'received_activity_data': False,
|
||||
@@ -64,6 +76,18 @@
|
||||
# ---
|
||||
# name: test_diagnostics_polling_instance
|
||||
dict({
|
||||
'devices': list([
|
||||
dict({
|
||||
'battery': 'high',
|
||||
'device_id': '**REDACTED**',
|
||||
'device_type': 'Scale',
|
||||
'first_session_date': None,
|
||||
'hashed_device_id': '**REDACTED**',
|
||||
'last_session_date': '2023-09-04T22:39:39+00:00',
|
||||
'model': 5,
|
||||
'raw_model': 'Body+',
|
||||
}),
|
||||
]),
|
||||
'has_cloudhooks': False,
|
||||
'has_valid_external_webhook_url': False,
|
||||
'received_activity_data': False,
|
||||
@@ -127,6 +151,18 @@
|
||||
# ---
|
||||
# name: test_diagnostics_webhook_instance
|
||||
dict({
|
||||
'devices': list([
|
||||
dict({
|
||||
'battery': 'high',
|
||||
'device_id': '**REDACTED**',
|
||||
'device_type': 'Scale',
|
||||
'first_session_date': None,
|
||||
'hashed_device_id': '**REDACTED**',
|
||||
'last_session_date': '2023-09-04T22:39:39+00:00',
|
||||
'model': 5,
|
||||
'raw_model': 'Body+',
|
||||
}),
|
||||
]),
|
||||
'has_cloudhooks': False,
|
||||
'has_valid_external_webhook_url': True,
|
||||
'received_activity_data': False,
|
||||
|
Reference in New Issue
Block a user