Skip to content

Commit

Permalink
Update device tracker entity name
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Two committed Jul 8, 2023
1 parent 2a437f2 commit 16fc51a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion custom_components/subaru/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SubaruDeviceTracker(

_attr_icon = "mdi:car"
_attr_has_entity_name = True
name = "Location"
name = None

def __init__(self, vehicle_info: dict, coordinator: DataUpdateCoordinator) -> None:
"""Initialize the device tracker."""
Expand Down
2 changes: 1 addition & 1 deletion custom_components/subaru/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/G-Two/homeassistant-subaru/issues",
"requirements": ["subarulink==0.7.6"],
"version": "0.7.8"
"version": "0.7.9"
}
22 changes: 22 additions & 0 deletions tests/test_device_tracker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Test Subaru device tracker."""
from subarulink.const import LATITUDE, LONGITUDE

from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er

from .api_responses import EXPECTED_STATE_EV_IMPERIAL

DEVICE_ID = "device_tracker.test_vehicle_2"


async def test_location(hass: HomeAssistant, ev_entry) -> None:
"""Test subaru location entity exists and has correct info."""
entity_registry = er.async_get(hass)
entry = entity_registry.async_get(DEVICE_ID)
assert entry
actual = hass.states.get(DEVICE_ID)
assert (
actual.attributes.get(ATTR_LONGITUDE) == EXPECTED_STATE_EV_IMPERIAL[LONGITUDE]
)
assert actual.attributes.get(ATTR_LATITUDE) == EXPECTED_STATE_EV_IMPERIAL[LATITUDE]

0 comments on commit 16fc51a

Please sign in to comment.