mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Add diagnostics platform to Tailwind (#105965)
This commit is contained in:
parent
a2a9a8e231
commit
79aa888ca0
18
homeassistant/components/tailwind/diagnostics.py
Normal file
18
homeassistant/components/tailwind/diagnostics.py
Normal file
@ -0,0 +1,18 @@
|
||||
"""Diagnostics platform for Tailwind."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .const import DOMAIN
|
||||
from .coordinator import TailwindDataUpdateCoordinator
|
||||
|
||||
|
||||
async def async_get_config_entry_diagnostics(
|
||||
hass: HomeAssistant, entry: ConfigEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a config entry."""
|
||||
coordinator: TailwindDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
|
||||
return coordinator.data.to_dict()
|
28
tests/components/tailwind/snapshots/test_diagnostics.ambr
Normal file
28
tests/components/tailwind/snapshots/test_diagnostics.ambr
Normal file
@ -0,0 +1,28 @@
|
||||
# serializer version: 1
|
||||
# name: test_diagnostics
|
||||
dict({
|
||||
'data': dict({
|
||||
'door1': dict({
|
||||
'disabled': 0,
|
||||
'door_id': 'door1',
|
||||
'index': 0,
|
||||
'lockup': 0,
|
||||
'status': 'open',
|
||||
}),
|
||||
'door2': dict({
|
||||
'disabled': 0,
|
||||
'door_id': 'door2',
|
||||
'index': 1,
|
||||
'lockup': 0,
|
||||
'status': 'open',
|
||||
}),
|
||||
}),
|
||||
'dev_id': '_3c_e9_e_6d_21_84_',
|
||||
'door_num': 2,
|
||||
'fw_ver': '10.10',
|
||||
'led_brightness': 100,
|
||||
'night_mode_en': 0,
|
||||
'product': 'iQ3',
|
||||
'proto_ver': '0.1',
|
||||
})
|
||||
# ---
|
22
tests/components/tailwind/test_diagnostics.py
Normal file
22
tests/components/tailwind/test_diagnostics.py
Normal file
@ -0,0 +1,22 @@
|
||||
"""Tests for diagnostics provided by the Tailwind integration."""
|
||||
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test diagnostics."""
|
||||
assert (
|
||||
await get_diagnostics_for_config_entry(hass, hass_client, init_integration)
|
||||
== snapshot
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user