Use LENGTH_METERS constant (#34110)
This commit is contained in:
1 parent
538bb60022
commit
00b6409b76
9 files changed
+57
-18
No files matched your search
@@ -8,6 +8,7 @@ from homeassistant.const import (
|
||||
CONF_UNIT_OF_MEASUREMENT,
|
||||
CONF_ZONE,
|
||||
LENGTH_KILOMETERS,
|
||||
LENGTH_METERS,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
@@ -33,7 +34,7 @@ DEFAULT_PROXIMITY_ZONE = "home"
|
||||
DEFAULT_TOLERANCE = 1
|
||||
DOMAIN = "proximity"
|
||||
|
||||
UNITS = [LENGTH_KILOMETERS, "m", "mi", "ft"]
|
||||
UNITS = [LENGTH_KILOMETERS, LENGTH_METERS, "mi", "ft"]
|
||||
|
||||
ZONE_SCHEMA = vol.Schema(
|
||||
{
|
||||
@@ -210,7 +211,7 @@ class Proximity(Entity):
|
||||
|
||||
# Add the device and distance to a dictionary.
|
||||
distances_to_zone[device] = round(
|
||||
convert(dist_to_zone, "m", self.unit_of_measurement), 1
|
||||
convert(dist_to_zone, LENGTH_METERS, self.unit_of_measurement), 1
|
||||
)
|
||||
|
||||
# Loop through each of the distances collected and work out the
|
||||
|
||||
Reference in new issue
Block a user