mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Add launch status sensor for launch_library (#64382)
This commit is contained in:
parent
13fe5d8216
commit
57bcddbba2
@ -3,12 +3,13 @@
|
||||
DOMAIN = "launch_library"
|
||||
|
||||
ATTR_LAUNCH_FACILITY = "facility"
|
||||
ATTR_STREAM_LIVE = "stream_live"
|
||||
ATTR_LAUNCH_PAD = "pad"
|
||||
ATTR_LAUNCH_PAD_COUNTRY_CODE = "provider_country_code"
|
||||
ATTR_LAUNCH_PROVIDER = "provider"
|
||||
ATTR_WINDOW_START = "window_start"
|
||||
ATTR_REASON = "reason"
|
||||
ATTR_STREAM_LIVE = "stream_live"
|
||||
ATTR_WINDOW_END = "window_end"
|
||||
ATTR_WINDOW_START = "window_start"
|
||||
|
||||
ATTRIBUTION = "Data provided by Launch Library."
|
||||
|
||||
@ -17,3 +18,4 @@ DEFAULT_NAME = "Next launch"
|
||||
NEXT_LAUNCH = "next_launch"
|
||||
LAUNCH_TIME = "launch_time"
|
||||
LAUNCH_PROBABILITY = "launch_probability"
|
||||
LAUNCH_STATUS = "launch_status"
|
||||
|
@ -33,6 +33,7 @@ from .const import (
|
||||
ATTR_LAUNCH_PAD,
|
||||
ATTR_LAUNCH_PAD_COUNTRY_CODE,
|
||||
ATTR_LAUNCH_PROVIDER,
|
||||
ATTR_REASON,
|
||||
ATTR_STREAM_LIVE,
|
||||
ATTR_WINDOW_END,
|
||||
ATTR_WINDOW_START,
|
||||
@ -40,6 +41,7 @@ from .const import (
|
||||
DEFAULT_NAME,
|
||||
DOMAIN,
|
||||
LAUNCH_PROBABILITY,
|
||||
LAUNCH_STATUS,
|
||||
LAUNCH_TIME,
|
||||
NEXT_LAUNCH,
|
||||
)
|
||||
@ -102,6 +104,17 @@ SENSOR_DESCRIPTIONS: tuple[NextLaunchSensorEntityDescription, ...] = (
|
||||
else STATE_UNKNOWN,
|
||||
attributes_fn=lambda next_launch: None,
|
||||
),
|
||||
NextLaunchSensorEntityDescription(
|
||||
key=LAUNCH_STATUS,
|
||||
icon="mdi:rocket-launch",
|
||||
name="Launch status",
|
||||
value_fn=lambda next_launch: next_launch.status.name,
|
||||
attributes_fn=lambda next_launch: {
|
||||
ATTR_REASON: next_launch.holdreason,
|
||||
}
|
||||
if next_launch.inhold
|
||||
else None,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user