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

Use AREA_SQUARE_METERS constant in all integrations #40107

Merged
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
8 changes: 7 additions & 1 deletion homeassistant/components/ambient_station/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from homeassistant.components.binary_sensor import DEVICE_CLASS_CONNECTIVITY
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import (
AREA_SQUARE_METERS,
ATTR_LOCATION,
ATTR_NAME,
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
Expand Down Expand Up @@ -206,7 +207,12 @@
TYPE_SOILTEMP7F: ("Soil Temp 7", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_SOILTEMP8F: ("Soil Temp 8", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_SOILTEMP9F: ("Soil Temp 9", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_SOLARRADIATION: ("Solar Rad", f"{POWER_WATT}/m^2", TYPE_SENSOR, None),
TYPE_SOLARRADIATION: (
"Solar Rad",
f"{POWER_WATT}/{AREA_SQUARE_METERS}",
TYPE_SENSOR,
None,
),
TYPE_SOLARRADIATION_LX: ("Solar Rad (lx)", "lx", TYPE_SENSOR, "illuminance"),
TYPE_TEMP10F: ("Temp 10", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_TEMP1F: ("Temp 1", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
Expand Down
5 changes: 3 additions & 2 deletions homeassistant/components/bloomsky/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
AREA_SQUARE_METERS,
CONF_MONITORED_CONDITIONS,
PERCENTAGE,
TEMP_CELSIUS,
Expand Down Expand Up @@ -32,7 +33,7 @@
"Temperature": TEMP_FAHRENHEIT,
"Humidity": PERCENTAGE,
"Pressure": "inHg",
"Luminance": "cd/",
"Luminance": f"cd/{AREA_SQUARE_METERS}",
"Voltage": "mV",
}

Expand All @@ -41,7 +42,7 @@
"Temperature": TEMP_CELSIUS,
"Humidity": PERCENTAGE,
"Pressure": "mbar",
"Luminance": "cd/",
"Luminance": f"cd/{AREA_SQUARE_METERS}",
"Voltage": "mV",
}

Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/isy994/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from homeassistant.components.sensor import DOMAIN as SENSOR
from homeassistant.components.switch import DOMAIN as SWITCH
from homeassistant.const import (
AREA_SQUARE_METERS,
CONCENTRATION_PARTS_PER_MILLION,
DEGREE,
ENERGY_KILO_WATT_HOUR,
Expand Down Expand Up @@ -377,7 +378,7 @@
"71": UV_INDEX,
"72": VOLT,
"73": POWER_WATT,
"74": f"{POWER_WATT}/{LENGTH_METERS}²",
"74": f"{POWER_WATT}/{AREA_SQUARE_METERS}",
"75": "weekday",
"76": DEGREE,
"77": TIME_YEARS,
Expand Down
8 changes: 7 additions & 1 deletion homeassistant/components/smartthings/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pysmartthings import Attribute, Capability

from homeassistant.const import (
AREA_SQUARE_METERS,
CONCENTRATION_PARTS_PER_MILLION,
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_HUMIDITY,
Expand Down Expand Up @@ -41,7 +42,12 @@
Map(Attribute.battery, "Battery", PERCENTAGE, DEVICE_CLASS_BATTERY)
],
Capability.body_mass_index_measurement: [
Map(Attribute.bmi_measurement, "Body Mass Index", f"{MASS_KILOGRAMS}/m^2", None)
Map(
Attribute.bmi_measurement,
"Body Mass Index",
f"{MASS_KILOGRAMS}/{AREA_SQUARE_METERS}",
None,
)
],
Capability.body_weight_measurement: [
Map(Attribute.body_weight_measurement, "Body Weight", MASS_KILOGRAMS, None)
Expand Down
8 changes: 7 additions & 1 deletion homeassistant/components/zamg/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import voluptuous as vol

from homeassistant.const import (
AREA_SQUARE_METERS,
ATTR_ATTRIBUTION,
CONF_LATITUDE,
CONF_LONGITUDE,
Expand Down Expand Up @@ -60,7 +61,12 @@
"wind_max_bearing": ("Top Wind Bearing", DEGREE, f"WSR {DEGREE}", int),
"sun_last_hour": ("Sun Last Hour", PERCENTAGE, f"SO {PERCENTAGE}", int),
"temperature": ("Temperature", TEMP_CELSIUS, f"T {TEMP_CELSIUS}", float),
"precipitation": ("Precipitation", "l/m²", "N l/m²", float),
"precipitation": (
"Precipitation",
f"l/{AREA_SQUARE_METERS}",
f"N l/{AREA_SQUARE_METERS}",
float,
),
"dewpoint": ("Dew Point", TEMP_CELSIUS, f"TP {TEMP_CELSIUS}", float),
# The following probably not useful for general consumption,
# but we need them to fill in internal attributes
Expand Down