Collection of changing entity properties to class attributes (#51248)
* Collection of changing entity properties to class attributes * Apply suggestions from code review Co-authored-by: Erik Montnemery <erik@montnemery.com> Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
parent
5acc3a1083
commit
258b388f41
32 changed files with 106 additions and 305 deletions
|
@ -166,6 +166,8 @@ class NMBSLiveBoard(SensorEntity):
|
|||
class NMBSSensor(SensorEntity):
|
||||
"""Get the the total travel time for a given connection."""
|
||||
|
||||
_attr_unit_of_measurement = TIME_MINUTES
|
||||
|
||||
def __init__(
|
||||
self, api_client, name, show_on_map, station_from, station_to, excl_vias
|
||||
):
|
||||
|
@ -185,11 +187,6 @@ class NMBSSensor(SensorEntity):
|
|||
"""Return the name of the sensor."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def unit_of_measurement(self):
|
||||
"""Return the unit of measurement."""
|
||||
return TIME_MINUTES
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
"""Return the sensor default icon or an alert icon if any delay."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue