Add diagnostics to Launch Library (#64871)

This commit is contained in:
Joakim Sørensen 2022-01-24 22:59:29 +01:00 committed by GitHub
parent 2caad1a474
commit 70b24b7843
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 3 deletions

View File

@ -584,6 +584,7 @@ omit =
homeassistant/components/lastfm/sensor.py
homeassistant/components/launch_library/__init__.py
homeassistant/components/launch_library/const.py
homeassistant/components/launch_library/diagnostics.py
homeassistant/components/launch_library/sensor.py
homeassistant/components/lcn/binary_sensor.py
homeassistant/components/lcn/climate.py

View File

@ -0,0 +1,24 @@
"""Diagnostics support for Launch Library."""
from __future__ import annotations
from typing import Any
from pylaunches.objects.launch import Launch
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from .const import DOMAIN
async def async_get_config_entry_diagnostics(
hass: HomeAssistant,
entry: ConfigEntry,
) -> dict[str, Any]:
"""Return diagnostics for a config entry."""
coordinator: DataUpdateCoordinator[list[Launch]] = hass.data[DOMAIN]
next_launch = coordinator.data[0] if coordinator.data else None
return {
"next_launch": next_launch.raw_data_contents if next_launch else None,
}

View File

@ -3,7 +3,7 @@
"name": "Launch Library",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/launch_library",
"requirements": ["pylaunches==1.2.1"],
"requirements": ["pylaunches==1.2.2"],
"codeowners": ["@ludeeus", "@DurgNomis-drol"],
"iot_class": "cloud_polling"
}

View File

@ -1633,7 +1633,7 @@ pylacrosse==0.4
pylast==4.2.1
# homeassistant.components.launch_library
pylaunches==1.2.1
pylaunches==1.2.2
# homeassistant.components.lg_netcast
pylgnetcast==0.3.7

View File

@ -1020,7 +1020,7 @@ pykulersky==0.5.2
pylast==4.2.1
# homeassistant.components.launch_library
pylaunches==1.2.1
pylaunches==1.2.2
# homeassistant.components.forked_daapd
pylibrespot-java==0.1.0