parent
6faf9e8bbe
commit
b51d81edba
|
@ -107,23 +107,11 @@ class TileDeviceTracker(TileEntity, TrackerEntity):
|
||||||
"""Return the source type, eg gps or router, of the device."""
|
"""Return the source type, eg gps or router, of the device."""
|
||||||
return SOURCE_TYPE_GPS
|
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
|
@callback
|
||||||
def _update_from_latest_data(self):
|
def _update_from_latest_data(self):
|
||||||
"""Update the entity from the latest data."""
|
"""Update the entity from the latest data."""
|
||||||
self._tile = self.coordinator.data[self._tile_uuid]
|
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"]
|
||||||
|
|
|
@ -59,7 +59,6 @@ async def test_step_import(hass):
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": SOURCE_IMPORT}, data=conf
|
DOMAIN, context={"source": SOURCE_IMPORT}, data=conf
|
||||||
)
|
)
|
||||||
print(result)
|
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||||
assert result["title"] == "user@host.com"
|
assert result["title"] == "user@host.com"
|
||||||
assert result["data"] == {
|
assert result["data"] == {
|
||||||
|
@ -87,7 +86,6 @@ async def test_step_user(hass):
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": SOURCE_USER}, data=conf
|
DOMAIN, context={"source": SOURCE_USER}, data=conf
|
||||||
)
|
)
|
||||||
print(result)
|
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||||
assert result["title"] == "user@host.com"
|
assert result["title"] == "user@host.com"
|
||||||
assert result["data"] == {
|
assert result["data"] == {
|
||||||
|
|
Loading…
Reference in New Issue