diff --git a/homeassistant/components/number/const.py b/homeassistant/components/number/const.py index 849581b6f9f..461139a15ea 100644 --- a/homeassistant/components/number/const.py +++ b/homeassistant/components/number/const.py @@ -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}, diff --git a/homeassistant/components/number/strings.json b/homeassistant/components/number/strings.json index e954a55b280..2d72cdbf203 100644 --- a/homeassistant/components/number/strings.json +++ b/homeassistant/components/number/strings.json @@ -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%]" }, diff --git a/homeassistant/components/scrape/strings.json b/homeassistant/components/scrape/strings.json index e5ed8613fc4..4301bb7d5a0 100644 --- a/homeassistant/components/scrape/strings.json +++ b/homeassistant/components/scrape/strings.json @@ -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%]", diff --git a/homeassistant/components/sensor/const.py b/homeassistant/components/sensor/const.py index 2c6883e4a71..13c9293daa7 100644 --- a/homeassistant/components/sensor/const.py +++ b/homeassistant/components/sensor/const.py @@ -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}, diff --git a/homeassistant/components/sensor/device_condition.py b/homeassistant/components/sensor/device_condition.py index 7d6c57de296..b12cdb570eb 100644 --- a/homeassistant/components/sensor/device_condition.py +++ b/homeassistant/components/sensor/device_condition.py @@ -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, diff --git a/homeassistant/components/sensor/device_trigger.py b/homeassistant/components/sensor/device_trigger.py index 1bb41eb2d30..1c0da89692b 100644 --- a/homeassistant/components/sensor/device_trigger.py +++ b/homeassistant/components/sensor/device_trigger.py @@ -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, diff --git a/homeassistant/components/sensor/strings.json b/homeassistant/components/sensor/strings.json index c4c1f81109d..1db5e4c8cfd 100644 --- a/homeassistant/components/sensor/strings.json +++ b/homeassistant/components/sensor/strings.json @@ -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" }, diff --git a/homeassistant/components/sql/strings.json b/homeassistant/components/sql/strings.json index 74c165e9d20..9ac8bd22027 100644 --- a/homeassistant/components/sql/strings.json +++ b/homeassistant/components/sql/strings.json @@ -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%]", diff --git a/tests/components/sensor/test_init.py b/tests/components/sensor/test_init.py index b5d425029d0..c5406a85fc0 100644 --- a/tests/components/sensor/test_init.py +++ b/tests/components/sensor/test_init.py @@ -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,