diff --git a/homeassistant/components/launch_library/const.py b/homeassistant/components/launch_library/const.py index db8927bb978..e4f3a5199b6 100644 --- a/homeassistant/components/launch_library/const.py +++ b/homeassistant/components/launch_library/const.py @@ -2,12 +2,15 @@ DOMAIN = "launch_library" +ATTR_DESCRIPTION = "description" ATTR_LAUNCH_FACILITY = "facility" ATTR_LAUNCH_PAD = "pad" ATTR_LAUNCH_PAD_COUNTRY_CODE = "provider_country_code" ATTR_LAUNCH_PROVIDER = "provider" +ATTR_ORBIT = "target_orbit" ATTR_REASON = "reason" ATTR_STREAM_LIVE = "stream_live" +ATTR_TYPE = "mission_type" ATTR_WINDOW_END = "window_end" ATTR_WINDOW_START = "window_start" @@ -19,3 +22,4 @@ NEXT_LAUNCH = "next_launch" LAUNCH_TIME = "launch_time" LAUNCH_PROBABILITY = "launch_probability" LAUNCH_STATUS = "launch_status" +LAUNCH_MISSION = "launch_mission" diff --git a/homeassistant/components/launch_library/sensor.py b/homeassistant/components/launch_library/sensor.py index ee982fe5b21..1557db6bc0d 100644 --- a/homeassistant/components/launch_library/sensor.py +++ b/homeassistant/components/launch_library/sensor.py @@ -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, + }, + ), )