mirror of
https://github.com/elisspace/core.git
synced 2026-09-29 05:49:53 +00:00
Fix misleading comments in tomorrowio (#74049)
* Fix misleading comments in tomorrowio * Add test
This commit is contained in:
@@ -28,7 +28,6 @@ from homeassistant.const import (
|
||||
IRRADIATION_BTUS_PER_HOUR_SQUARE_FOOT,
|
||||
IRRADIATION_WATTS_PER_SQUARE_METER,
|
||||
LENGTH_KILOMETERS,
|
||||
LENGTH_METERS,
|
||||
LENGTH_MILES,
|
||||
PERCENTAGE,
|
||||
PRESSURE_HPA,
|
||||
@@ -40,6 +39,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.util import slugify
|
||||
from homeassistant.util.distance import convert as distance_convert
|
||||
from homeassistant.util.speed import convert as speed_convert
|
||||
|
||||
from . import TomorrowioDataUpdateCoordinator, TomorrowioEntity
|
||||
from .const import (
|
||||
@@ -113,14 +113,14 @@ SENSOR_TYPES = (
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
),
|
||||
# Data comes in as inHg
|
||||
# Data comes in as hPa
|
||||
TomorrowioSensorEntityDescription(
|
||||
key=TMRW_ATTR_PRESSURE_SURFACE_LEVEL,
|
||||
name="Pressure (Surface Level)",
|
||||
native_unit_of_measurement=PRESSURE_HPA,
|
||||
device_class=SensorDeviceClass.PRESSURE,
|
||||
),
|
||||
# Data comes in as BTUs/(hr * ft^2)
|
||||
# Data comes in as W/m^2, convert to BTUs/(hr * ft^2) for imperial
|
||||
# https://www.theunitconverter.com/watt-square-meter-to-btu-hour-square-foot-conversion/
|
||||
TomorrowioSensorEntityDescription(
|
||||
key=TMRW_ATTR_SOLAR_GHI,
|
||||
@@ -129,7 +129,7 @@ SENSOR_TYPES = (
|
||||
unit_metric=IRRADIATION_WATTS_PER_SQUARE_METER,
|
||||
imperial_conversion=(1 / 3.15459),
|
||||
),
|
||||
# Data comes in as miles
|
||||
# Data comes in as km, convert to miles for imperial
|
||||
TomorrowioSensorEntityDescription(
|
||||
key=TMRW_ATTR_CLOUD_BASE,
|
||||
name="Cloud Base",
|
||||
@@ -139,7 +139,7 @@ SENSOR_TYPES = (
|
||||
val, LENGTH_KILOMETERS, LENGTH_MILES
|
||||
),
|
||||
),
|
||||
# Data comes in as miles
|
||||
# Data comes in as km, convert to miles for imperial
|
||||
TomorrowioSensorEntityDescription(
|
||||
key=TMRW_ATTR_CLOUD_CEILING,
|
||||
name="Cloud Ceiling",
|
||||
@@ -154,16 +154,15 @@ SENSOR_TYPES = (
|
||||
name="Cloud Cover",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
),
|
||||
# Data comes in as MPH
|
||||
# Data comes in as m/s, convert to mi/h for imperial
|
||||
TomorrowioSensorEntityDescription(
|
||||
key=TMRW_ATTR_WIND_GUST,
|
||||
name="Wind Gust",
|
||||
unit_imperial=SPEED_MILES_PER_HOUR,
|
||||
unit_metric=SPEED_METERS_PER_SECOND,
|
||||
imperial_conversion=lambda val: distance_convert(
|
||||
val, LENGTH_METERS, LENGTH_MILES
|
||||
)
|
||||
* 3600,
|
||||
imperial_conversion=lambda val: speed_convert(
|
||||
val, SPEED_METERS_PER_SECOND, SPEED_MILES_PER_HOUR
|
||||
),
|
||||
),
|
||||
TomorrowioSensorEntityDescription(
|
||||
key=TMRW_ATTR_PRECIPITATION_TYPE,
|
||||
@@ -172,7 +171,7 @@ SENSOR_TYPES = (
|
||||
device_class="tomorrowio__precipitation_type",
|
||||
icon="mdi:weather-snowy-rainy",
|
||||
),
|
||||
# Data comes in as ppb
|
||||
# Data comes in as ppb, convert to µg/m^3
|
||||
# Molecular weight of Ozone is 48
|
||||
TomorrowioSensorEntityDescription(
|
||||
key=TMRW_ATTR_OZONE,
|
||||
@@ -193,7 +192,7 @@ SENSOR_TYPES = (
|
||||
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
device_class=SensorDeviceClass.PM10,
|
||||
),
|
||||
# Data comes in as ppb
|
||||
# Data comes in as ppb, convert to µg/m^3
|
||||
# Molecular weight of Nitrogen Dioxide is 46.01
|
||||
TomorrowioSensorEntityDescription(
|
||||
key=TMRW_ATTR_NITROGEN_DIOXIDE,
|
||||
@@ -202,7 +201,7 @@ SENSOR_TYPES = (
|
||||
multiplication_factor=convert_ppb_to_ugm3(46.01),
|
||||
device_class=SensorDeviceClass.NITROGEN_DIOXIDE,
|
||||
),
|
||||
# Data comes in as ppb
|
||||
# Data comes in as ppb, convert to ppm
|
||||
TomorrowioSensorEntityDescription(
|
||||
key=TMRW_ATTR_CARBON_MONOXIDE,
|
||||
name="Carbon Monoxide",
|
||||
@@ -210,6 +209,7 @@ SENSOR_TYPES = (
|
||||
multiplication_factor=1 / 1000,
|
||||
device_class=SensorDeviceClass.CO,
|
||||
),
|
||||
# Data comes in as ppb, convert to µg/m^3
|
||||
# Molecular weight of Sulphur Dioxide is 64.07
|
||||
TomorrowioSensorEntityDescription(
|
||||
key=TMRW_ATTR_SULPHUR_DIOXIDE,
|
||||
|
||||
Reference in New Issue
Block a user