diff --git a/homeassistant/components/daikin/sensor.py b/homeassistant/components/daikin/sensor.py index 773b0c045cf..5f66c84d40d 100644 --- a/homeassistant/components/daikin/sensor.py +++ b/homeassistant/components/daikin/sensor.py @@ -15,9 +15,9 @@ from homeassistant.components.sensor import ( from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( ENERGY_KILO_WATT_HOUR, - FREQUENCY_HERTZ, PERCENTAGE, TEMP_CELSIUS, + UnitOfFrequency, UnitOfPower, ) from homeassistant.core import HomeAssistant @@ -125,7 +125,7 @@ SENSOR_TYPES: tuple[DaikinSensorEntityDescription, ...] = ( icon="mdi:fan", device_class=SensorDeviceClass.FREQUENCY, state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=FREQUENCY_HERTZ, + native_unit_of_measurement=UnitOfFrequency.HERTZ, entity_registry_enabled_default=False, value_func=lambda device: device.compressor_frequency, ), diff --git a/homeassistant/components/devolo_home_network/device_tracker.py b/homeassistant/components/devolo_home_network/device_tracker.py index 26b30ec43d5..e465266a0e7 100644 --- a/homeassistant/components/devolo_home_network/device_tracker.py +++ b/homeassistant/components/devolo_home_network/device_tracker.py @@ -11,7 +11,7 @@ from homeassistant.components.device_tracker import ( SourceType, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import FREQUENCY_GIGAHERTZ, STATE_UNKNOWN +from homeassistant.const import STATE_UNKNOWN, UnitOfFrequency from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import entity_registry from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -119,7 +119,7 @@ class DevoloScannerEntity(CoordinatorEntity, ScannerEntity): if station: attrs["wifi"] = WIFI_APTYPE.get(station["vap_type"], STATE_UNKNOWN) attrs["band"] = ( - f"{WIFI_BANDS.get(station['band'])} {FREQUENCY_GIGAHERTZ}" + f"{WIFI_BANDS.get(station['band'])} {UnitOfFrequency.GIGAHERTZ}" if WIFI_BANDS.get(station["band"]) else STATE_UNKNOWN ) diff --git a/homeassistant/components/edl21/sensor.py b/homeassistant/components/edl21/sensor.py index fe4f88f92e9..cf6ad175c41 100644 --- a/homeassistant/components/edl21/sensor.py +++ b/homeassistant/components/edl21/sensor.py @@ -21,8 +21,8 @@ from homeassistant.const import ( ELECTRIC_POTENTIAL_VOLT, ENERGY_KILO_WATT_HOUR, ENERGY_WATT_HOUR, - FREQUENCY_HERTZ, UnitOfElectricCurrent, + UnitOfFrequency, UnitOfPower, ) from homeassistant.core import HomeAssistant, callback @@ -261,7 +261,7 @@ SENSOR_UNIT_MAPPING = { "A": UnitOfElectricCurrent.AMPERE, "V": ELECTRIC_POTENTIAL_VOLT, "°": DEGREE, - "Hz": FREQUENCY_HERTZ, + "Hz": UnitOfFrequency.HERTZ, } diff --git a/homeassistant/components/fronius/sensor.py b/homeassistant/components/fronius/sensor.py index c78cedb798f..0c30ef5ccc3 100644 --- a/homeassistant/components/fronius/sensor.py +++ b/homeassistant/components/fronius/sensor.py @@ -13,12 +13,12 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( ELECTRIC_POTENTIAL_VOLT, ENERGY_WATT_HOUR, - FREQUENCY_HERTZ, PERCENTAGE, POWER_VOLT_AMPERE_REACTIVE, TEMP_CELSIUS, UnitOfApparentPower, UnitOfElectricCurrent, + UnitOfFrequency, UnitOfPower, ) from homeassistant.core import HomeAssistant, callback @@ -101,7 +101,7 @@ INVERTER_ENTITY_DESCRIPTIONS: list[SensorEntityDescription] = [ SensorEntityDescription( key="frequency_ac", name="Frequency AC", - native_unit_of_measurement=FREQUENCY_HERTZ, + native_unit_of_measurement=UnitOfFrequency.HERTZ, device_class=SensorDeviceClass.FREQUENCY, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, @@ -285,7 +285,7 @@ METER_ENTITY_DESCRIPTIONS: list[SensorEntityDescription] = [ SensorEntityDescription( key="frequency_phase_average", name="Frequency phase average", - native_unit_of_measurement=FREQUENCY_HERTZ, + native_unit_of_measurement=UnitOfFrequency.HERTZ, device_class=SensorDeviceClass.FREQUENCY, state_class=SensorStateClass.MEASUREMENT, ), diff --git a/homeassistant/components/oncue/sensor.py b/homeassistant/components/oncue/sensor.py index 55023f2f637..0d39f23073b 100644 --- a/homeassistant/components/oncue/sensor.py +++ b/homeassistant/components/oncue/sensor.py @@ -13,12 +13,12 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( ELECTRIC_POTENTIAL_VOLT, ENERGY_KILO_WATT_HOUR, - FREQUENCY_HERTZ, PERCENTAGE, PRESSURE_PSI, TEMP_CELSIUS, TEMP_FAHRENHEIT, UnitOfElectricCurrent, + UnitOfFrequency, UnitOfPower, ) from homeassistant.core import HomeAssistant @@ -104,7 +104,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( ), SensorEntityDescription( key="GeneratorFrequency", - native_unit_of_measurement=FREQUENCY_HERTZ, + native_unit_of_measurement=UnitOfFrequency.HERTZ, device_class=SensorDeviceClass.FREQUENCY, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, diff --git a/homeassistant/components/powerwall/sensor.py b/homeassistant/components/powerwall/sensor.py index fd1fc68f5eb..8f0481977e3 100644 --- a/homeassistant/components/powerwall/sensor.py +++ b/homeassistant/components/powerwall/sensor.py @@ -16,9 +16,9 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( ELECTRIC_POTENTIAL_VOLT, ENERGY_KILO_WATT_HOUR, - FREQUENCY_HERTZ, PERCENTAGE, UnitOfElectricCurrent, + UnitOfFrequency, UnitOfPower, ) from homeassistant.core import HomeAssistant @@ -80,7 +80,7 @@ POWERWALL_INSTANT_SENSORS = ( name="Frequency Now", state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.FREQUENCY, - native_unit_of_measurement=FREQUENCY_HERTZ, + native_unit_of_measurement=UnitOfFrequency.HERTZ, entity_registry_enabled_default=False, value_fn=_get_meter_frequency, ), diff --git a/homeassistant/components/solax/sensor.py b/homeassistant/components/solax/sensor.py index 8a73f5f0776..60c018edf68 100644 --- a/homeassistant/components/solax/sensor.py +++ b/homeassistant/components/solax/sensor.py @@ -19,9 +19,9 @@ from homeassistant.const import ( ELECTRIC_CURRENT_AMPERE, ELECTRIC_POTENTIAL_VOLT, ENERGY_KILO_WATT_HOUR, - FREQUENCY_HERTZ, PERCENTAGE, TEMP_CELSIUS, + UnitOfFrequency, UnitOfPower, ) from homeassistant.core import HomeAssistant @@ -82,7 +82,7 @@ SENSOR_DESCRIPTIONS: dict[tuple[Units, bool], SensorEntityDescription] = { (Units.HZ, False): SensorEntityDescription( key=f"{Units.HZ}_{False}", device_class=SensorDeviceClass.FREQUENCY, - native_unit_of_measurement=FREQUENCY_HERTZ, + native_unit_of_measurement=UnitOfFrequency.HERTZ, state_class=SensorStateClass.MEASUREMENT, ), (Units.NONE, False): SensorEntityDescription( diff --git a/homeassistant/components/tasmota/sensor.py b/homeassistant/components/tasmota/sensor.py index 3dc67bec8b5..a2715e0b7ed 100644 --- a/homeassistant/components/tasmota/sensor.py +++ b/homeassistant/components/tasmota/sensor.py @@ -22,7 +22,6 @@ from homeassistant.const import ( ELECTRIC_CURRENT_AMPERE, ELECTRIC_POTENTIAL_VOLT, ENERGY_KILO_WATT_HOUR, - FREQUENCY_HERTZ, LENGTH_CENTIMETERS, LIGHT_LUX, MASS_KILOGRAMS, @@ -37,6 +36,7 @@ from homeassistant.const import ( TEMP_FAHRENHEIT, TEMP_KELVIN, UnitOfApparentPower, + UnitOfFrequency, UnitOfPower, ) from homeassistant.core import HomeAssistant, callback @@ -216,7 +216,7 @@ SENSOR_UNIT_MAP = { hc.ELECTRICAL_CURRENT_AMPERE: ELECTRIC_CURRENT_AMPERE, hc.ELECTRICAL_VOLT_AMPERE: UnitOfApparentPower.VOLT_AMPERE, hc.ENERGY_KILO_WATT_HOUR: ENERGY_KILO_WATT_HOUR, - hc.FREQUENCY_HERTZ: FREQUENCY_HERTZ, + hc.FREQUENCY_HERTZ: UnitOfFrequency.HERTZ, hc.LENGTH_CENTIMETERS: LENGTH_CENTIMETERS, hc.LIGHT_LUX: LIGHT_LUX, hc.MASS_KILOGRAMS: MASS_KILOGRAMS, diff --git a/homeassistant/components/zwave_js/discovery_data_template.py b/homeassistant/components/zwave_js/discovery_data_template.py index b68cc83199e..7e3ca61d057 100644 --- a/homeassistant/components/zwave_js/discovery_data_template.py +++ b/homeassistant/components/zwave_js/discovery_data_template.py @@ -94,8 +94,6 @@ from homeassistant.const import ( DEGREE, ELECTRIC_POTENTIAL_MILLIVOLT, ELECTRIC_POTENTIAL_VOLT, - FREQUENCY_HERTZ, - FREQUENCY_KILOHERTZ, LIGHT_LUX, PERCENTAGE, SIGNAL_STRENGTH_DECIBELS, @@ -105,6 +103,7 @@ from homeassistant.const import ( VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR, UnitOfElectricCurrent, UnitOfEnergy, + UnitOfFrequency, UnitOfIrradiance, UnitOfLength, UnitOfMass, @@ -186,11 +185,11 @@ MULTILEVEL_SENSOR_UNIT_MAP: dict[str, set[MultilevelSensorScaleType]] = { UnitOfTemperature.FAHRENHEIT: UNIT_FAHRENHEIT, UnitOfLength.FEET: UNIT_FEET, UnitOfVolume.GALLONS: UNIT_GALLONS, - FREQUENCY_HERTZ: UNIT_HERTZ, + UnitOfFrequency.HERTZ: UNIT_HERTZ, UnitOfPressure.INHG: UNIT_INCHES_OF_MERCURY, UnitOfVolumetricFlux.INCHES_PER_HOUR: UNIT_INCHES_PER_HOUR, UnitOfMass.KILOGRAMS: UNIT_KILOGRAM, - FREQUENCY_KILOHERTZ: UNIT_KILOHERTZ, + UnitOfFrequency.KILOHERTZ: UNIT_KILOHERTZ, UnitOfVolume.LITERS: UNIT_LITER, LIGHT_LUX: UNIT_LUX, UnitOfLength.METERS: UNIT_METER,