mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Make name of nmbs live sensor customizable via unique_id (#29662)
* Make name customizable for nmbs live sensors * Change order of the live name * Added unique id to live nmbs sensor * Revert changing the name of the live sensor
This commit is contained in:
parent
80be3b74a9
commit
0cb468d7b0
@ -92,7 +92,7 @@ class NMBSLiveBoard(Entity):
|
|||||||
"""Initialize the sensor for getting liveboard data."""
|
"""Initialize the sensor for getting liveboard data."""
|
||||||
self._station = live_station
|
self._station = live_station
|
||||||
self._api_client = api_client
|
self._api_client = api_client
|
||||||
|
self._unique_id = f"nmbs_live_{self._station}"
|
||||||
self._attrs = {}
|
self._attrs = {}
|
||||||
self._state = None
|
self._state = None
|
||||||
|
|
||||||
@ -101,6 +101,11 @@ class NMBSLiveBoard(Entity):
|
|||||||
"""Return the sensor default name."""
|
"""Return the sensor default name."""
|
||||||
return "NMBS Live"
|
return "NMBS Live"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def unique_id(self):
|
||||||
|
"""Return a unique ID."""
|
||||||
|
return self._unique_id
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def icon(self):
|
def icon(self):
|
||||||
"""Return the default icon or an alert icon if delays."""
|
"""Return the default icon or an alert icon if delays."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user