Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new WATER device class #80886

Merged
merged 1 commit into from Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions homeassistant/components/sensor/__init__.py
Expand Up @@ -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.

Expand Down Expand Up @@ -374,6 +382,7 @@ class SensorStateClass(StrEnum):
SensorDeviceClass.SPEED: SpeedConverter,
SensorDeviceClass.TEMPERATURE: TemperatureConverter,
SensorDeviceClass.VOLUME: VolumeConverter,
SensorDeviceClass.WATER: VolumeConverter,
SensorDeviceClass.WEIGHT: MassConverter,
}

Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/sensor/device_condition.py
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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}],
}
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/sensor/device_trigger.py
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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}],
}
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/sensor/strings.json
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
}
},
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/sensor/translations/en.json
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
}
},
Expand Down