diff --git a/homeassistant/components/sensor/__init__.py b/homeassistant/components/sensor/__init__.py index c6c5908b5d8a04..dcdc3213edfcee 100644 --- a/homeassistant/components/sensor/__init__.py +++ b/homeassistant/components/sensor/__init__.py @@ -317,11 +317,19 @@ class SensorDeviceClass(StrEnum): Unit of measurement: `VOLUME_*` units - SI / metric: `mL`, `L`, `m³` - - USCS / imperial: `fl. oz.`, `gal`, `ft³` (warning: volumes expressed in + - USCS / imperial: `fl. oz.`, `ft³`, `gal` (warning: volumes expressed in + USCS/imperial units are currently assumed to be US volumes) + """ + + WATER = "water" + """Water. + + Unit of measurement: + - SI / metric: `m³`, `L` + - USCS / imperial: `ft³`, `gal` (warning: volumes expressed in USCS/imperial units are currently assumed to be US volumes) """ - # weight/mass (g, kg, mg, µg, oz, lb) WEIGHT = "weight" """Generic weight, represents a measurement of an object's mass. @@ -374,6 +382,7 @@ class SensorStateClass(StrEnum): SensorDeviceClass.SPEED: SpeedConverter, SensorDeviceClass.TEMPERATURE: TemperatureConverter, SensorDeviceClass.VOLUME: VolumeConverter, + SensorDeviceClass.WATER: VolumeConverter, SensorDeviceClass.WEIGHT: MassConverter, } diff --git a/homeassistant/components/sensor/device_condition.py b/homeassistant/components/sensor/device_condition.py index 6abd0bfbfaa600..c1015636d409ff 100644 --- a/homeassistant/components/sensor/device_condition.py +++ b/homeassistant/components/sensor/device_condition.py @@ -63,6 +63,7 @@ CONF_IS_VOLATILE_ORGANIC_COMPOUNDS = "is_volatile_organic_compounds" CONF_IS_VOLTAGE = "is_voltage" CONF_IS_VOLUME = "is_volume" +CONF_IS_WATER = "is_water" CONF_IS_WEIGHT = "is_weight" ENTITY_CONDITIONS = { @@ -101,6 +102,7 @@ ], SensorDeviceClass.VOLTAGE: [{CONF_TYPE: CONF_IS_VOLTAGE}], SensorDeviceClass.VOLUME: [{CONF_TYPE: CONF_IS_VOLUME}], + SensorDeviceClass.WATER: [{CONF_TYPE: CONF_IS_WATER}], SensorDeviceClass.WEIGHT: [{CONF_TYPE: CONF_IS_WEIGHT}], DEVICE_CLASS_NONE: [{CONF_TYPE: CONF_IS_VALUE}], } diff --git a/homeassistant/components/sensor/device_trigger.py b/homeassistant/components/sensor/device_trigger.py index 675a59ef78d08d..c2cda7d8e9d36a 100644 --- a/homeassistant/components/sensor/device_trigger.py +++ b/homeassistant/components/sensor/device_trigger.py @@ -62,6 +62,7 @@ CONF_VOLATILE_ORGANIC_COMPOUNDS = "volatile_organic_compounds" CONF_VOLTAGE = "voltage" CONF_VOLUME = "volume" +CONF_WATER = "water" CONF_WEIGHT = "weight" ENTITY_TRIGGERS = { @@ -100,6 +101,7 @@ ], SensorDeviceClass.VOLTAGE: [{CONF_TYPE: CONF_VOLTAGE}], SensorDeviceClass.VOLUME: [{CONF_TYPE: CONF_VOLUME}], + SensorDeviceClass.WATER: [{CONF_TYPE: CONF_WATER}], SensorDeviceClass.WEIGHT: [{CONF_TYPE: CONF_WEIGHT}], DEVICE_CLASS_NONE: [{CONF_TYPE: CONF_VALUE}], } diff --git a/homeassistant/components/sensor/strings.json b/homeassistant/components/sensor/strings.json index 3584777bb5fc2f..12c902816b1f34 100644 --- a/homeassistant/components/sensor/strings.json +++ b/homeassistant/components/sensor/strings.json @@ -33,6 +33,7 @@ "is_volatile_organic_compounds": "Current {entity_name} volatile organic compounds concentration level", "is_voltage": "Current {entity_name} voltage", "is_volume": "Current {entity_name} volume", + "is_water": "Current {entity_name} water", "is_weight": "Current {entity_name} weight" }, "trigger_type": { @@ -67,6 +68,7 @@ "volatile_organic_compounds": "{entity_name} volatile organic compounds concentration changes", "voltage": "{entity_name} voltage changes", "volume": "{entity_name} volume changes", + "water": "{entity_name} water changes", "weight": "{entity_name} weight changes" } }, diff --git a/homeassistant/components/sensor/translations/en.json b/homeassistant/components/sensor/translations/en.json index 1eeb31aa15c366..7fbb6e4a336442 100644 --- a/homeassistant/components/sensor/translations/en.json +++ b/homeassistant/components/sensor/translations/en.json @@ -32,6 +32,7 @@ "is_volatile_organic_compounds": "Current {entity_name} volatile organic compounds concentration level", "is_voltage": "Current {entity_name} voltage", "is_volume": "Current {entity_name} volume", + "is_water": "Current {entity_name} water", "is_weight": "Current {entity_name} weight" }, "trigger_type": { @@ -66,6 +67,7 @@ "volatile_organic_compounds": "{entity_name} volatile organic compounds concentration changes", "voltage": "{entity_name} voltage changes", "volume": "{entity_name} volume changes", + "water": "{entity_name} water changes", "weight": "{entity_name} weight changes" } },