mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Add new device class: PH (potential hydrogen) (#95928)
This commit is contained in:
parent
1552319e94
commit
38111141f9
@ -216,6 +216,12 @@ class NumberDeviceClass(StrEnum):
|
||||
Unit of measurement: `µg/m³`
|
||||
"""
|
||||
|
||||
PH = "ph"
|
||||
"""Potential hidrogen (acidity/alkalinity).
|
||||
|
||||
Unit of measurement: Unitless
|
||||
"""
|
||||
|
||||
PM1 = "pm1"
|
||||
"""Particulate matter <= 1 μm.
|
||||
|
||||
@ -422,6 +428,7 @@ DEVICE_CLASS_UNITS: dict[NumberDeviceClass, set[type[StrEnum] | str | None]] = {
|
||||
NumberDeviceClass.NITROGEN_MONOXIDE: {CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
|
||||
NumberDeviceClass.NITROUS_OXIDE: {CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
|
||||
NumberDeviceClass.OZONE: {CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
|
||||
NumberDeviceClass.PH: {None},
|
||||
NumberDeviceClass.PM1: {CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
|
||||
NumberDeviceClass.PM10: {CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
|
||||
NumberDeviceClass.PM25: {CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
|
||||
|
@ -91,6 +91,9 @@
|
||||
"ozone": {
|
||||
"name": "[%key:component::sensor::entity_component::ozone::name%]"
|
||||
},
|
||||
"ph": {
|
||||
"name": "[%key:component::sensor::entity_component::ph::name%]"
|
||||
},
|
||||
"pm1": {
|
||||
"name": "[%key:component::sensor::entity_component::pm1::name%]"
|
||||
},
|
||||
|
@ -155,6 +155,7 @@
|
||||
"nitrogen_monoxide": "[%key:component::sensor::entity_component::nitrogen_monoxide::name%]",
|
||||
"nitrous_oxide": "[%key:component::sensor::entity_component::nitrous_oxide::name%]",
|
||||
"ozone": "[%key:component::sensor::entity_component::ozone::name%]",
|
||||
"ph": "[%key:component::sensor::entity_component::ph::name%]",
|
||||
"pm1": "[%key:component::sensor::entity_component::pm1::name%]",
|
||||
"pm10": "[%key:component::sensor::entity_component::pm10::name%]",
|
||||
"pm25": "[%key:component::sensor::entity_component::pm25::name%]",
|
||||
|
@ -247,6 +247,12 @@ class SensorDeviceClass(StrEnum):
|
||||
Unit of measurement: `µg/m³`
|
||||
"""
|
||||
|
||||
PH = "ph"
|
||||
"""Potential hidrogen (acidity/alkalinity).
|
||||
|
||||
Unit of measurement: Unitless
|
||||
"""
|
||||
|
||||
PM1 = "pm1"
|
||||
"""Particulate matter <= 1 μm.
|
||||
|
||||
@ -509,6 +515,7 @@ DEVICE_CLASS_UNITS: dict[SensorDeviceClass, set[type[StrEnum] | str | None]] = {
|
||||
SensorDeviceClass.NITROGEN_MONOXIDE: {CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
|
||||
SensorDeviceClass.NITROUS_OXIDE: {CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
|
||||
SensorDeviceClass.OZONE: {CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
|
||||
SensorDeviceClass.PH: {None},
|
||||
SensorDeviceClass.PM1: {CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
|
||||
SensorDeviceClass.PM10: {CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
|
||||
SensorDeviceClass.PM25: {CONCENTRATION_MICROGRAMS_PER_CUBIC_METER},
|
||||
@ -576,6 +583,7 @@ DEVICE_CLASS_STATE_CLASSES: dict[SensorDeviceClass, set[SensorStateClass]] = {
|
||||
SensorDeviceClass.NITROGEN_MONOXIDE: {SensorStateClass.MEASUREMENT},
|
||||
SensorDeviceClass.NITROUS_OXIDE: {SensorStateClass.MEASUREMENT},
|
||||
SensorDeviceClass.OZONE: {SensorStateClass.MEASUREMENT},
|
||||
SensorDeviceClass.PH: {SensorStateClass.MEASUREMENT},
|
||||
SensorDeviceClass.PM1: {SensorStateClass.MEASUREMENT},
|
||||
SensorDeviceClass.PM10: {SensorStateClass.MEASUREMENT},
|
||||
SensorDeviceClass.PM25: {SensorStateClass.MEASUREMENT},
|
||||
|
@ -57,6 +57,7 @@ CONF_IS_NITROGEN_DIOXIDE = "is_nitrogen_dioxide"
|
||||
CONF_IS_NITROGEN_MONOXIDE = "is_nitrogen_monoxide"
|
||||
CONF_IS_NITROUS_OXIDE = "is_nitrous_oxide"
|
||||
CONF_IS_OZONE = "is_ozone"
|
||||
CONF_IS_PH = "is_ph"
|
||||
CONF_IS_PM1 = "is_pm1"
|
||||
CONF_IS_PM10 = "is_pm10"
|
||||
CONF_IS_PM25 = "is_pm25"
|
||||
@ -107,6 +108,7 @@ ENTITY_CONDITIONS = {
|
||||
SensorDeviceClass.OZONE: [{CONF_TYPE: CONF_IS_OZONE}],
|
||||
SensorDeviceClass.POWER: [{CONF_TYPE: CONF_IS_POWER}],
|
||||
SensorDeviceClass.POWER_FACTOR: [{CONF_TYPE: CONF_IS_POWER_FACTOR}],
|
||||
SensorDeviceClass.PH: [{CONF_TYPE: CONF_IS_PH}],
|
||||
SensorDeviceClass.PM1: [{CONF_TYPE: CONF_IS_PM1}],
|
||||
SensorDeviceClass.PM10: [{CONF_TYPE: CONF_IS_PM10}],
|
||||
SensorDeviceClass.PM25: [{CONF_TYPE: CONF_IS_PM25}],
|
||||
@ -167,6 +169,7 @@ CONDITION_SCHEMA = vol.All(
|
||||
CONF_IS_OZONE,
|
||||
CONF_IS_POWER,
|
||||
CONF_IS_POWER_FACTOR,
|
||||
CONF_IS_PH,
|
||||
CONF_IS_PM1,
|
||||
CONF_IS_PM10,
|
||||
CONF_IS_PM25,
|
||||
|
@ -56,6 +56,7 @@ CONF_NITROGEN_DIOXIDE = "nitrogen_dioxide"
|
||||
CONF_NITROGEN_MONOXIDE = "nitrogen_monoxide"
|
||||
CONF_NITROUS_OXIDE = "nitrous_oxide"
|
||||
CONF_OZONE = "ozone"
|
||||
CONF_PH = "ph"
|
||||
CONF_PM1 = "pm1"
|
||||
CONF_PM10 = "pm10"
|
||||
CONF_PM25 = "pm25"
|
||||
@ -104,6 +105,7 @@ ENTITY_TRIGGERS = {
|
||||
SensorDeviceClass.NITROGEN_MONOXIDE: [{CONF_TYPE: CONF_NITROGEN_MONOXIDE}],
|
||||
SensorDeviceClass.NITROUS_OXIDE: [{CONF_TYPE: CONF_NITROUS_OXIDE}],
|
||||
SensorDeviceClass.OZONE: [{CONF_TYPE: CONF_OZONE}],
|
||||
SensorDeviceClass.PH: [{CONF_TYPE: CONF_PH}],
|
||||
SensorDeviceClass.PM1: [{CONF_TYPE: CONF_PM1}],
|
||||
SensorDeviceClass.PM10: [{CONF_TYPE: CONF_PM10}],
|
||||
SensorDeviceClass.PM25: [{CONF_TYPE: CONF_PM25}],
|
||||
@ -165,6 +167,7 @@ TRIGGER_SCHEMA = vol.All(
|
||||
CONF_NITROGEN_MONOXIDE,
|
||||
CONF_NITROUS_OXIDE,
|
||||
CONF_OZONE,
|
||||
CONF_PH,
|
||||
CONF_PM1,
|
||||
CONF_PM10,
|
||||
CONF_PM25,
|
||||
|
@ -25,6 +25,7 @@
|
||||
"is_nitrogen_monoxide": "Current {entity_name} nitrogen monoxide concentration level",
|
||||
"is_nitrous_oxide": "Current {entity_name} nitrous oxide concentration level",
|
||||
"is_ozone": "Current {entity_name} ozone concentration level",
|
||||
"is_ph": "Current {entity_name} pH level",
|
||||
"is_pm1": "Current {entity_name} PM1 concentration level",
|
||||
"is_pm10": "Current {entity_name} PM10 concentration level",
|
||||
"is_pm25": "Current {entity_name} PM2.5 concentration level",
|
||||
@ -72,6 +73,7 @@
|
||||
"nitrogen_monoxide": "{entity_name} nitrogen monoxide concentration changes",
|
||||
"nitrous_oxide": "{entity_name} nitrous oxide concentration changes",
|
||||
"ozone": "{entity_name} ozone concentration changes",
|
||||
"ph": "{entity_name} pH level changes",
|
||||
"pm1": "{entity_name} PM1 concentration changes",
|
||||
"pm10": "{entity_name} PM10 concentration changes",
|
||||
"pm25": "{entity_name} PM2.5 concentration changes",
|
||||
@ -198,6 +200,9 @@
|
||||
"ozone": {
|
||||
"name": "Ozone"
|
||||
},
|
||||
"ph": {
|
||||
"name": "pH"
|
||||
},
|
||||
"pm1": {
|
||||
"name": "PM1"
|
||||
},
|
||||
|
@ -93,6 +93,7 @@
|
||||
"nitrogen_monoxide": "[%key:component::sensor::entity_component::nitrogen_monoxide::name%]",
|
||||
"nitrous_oxide": "[%key:component::sensor::entity_component::nitrous_oxide::name%]",
|
||||
"ozone": "[%key:component::sensor::entity_component::ozone::name%]",
|
||||
"ph": "[%key:component::sensor::entity_component::ph::name%]",
|
||||
"pm1": "[%key:component::sensor::entity_component::pm1::name%]",
|
||||
"pm10": "[%key:component::sensor::entity_component::pm10::name%]",
|
||||
"pm25": "[%key:component::sensor::entity_component::pm25::name%]",
|
||||
|
@ -1799,6 +1799,7 @@ async def test_non_numeric_device_class_with_unit_of_measurement(
|
||||
SensorDeviceClass.NITROGEN_MONOXIDE,
|
||||
SensorDeviceClass.NITROUS_OXIDE,
|
||||
SensorDeviceClass.OZONE,
|
||||
SensorDeviceClass.PH,
|
||||
SensorDeviceClass.PM1,
|
||||
SensorDeviceClass.PM10,
|
||||
SensorDeviceClass.PM25,
|
||||
|
Loading…
x
Reference in New Issue
Block a user