1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-26 22:18:40 +00:00
This commit is contained in:
Paulus Schoutsen
2019-07-31 12:25:30 -07:00
parent da05dfe708
commit 4de97abc3a
2676 changed files with 163166 additions and 140084 deletions

View File

@@ -13,11 +13,7 @@ from homeassistant.const import (
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_component import EntityComponent
from .const import (
ATTR_SOURCE_TYPE,
DOMAIN,
LOGGER,
)
from .const import ATTR_SOURCE_TYPE, DOMAIN, LOGGER
async def async_setup_entry(hass, entry):
@@ -25,9 +21,7 @@ async def async_setup_entry(hass, entry):
component = hass.data.get(DOMAIN) # type: Optional[EntityComponent]
if component is None:
component = hass.data[DOMAIN] = EntityComponent(
LOGGER, DOMAIN, hass
)
component = hass.data[DOMAIN] = EntityComponent(LOGGER, DOMAIN, hass)
return await component.async_setup_entry(entry)
@@ -56,9 +50,7 @@ class BaseTrackerEntity(Entity):
@property
def state_attributes(self):
"""Return the device state attributes."""
attr = {
ATTR_SOURCE_TYPE: self.source_type
}
attr = {ATTR_SOURCE_TYPE: self.source_type}
if self.battery_level:
attr[ATTR_BATTERY_LEVEL] = self.battery_level
@@ -100,8 +92,8 @@ class TrackerEntity(BaseTrackerEntity):
if self.latitude is not None:
zone_state = zone.async_active_zone(
self.hass, self.latitude, self.longitude,
self.location_accuracy)
self.hass, self.latitude, self.longitude, self.location_accuracy
)
if zone_state is None:
state = STATE_NOT_HOME
elif zone_state.entity_id == zone.ENTITY_ID_HOME: