Skip to content

Commit

Permalink
Migrate Ambee to new entity naming style (home-assistant#74877)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Jul 11, 2022
1 parent eb92f0e commit 34b8f2b
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 56 deletions.
54 changes: 27 additions & 27 deletions homeassistant/components/ambee/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,33 @@
SERVICE_POLLEN: Final = "pollen"

SERVICES: dict[str, str] = {
SERVICE_AIR_QUALITY: "Air Quality",
SERVICE_AIR_QUALITY: "Air quality",
SERVICE_POLLEN: "Pollen",
}

SENSORS: dict[str, list[SensorEntityDescription]] = {
SERVICE_AIR_QUALITY: [
SensorEntityDescription(
key="particulate_matter_2_5",
name="Particulate Matter < 2.5 μm",
name="Particulate matter < 2.5 μm",
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="particulate_matter_10",
name="Particulate Matter < 10 μm",
name="Particulate matter < 10 μm",
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="sulphur_dioxide",
name="Sulphur Dioxide (SO2)",
name="Sulphur dioxide (SO2)",
native_unit_of_measurement=CONCENTRATION_PARTS_PER_BILLION,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="nitrogen_dioxide",
name="Nitrogen Dioxide (NO2)",
name="Nitrogen dioxide (NO2)",
native_unit_of_measurement=CONCENTRATION_PARTS_PER_BILLION,
state_class=SensorStateClass.MEASUREMENT,
),
Expand All @@ -65,164 +65,164 @@
),
SensorEntityDescription(
key="carbon_monoxide",
name="Carbon Monoxide (CO)",
name="Carbon monoxide (CO)",
device_class=SensorDeviceClass.CO,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="air_quality_index",
name="Air Quality Index (AQI)",
name="Air quality index (AQI)",
state_class=SensorStateClass.MEASUREMENT,
),
],
SERVICE_POLLEN: [
SensorEntityDescription(
key="grass",
name="Grass Pollen",
name="Grass",
icon="mdi:grass",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
),
SensorEntityDescription(
key="tree",
name="Tree Pollen",
name="Tree",
icon="mdi:tree",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
),
SensorEntityDescription(
key="weed",
name="Weed Pollen",
name="Weed",
icon="mdi:sprout",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
),
SensorEntityDescription(
key="grass_risk",
name="Grass Pollen Risk",
name="Grass risk",
icon="mdi:grass",
device_class=DEVICE_CLASS_AMBEE_RISK,
),
SensorEntityDescription(
key="tree_risk",
name="Tree Pollen Risk",
name="Tree risk",
icon="mdi:tree",
device_class=DEVICE_CLASS_AMBEE_RISK,
),
SensorEntityDescription(
key="weed_risk",
name="Weed Pollen Risk",
name="Weed risk",
icon="mdi:sprout",
device_class=DEVICE_CLASS_AMBEE_RISK,
),
SensorEntityDescription(
key="grass_poaceae",
name="Poaceae Grass Pollen",
name="Poaceae grass",
icon="mdi:grass",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="tree_alder",
name="Alder Tree Pollen",
name="Alder tree",
icon="mdi:tree",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="tree_birch",
name="Birch Tree Pollen",
name="Birch tree",
icon="mdi:tree",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="tree_cypress",
name="Cypress Tree Pollen",
name="Cypress tree",
icon="mdi:tree",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="tree_elm",
name="Elm Tree Pollen",
name="Elm tree",
icon="mdi:tree",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="tree_hazel",
name="Hazel Tree Pollen",
name="Hazel tree",
icon="mdi:tree",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="tree_oak",
name="Oak Tree Pollen",
name="Oak tree",
icon="mdi:tree",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="tree_pine",
name="Pine Tree Pollen",
name="Pine tree",
icon="mdi:tree",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="tree_plane",
name="Plane Tree Pollen",
name="Plane tree",
icon="mdi:tree",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="tree_poplar",
name="Poplar Tree Pollen",
name="Poplar tree",
icon="mdi:tree",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="weed_chenopod",
name="Chenopod Weed Pollen",
name="Chenopod weed",
icon="mdi:sprout",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="weed_mugwort",
name="Mugwort Weed Pollen",
name="Mugwort weed",
icon="mdi:sprout",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="weed_nettle",
name="Nettle Weed Pollen",
name="Nettle weed",
icon="mdi:sprout",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="weed_ragweed",
name="Ragweed Weed Pollen",
name="Ragweed weed",
icon="mdi:sprout",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/ambee/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ async def async_setup_entry(
class AmbeeSensorEntity(CoordinatorEntity, SensorEntity):
"""Defines an Ambee sensor."""

_attr_has_entity_name = True

def __init__(
self,
*,
Expand Down
Loading

0 comments on commit 34b8f2b

Please sign in to comment.