Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add device name for all entities and car icon for device tracker #38

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions custom_components/leafspy/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def is_on(self):
def device_info(self):
"""Return device information."""
return {
"name": "Leaf",
"identifiers": {(DOMAIN, self._device_id)},
}

Expand Down
7 changes: 6 additions & 1 deletion custom_components/leafspy/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ def unique_id(self):
def battery_level(self):
"""Return the battery level of the car."""
return self._data.get('battery_level')

@property
def icon(self):
"""Return the icon for the device."""
return 'mdi:car'

@property
def latitude(self):
Expand Down Expand Up @@ -105,7 +110,7 @@ def source_type(self):
def device_info(self):
"""Return the device info."""
return {
'name': self.name,
'name': 'Leaf',
'identifiers': {(LS_DOMAIN, self._dev_id)},
}

Expand Down
1 change: 1 addition & 0 deletions custom_components/leafspy/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ def native_value(self):
def device_info(self):
"""Return device information."""
return {
"name": "Leaf",
"identifiers": {(DOMAIN, self._device_id)},
}

Expand Down
Loading