Add launch mission sensor for launch_library (#64387)
This commit is contained in:
parent
2f5f6cc05e
commit
6fcf643d5d
2 changed files with 19 additions and 0 deletions
|
@ -29,17 +29,21 @@ from homeassistant.helpers.update_coordinator import (
|
|||
from homeassistant.util.dt import parse_datetime
|
||||
|
||||
from .const import (
|
||||
ATTR_DESCRIPTION,
|
||||
ATTR_LAUNCH_FACILITY,
|
||||
ATTR_LAUNCH_PAD,
|
||||
ATTR_LAUNCH_PAD_COUNTRY_CODE,
|
||||
ATTR_LAUNCH_PROVIDER,
|
||||
ATTR_ORBIT,
|
||||
ATTR_REASON,
|
||||
ATTR_STREAM_LIVE,
|
||||
ATTR_TYPE,
|
||||
ATTR_WINDOW_END,
|
||||
ATTR_WINDOW_START,
|
||||
ATTRIBUTION,
|
||||
DEFAULT_NAME,
|
||||
DOMAIN,
|
||||
LAUNCH_MISSION,
|
||||
LAUNCH_PROBABILITY,
|
||||
LAUNCH_STATUS,
|
||||
LAUNCH_TIME,
|
||||
|
@ -115,6 +119,17 @@ SENSOR_DESCRIPTIONS: tuple[NextLaunchSensorEntityDescription, ...] = (
|
|||
if next_launch.inhold
|
||||
else None,
|
||||
),
|
||||
NextLaunchSensorEntityDescription(
|
||||
key=LAUNCH_MISSION,
|
||||
icon="mdi:orbit",
|
||||
name="Launch mission",
|
||||
value_fn=lambda next_launch: next_launch.mission.name,
|
||||
attributes_fn=lambda next_launch: {
|
||||
ATTR_TYPE: next_launch.mission.type,
|
||||
ATTR_ORBIT: next_launch.mission.orbit.name,
|
||||
ATTR_DESCRIPTION: next_launch.mission.description,
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue