Use UnitOfElectricCurrent in integrations (#84231)
This commit is contained in:
parent
026f660889
commit
418be1eeb6
7 changed files with 17 additions and 17 deletions
|
@ -23,13 +23,13 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import (
|
||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
ELECTRIC_CURRENT_AMPERE,
|
||||
LIGHT_LUX,
|
||||
PERCENTAGE,
|
||||
PRESSURE_HPA,
|
||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||
TEMP_CELSIUS,
|
||||
Platform,
|
||||
UnitOfElectricCurrent,
|
||||
UnitOfElectricPotential,
|
||||
UnitOfEnergy,
|
||||
UnitOfPower,
|
||||
|
@ -153,14 +153,14 @@ SIMPLE_SENSOR: dict[str, HomeKitSensorEntityDescription] = {
|
|||
name="Current",
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
),
|
||||
CharacteristicsTypes.VENDOR_CONNECTSENSE_ENERGY_AMPS_20: HomeKitSensorEntityDescription(
|
||||
key=CharacteristicsTypes.VENDOR_CONNECTSENSE_ENERGY_AMPS_20,
|
||||
name="Current",
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
),
|
||||
CharacteristicsTypes.VENDOR_CONNECTSENSE_ENERGY_KW_HOUR: HomeKitSensorEntityDescription(
|
||||
key=CharacteristicsTypes.VENDOR_CONNECTSENSE_ENERGY_KW_HOUR,
|
||||
|
@ -195,7 +195,7 @@ SIMPLE_SENSOR: dict[str, HomeKitSensorEntityDescription] = {
|
|||
name="Amps",
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
),
|
||||
CharacteristicsTypes.VENDOR_KOOGEEK_REALTIME_ENERGY: HomeKitSensorEntityDescription(
|
||||
key=CharacteristicsTypes.VENDOR_KOOGEEK_REALTIME_ENERGY,
|
||||
|
|
|
@ -17,11 +17,11 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import (
|
||||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
DEGREE,
|
||||
ELECTRIC_CURRENT_AMPERE,
|
||||
LIGHT_LUX,
|
||||
PERCENTAGE,
|
||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||
TEMP_CELSIUS,
|
||||
UnitOfElectricCurrent,
|
||||
UnitOfElectricPotential,
|
||||
UnitOfEnergy,
|
||||
UnitOfPower,
|
||||
|
@ -89,7 +89,7 @@ SENSORS: Final = {
|
|||
("emeter", "current"): BlockSensorDescription(
|
||||
key="emeter|current",
|
||||
name="Current",
|
||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
value=lambda value: value,
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
|
|
@ -16,9 +16,9 @@ from homeassistant.components.sensor import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ELECTRIC_CURRENT_AMPERE,
|
||||
PERCENTAGE,
|
||||
TEMP_CELSIUS,
|
||||
UnitOfElectricCurrent,
|
||||
UnitOfElectricPotential,
|
||||
UnitOfEnergy,
|
||||
UnitOfFrequency,
|
||||
|
@ -64,7 +64,7 @@ SENSOR_DESCRIPTIONS: dict[tuple[Units, bool], SensorEntityDescription] = {
|
|||
(Units.A, False): SensorEntityDescription(
|
||||
key=f"{Units.A}_{False}",
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
(Units.W, False): SensorEntityDescription(
|
||||
|
|
|
@ -19,7 +19,6 @@ from homeassistant.const import (
|
|||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
CONCENTRATION_PARTS_PER_BILLION,
|
||||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
ELECTRIC_CURRENT_AMPERE,
|
||||
LIGHT_LUX,
|
||||
PERCENTAGE,
|
||||
PRESSURE_HPA,
|
||||
|
@ -32,6 +31,7 @@ from homeassistant.const import (
|
|||
TEMP_FAHRENHEIT,
|
||||
TEMP_KELVIN,
|
||||
UnitOfApparentPower,
|
||||
UnitOfElectricCurrent,
|
||||
UnitOfElectricPotential,
|
||||
UnitOfEnergy,
|
||||
UnitOfFrequency,
|
||||
|
@ -213,7 +213,7 @@ SENSOR_UNIT_MAP = {
|
|||
hc.CONCENTRATION_MICROGRAMS_PER_CUBIC_METER: CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
hc.CONCENTRATION_PARTS_PER_BILLION: CONCENTRATION_PARTS_PER_BILLION,
|
||||
hc.CONCENTRATION_PARTS_PER_MILLION: CONCENTRATION_PARTS_PER_MILLION,
|
||||
hc.ELECTRICAL_CURRENT_AMPERE: ELECTRIC_CURRENT_AMPERE,
|
||||
hc.ELECTRICAL_CURRENT_AMPERE: UnitOfElectricCurrent.AMPERE,
|
||||
hc.ELECTRICAL_VOLT_AMPERE: UnitOfApparentPower.VOLT_AMPERE,
|
||||
hc.ENERGY_KILO_WATT_HOUR: UnitOfEnergy.KILO_WATT_HOUR,
|
||||
hc.FREQUENCY_HERTZ: UnitOfFrequency.HERTZ,
|
||||
|
|
|
@ -15,7 +15,7 @@ from homeassistant.components.sensor import (
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ATTR_VOLTAGE,
|
||||
ELECTRIC_CURRENT_AMPERE,
|
||||
UnitOfElectricCurrent,
|
||||
UnitOfElectricPotential,
|
||||
UnitOfEnergy,
|
||||
UnitOfPower,
|
||||
|
@ -81,7 +81,7 @@ ENERGY_SENSORS: tuple[TPLinkSensorEntityDescription, ...] = (
|
|||
),
|
||||
TPLinkSensorEntityDescription(
|
||||
key=ATTR_CURRENT_A,
|
||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
name="Current",
|
||||
|
|
|
@ -13,8 +13,8 @@ from homeassistant.components.sensor import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ELECTRIC_CURRENT_AMPERE,
|
||||
PERCENTAGE,
|
||||
UnitOfElectricCurrent,
|
||||
UnitOfEnergy,
|
||||
UnitOfLength,
|
||||
UnitOfPower,
|
||||
|
@ -70,7 +70,7 @@ SENSOR_TYPES: dict[str, WallboxSensorEntityDescription] = {
|
|||
key=CHARGER_MAX_AVAILABLE_POWER_KEY,
|
||||
name="Max Available Power",
|
||||
precision=0,
|
||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
|
@ -146,7 +146,7 @@ SENSOR_TYPES: dict[str, WallboxSensorEntityDescription] = {
|
|||
CHARGER_MAX_CHARGING_CURRENT_KEY: WallboxSensorEntityDescription(
|
||||
key=CHARGER_MAX_CHARGING_CURRENT_KEY,
|
||||
name="Max. Charging Current",
|
||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
|
|
|
@ -14,11 +14,11 @@ from homeassistant.components.sensor import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ELECTRIC_CURRENT_AMPERE,
|
||||
LIGHT_LUX,
|
||||
PERCENTAGE,
|
||||
PRESSURE_KPA,
|
||||
TEMP_CELSIUS,
|
||||
UnitOfElectricCurrent,
|
||||
UnitOfElectricPotential,
|
||||
UnitOfEnergy,
|
||||
UnitOfPower,
|
||||
|
@ -72,7 +72,7 @@ SENSORS_MAP: dict[str, ZWaveMeSensorEntityDescription] = {
|
|||
"meterElectric_ampere": ZWaveMeSensorEntityDescription(
|
||||
key="meterElectric_ampere",
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
"meterElectric_kilowatt_hour": ZWaveMeSensorEntityDescription(
|
||||
|
|
Loading…
Add table
Reference in a new issue