diff --git a/custom_components/subaru/device_tracker.py b/custom_components/subaru/device_tracker.py index 9dd38d4..76cc825 100644 --- a/custom_components/subaru/device_tracker.py +++ b/custom_components/subaru/device_tracker.py @@ -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.""" diff --git a/custom_components/subaru/manifest.json b/custom_components/subaru/manifest.json index 39e16b5..482f404 100644 --- a/custom_components/subaru/manifest.json +++ b/custom_components/subaru/manifest.json @@ -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" } diff --git a/tests/test_device_tracker.py b/tests/test_device_tracker.py new file mode 100644 index 0000000..872f3eb --- /dev/null +++ b/tests/test_device_tracker.py @@ -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]