Remove useless check in launch_library (#54393)
This commit is contained in:
parent
1d40a6e407
commit
8ea5a0dbc1
1 changed files with 8 additions and 12 deletions
|
@ -57,17 +57,13 @@ class LaunchLibrarySensor(SensorEntity):
|
||||||
_LOGGER.error("Error getting data, %s", exception)
|
_LOGGER.error("Error getting data, %s", exception)
|
||||||
self._attr_available = False
|
self._attr_available = False
|
||||||
else:
|
else:
|
||||||
if launches and (
|
if next_launch := next((launch for launch in launches), None):
|
||||||
next_launch := next((launch for launch in launches), None)
|
|
||||||
):
|
|
||||||
self._attr_available = True
|
self._attr_available = True
|
||||||
self._attr_state = next_launch.name
|
self._attr_state = next_launch.name
|
||||||
self._attr_extra_state_attributes.update(
|
self._attr_extra_state_attributes = {
|
||||||
{
|
|
||||||
ATTR_LAUNCH_TIME: next_launch.net,
|
ATTR_LAUNCH_TIME: next_launch.net,
|
||||||
ATTR_AGENCY: next_launch.launch_service_provider.name,
|
ATTR_AGENCY: next_launch.launch_service_provider.name,
|
||||||
ATTR_AGENCY_COUNTRY_CODE: next_launch.pad.location.country_code,
|
ATTR_AGENCY_COUNTRY_CODE: next_launch.pad.location.country_code,
|
||||||
ATTR_STREAM: next_launch.webcast_live,
|
ATTR_STREAM: next_launch.webcast_live,
|
||||||
ATTR_ATTRIBUTION: ATTRIBUTION,
|
ATTR_ATTRIBUTION: ATTRIBUTION,
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue