From 8ea5a0dbc194d5a7e7f09f7df2eee5c5871e434c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Tue, 10 Aug 2021 15:03:12 +0200 Subject: [PATCH] Remove useless check in launch_library (#54393) --- .../components/launch_library/sensor.py | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/launch_library/sensor.py b/homeassistant/components/launch_library/sensor.py index 1d2f8ef0577..68d2a024bca 100644 --- a/homeassistant/components/launch_library/sensor.py +++ b/homeassistant/components/launch_library/sensor.py @@ -57,17 +57,13 @@ class LaunchLibrarySensor(SensorEntity): _LOGGER.error("Error getting data, %s", exception) self._attr_available = False else: - if launches and ( - next_launch := next((launch for launch in launches), None) - ): + if next_launch := next((launch for launch in launches), None): self._attr_available = True self._attr_state = next_launch.name - self._attr_extra_state_attributes.update( - { - ATTR_LAUNCH_TIME: next_launch.net, - ATTR_AGENCY: next_launch.launch_service_provider.name, - ATTR_AGENCY_COUNTRY_CODE: next_launch.pad.location.country_code, - ATTR_STREAM: next_launch.webcast_live, - ATTR_ATTRIBUTION: ATTRIBUTION, - } - ) + self._attr_extra_state_attributes = { + ATTR_LAUNCH_TIME: next_launch.net, + ATTR_AGENCY: next_launch.launch_service_provider.name, + ATTR_AGENCY_COUNTRY_CODE: next_launch.pad.location.country_code, + ATTR_STREAM: next_launch.webcast_live, + ATTR_ATTRIBUTION: ATTRIBUTION, + }