Black
This commit is contained in:
1 parent
da05dfe708
commit
4de97abc3a
2676 files changed
+163166
-140084
No files matched your search
@@ -14,17 +14,16 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
ATTRIBUTION = "Data provided by Launch Library."
|
||||
|
||||
DEFAULT_NAME = 'Next launch'
|
||||
DEFAULT_NAME = "Next launch"
|
||||
|
||||
SCAN_INTERVAL = timedelta(hours=1)
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
||||
})
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
{vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string}
|
||||
)
|
||||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass, config, async_add_entities, discovery_info=None):
|
||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
||||
"""Create the launch sensor."""
|
||||
from pylaunches.api import Launches
|
||||
|
||||
@@ -54,12 +53,12 @@ class LaunchLibrarySensor(Entity):
|
||||
return
|
||||
try:
|
||||
data = self.launches.launches[0]
|
||||
self._state = data['name']
|
||||
self._attributes['launch_time'] = data['start']
|
||||
self._attributes['agency'] = data['agency']
|
||||
agency_country_code = data['agency_country_code']
|
||||
self._attributes['agency_country_code'] = agency_country_code
|
||||
self._attributes['stream'] = data['stream']
|
||||
self._state = data["name"]
|
||||
self._attributes["launch_time"] = data["start"]
|
||||
self._attributes["agency"] = data["agency"]
|
||||
agency_country_code = data["agency_country_code"]
|
||||
self._attributes["agency_country_code"] = agency_country_code
|
||||
self._attributes["stream"] = data["stream"]
|
||||
self._attributes[ATTR_ATTRIBUTION] = ATTRIBUTION
|
||||
except (KeyError, IndexError) as error:
|
||||
_LOGGER.debug("Error getting data, %s", error)
|
||||
@@ -77,7 +76,7 @@ class LaunchLibrarySensor(Entity):
|
||||
@property
|
||||
def icon(self):
|
||||
"""Return the icon of the sensor."""
|
||||
return 'mdi:rocket'
|
||||
return "mdi:rocket"
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
|
||||
Reference in new issue
Block a user