Clean up Tile refactor (#36450)

* Clean up Tile refactor

* Code review
pull/36493/head
Aaron Bach 2020-06-05 13:12:48 -06:00 committed by GitHub
parent 6faf9e8bbe
commit b51d81edba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 18 deletions

View File

@ -107,23 +107,11 @@ class TileDeviceTracker(TileEntity, TrackerEntity):
"""Return the source type, eg gps or router, of the device."""
return SOURCE_TYPE_GPS
@property
def state_attributes(self):
"""Return the device state attributes."""
attr = {}
attr.update(
super().state_attributes,
**{
ATTR_ALTITUDE: self._tile["last_tile_state"]["altitude"],
ATTR_IS_LOST: self._tile["last_tile_state"]["is_lost"],
ATTR_RING_STATE: self._tile["last_tile_state"]["ring_state"],
ATTR_VOIP_STATE: self._tile["last_tile_state"]["voip_state"],
},
)
return attr
@callback
def _update_from_latest_data(self):
"""Update the entity from the latest data."""
self._tile = self.coordinator.data[self._tile_uuid]
self._attrs[ATTR_ALTITUDE] = self._tile["last_tile_state"]["altitude"]
self._attrs[ATTR_IS_LOST] = self._tile["last_tile_state"]["is_lost"]
self._attrs[ATTR_RING_STATE] = self._tile["last_tile_state"]["ring_state"]
self._attrs[ATTR_VOIP_STATE] = self._tile["last_tile_state"]["voip_state"]

View File

@ -59,7 +59,6 @@ async def test_step_import(hass):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_IMPORT}, data=conf
)
print(result)
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["title"] == "user@host.com"
assert result["data"] == {
@ -87,7 +86,6 @@ async def test_step_user(hass):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}, data=conf
)
print(result)
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["title"] == "user@host.com"
assert result["data"] == {