From 9311b02369e60f7c1ee8d4d97a6535cdbd41f0e9 Mon Sep 17 00:00:00 2001 From: springstan <46536646+springstan@users.noreply.github.com> Date: Wed, 10 Jun 2020 21:38:29 +0200 Subject: [PATCH] Use LENGTH_FEET constant (#34053) --- homeassistant/components/fitbit/sensor.py | 3 ++- homeassistant/components/isy994/const.py | 4 ++-- homeassistant/components/proximity/__init__.py | 3 ++- homeassistant/components/zha/core/channels/smartenergy.py | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/fitbit/sensor.py b/homeassistant/components/fitbit/sensor.py index 7e713505a0e..d3f33832369 100644 --- a/homeassistant/components/fitbit/sensor.py +++ b/homeassistant/components/fitbit/sensor.py @@ -16,6 +16,7 @@ from homeassistant.const import ( CONF_CLIENT_ID, CONF_CLIENT_SECRET, CONF_UNIT_SYSTEM, + LENGTH_FEET, MASS_KILOGRAMS, MASS_MILLIGRAMS, TIME_MILLISECONDS, @@ -117,7 +118,7 @@ FITBIT_MEASUREMENTS = { "en_US": { "duration": TIME_MILLISECONDS, "distance": "mi", - "elevation": "ft", + "elevation": LENGTH_FEET, "height": "in", "weight": "lbs", "body": "in", diff --git a/homeassistant/components/isy994/const.py b/homeassistant/components/isy994/const.py index afbe44011d8..b2748223f51 100644 --- a/homeassistant/components/isy994/const.py +++ b/homeassistant/components/isy994/const.py @@ -316,8 +316,8 @@ UOM_FRIENDLY_NAME = { "3": f"btu/{TIME_HOURS}", "4": TEMP_CELSIUS, "5": LENGTH_CENTIMETERS, - "6": "ft³", - "7": f"ft³/{TIME_MINUTES}", + "6": f"{LENGTH_FEET}³", + "7": f"{LENGTH_FEET}³/{TIME_MINUTES}", "8": "m³", "9": TIME_DAYS, "10": TIME_DAYS, diff --git a/homeassistant/components/proximity/__init__.py b/homeassistant/components/proximity/__init__.py index 4b6ff477053..7beaaaf00e1 100644 --- a/homeassistant/components/proximity/__init__.py +++ b/homeassistant/components/proximity/__init__.py @@ -7,6 +7,7 @@ from homeassistant.const import ( CONF_DEVICES, CONF_UNIT_OF_MEASUREMENT, CONF_ZONE, + LENGTH_FEET, LENGTH_KILOMETERS, LENGTH_METERS, ) @@ -34,7 +35,7 @@ DEFAULT_PROXIMITY_ZONE = "home" DEFAULT_TOLERANCE = 1 DOMAIN = "proximity" -UNITS = [LENGTH_KILOMETERS, LENGTH_METERS, "mi", "ft"] +UNITS = [LENGTH_KILOMETERS, LENGTH_METERS, "mi", LENGTH_FEET] ZONE_SCHEMA = vol.Schema( { diff --git a/homeassistant/components/zha/core/channels/smartenergy.py b/homeassistant/components/zha/core/channels/smartenergy.py index 58a394e7c80..525ba45c806 100644 --- a/homeassistant/components/zha/core/channels/smartenergy.py +++ b/homeassistant/components/zha/core/channels/smartenergy.py @@ -3,7 +3,7 @@ import logging import zigpy.zcl.clusters.smartenergy as smartenergy -from homeassistant.const import TIME_HOURS, TIME_SECONDS +from homeassistant.const import LENGTH_FEET, TIME_HOURS, TIME_SECONDS from homeassistant.core import callback from .. import registries, typing as zha_typing @@ -62,7 +62,7 @@ class Metering(ZigbeeChannel): unit_of_measure_map = { 0x00: "kW", 0x01: f"m³/{TIME_HOURS}", - 0x02: f"ft³/{TIME_HOURS}", + 0x02: f"{LENGTH_FEET}³/{TIME_HOURS}", 0x03: f"ccf/{TIME_HOURS}", 0x04: f"US gal/{TIME_HOURS}", 0x05: f"IMP gal/{TIME_HOURS}",