mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Use UnitOfPower in integrations [h-r] (#83815)
This commit is contained in:
parent
f24f0c2954
commit
3edb0969de
@ -8,7 +8,7 @@ from homeassistant.components.sensor import (
|
|||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import PERCENTAGE, POWER_WATT
|
from homeassistant.const import PERCENTAGE, UnitOfPower
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import EntityCategory
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -28,7 +28,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="Power",
|
key="Power",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
|
@ -28,11 +28,11 @@ from homeassistant.const import (
|
|||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_WATT,
|
|
||||||
PRESSURE_HPA,
|
PRESSURE_HPA,
|
||||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
Platform,
|
Platform,
|
||||||
|
UnitOfPower,
|
||||||
UnitOfSoundPressure,
|
UnitOfSoundPressure,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -146,7 +146,7 @@ SIMPLE_SENSOR: dict[str, HomeKitSensorEntityDescription] = {
|
|||||||
name="Power",
|
name="Power",
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.VENDOR_CONNECTSENSE_ENERGY_AMPS: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.VENDOR_CONNECTSENSE_ENERGY_AMPS: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.VENDOR_CONNECTSENSE_ENERGY_AMPS,
|
key=CharacteristicsTypes.VENDOR_CONNECTSENSE_ENERGY_AMPS,
|
||||||
@ -174,7 +174,7 @@ SIMPLE_SENSOR: dict[str, HomeKitSensorEntityDescription] = {
|
|||||||
name="Power",
|
name="Power",
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.VENDOR_EVE_ENERGY_KW_HOUR: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.VENDOR_EVE_ENERGY_KW_HOUR: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.VENDOR_EVE_ENERGY_KW_HOUR,
|
key=CharacteristicsTypes.VENDOR_EVE_ENERGY_KW_HOUR,
|
||||||
@ -202,14 +202,14 @@ SIMPLE_SENSOR: dict[str, HomeKitSensorEntityDescription] = {
|
|||||||
name="Power",
|
name="Power",
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.VENDOR_KOOGEEK_REALTIME_ENERGY_2: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.VENDOR_KOOGEEK_REALTIME_ENERGY_2: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.VENDOR_KOOGEEK_REALTIME_ENERGY_2,
|
key=CharacteristicsTypes.VENDOR_KOOGEEK_REALTIME_ENERGY_2,
|
||||||
name="Power",
|
name="Power",
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.VENDOR_EVE_DEGREE_AIR_PRESSURE: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.VENDOR_EVE_DEGREE_AIR_PRESSURE: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.VENDOR_EVE_DEGREE_AIR_PRESSURE,
|
key=CharacteristicsTypes.VENDOR_EVE_DEGREE_AIR_PRESSURE,
|
||||||
@ -223,7 +223,7 @@ SIMPLE_SENSOR: dict[str, HomeKitSensorEntityDescription] = {
|
|||||||
name="Power",
|
name="Power",
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
),
|
),
|
||||||
CharacteristicsTypes.TEMPERATURE_CURRENT: HomeKitSensorEntityDescription(
|
CharacteristicsTypes.TEMPERATURE_CURRENT: HomeKitSensorEntityDescription(
|
||||||
key=CharacteristicsTypes.TEMPERATURE_CURRENT,
|
key=CharacteristicsTypes.TEMPERATURE_CURRENT,
|
||||||
|
@ -21,10 +21,10 @@ from homeassistant.const import (
|
|||||||
FREQUENCY_HERTZ,
|
FREQUENCY_HERTZ,
|
||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_WATT,
|
|
||||||
PRESSURE_HPA,
|
PRESSURE_HPA,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
UnitOfElectricCurrent,
|
UnitOfElectricCurrent,
|
||||||
|
UnitOfPower,
|
||||||
UnitOfPrecipitationDepth,
|
UnitOfPrecipitationDepth,
|
||||||
UnitOfSpeed,
|
UnitOfSpeed,
|
||||||
UnitOfVolume,
|
UnitOfVolume,
|
||||||
@ -112,13 +112,13 @@ SENSOR_DESCRIPTIONS: dict[str, SensorEntityDescription] = {
|
|||||||
),
|
),
|
||||||
"POWER": SensorEntityDescription(
|
"POWER": SensorEntityDescription(
|
||||||
key="POWER",
|
key="POWER",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
"IEC_POWER": SensorEntityDescription(
|
"IEC_POWER": SensorEntityDescription(
|
||||||
key="IEC_POWER",
|
key="IEC_POWER",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
|
@ -14,7 +14,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_WATT,
|
UnitOfPower,
|
||||||
UnitOfVolume,
|
UnitOfVolume,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -87,28 +87,28 @@ SENSORS: Final[tuple[SensorEntityDescription, ...]] = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="active_power_w",
|
key="active_power_w",
|
||||||
name="Active power",
|
name="Active power",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="active_power_l1_w",
|
key="active_power_l1_w",
|
||||||
name="Active power L1",
|
name="Active power L1",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="active_power_l2_w",
|
key="active_power_l2_w",
|
||||||
name="Active power L2",
|
name="Active power L2",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="active_power_l3_w",
|
key="active_power_l3_w",
|
||||||
name="Active power L3",
|
name="Active power L3",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
|
@ -19,9 +19,9 @@ from homeassistant.const import (
|
|||||||
ENERGY_WATT_HOUR,
|
ENERGY_WATT_HOUR,
|
||||||
FREQUENCY_HERTZ,
|
FREQUENCY_HERTZ,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_WATT,
|
|
||||||
UnitOfApparentPower,
|
UnitOfApparentPower,
|
||||||
UnitOfElectricCurrent,
|
UnitOfElectricCurrent,
|
||||||
|
UnitOfPower,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import entity, entity_registry
|
from homeassistant.helpers import entity, entity_registry
|
||||||
@ -75,7 +75,7 @@ ENTITY_DESCRIPTION_KEY_MAP: dict[str, IotaWattSensorEntityDescription] = {
|
|||||||
),
|
),
|
||||||
"Watts": IotaWattSensorEntityDescription(
|
"Watts": IotaWattSensorEntityDescription(
|
||||||
"Watts",
|
"Watts",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
),
|
),
|
||||||
|
@ -11,10 +11,10 @@ from homeassistant.config_entries import ConfigEntry
|
|||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ELECTRIC_POTENTIAL_VOLT,
|
ELECTRIC_POTENTIAL_VOLT,
|
||||||
ENERGY_WATT_HOUR,
|
ENERGY_WATT_HOUR,
|
||||||
POWER_WATT,
|
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TIME_SECONDS,
|
TIME_SECONDS,
|
||||||
UnitOfElectricCurrent,
|
UnitOfElectricCurrent,
|
||||||
|
UnitOfPower,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -50,7 +50,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="watts",
|
key="watts",
|
||||||
name="Watts",
|
name="Watts",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
|
@ -9,8 +9,8 @@ from homeassistant.components.sensor import (
|
|||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
POWER_KILO_WATT,
|
|
||||||
UnitOfElectricCurrent,
|
UnitOfElectricCurrent,
|
||||||
|
UnitOfPower,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -58,7 +58,7 @@ async def async_setup_platform(
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="P",
|
key="P",
|
||||||
name="Charging Power",
|
name="Charging Power",
|
||||||
native_unit_of_measurement=POWER_KILO_WATT,
|
native_unit_of_measurement=UnitOfPower.KILO_WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
|
@ -15,7 +15,7 @@ from homeassistant.components.number import (
|
|||||||
NumberMode,
|
NumberMode,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import PERCENTAGE, POWER_WATT
|
from homeassistant.const import PERCENTAGE, UnitOfPower
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
|
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -66,7 +66,7 @@ NUMBER_SETTINGS_DATA = [
|
|||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
name="Battery min Home Consumption",
|
name="Battery min Home Consumption",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
native_max_value=38000,
|
native_max_value=38000,
|
||||||
native_min_value=50,
|
native_min_value=50,
|
||||||
native_step=1,
|
native_step=1,
|
||||||
|
@ -18,8 +18,8 @@ from homeassistant.const import (
|
|||||||
ELECTRIC_POTENTIAL_VOLT,
|
ELECTRIC_POTENTIAL_VOLT,
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_WATT,
|
|
||||||
UnitOfElectricCurrent,
|
UnitOfElectricCurrent,
|
||||||
|
UnitOfPower,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
@ -59,7 +59,7 @@ SENSOR_PROCESS_DATA = [
|
|||||||
module_id="devices:local",
|
module_id="devices:local",
|
||||||
key="Dc_P",
|
key="Dc_P",
|
||||||
name="Solar Power",
|
name="Solar Power",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
entity_registry_enabled_default=True,
|
entity_registry_enabled_default=True,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
@ -69,7 +69,7 @@ SENSOR_PROCESS_DATA = [
|
|||||||
module_id="devices:local",
|
module_id="devices:local",
|
||||||
key="Grid_P",
|
key="Grid_P",
|
||||||
name="Grid Power",
|
name="Grid Power",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
entity_registry_enabled_default=True,
|
entity_registry_enabled_default=True,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
@ -79,7 +79,7 @@ SENSOR_PROCESS_DATA = [
|
|||||||
module_id="devices:local",
|
module_id="devices:local",
|
||||||
key="HomeBat_P",
|
key="HomeBat_P",
|
||||||
name="Home Power from Battery",
|
name="Home Power from Battery",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
formatter="format_round",
|
formatter="format_round",
|
||||||
),
|
),
|
||||||
@ -87,7 +87,7 @@ SENSOR_PROCESS_DATA = [
|
|||||||
module_id="devices:local",
|
module_id="devices:local",
|
||||||
key="HomeGrid_P",
|
key="HomeGrid_P",
|
||||||
name="Home Power from Grid",
|
name="Home Power from Grid",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
formatter="format_round",
|
formatter="format_round",
|
||||||
@ -96,7 +96,7 @@ SENSOR_PROCESS_DATA = [
|
|||||||
module_id="devices:local",
|
module_id="devices:local",
|
||||||
key="HomeOwn_P",
|
key="HomeOwn_P",
|
||||||
name="Home Power from Own",
|
name="Home Power from Own",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
formatter="format_round",
|
formatter="format_round",
|
||||||
@ -105,7 +105,7 @@ SENSOR_PROCESS_DATA = [
|
|||||||
module_id="devices:local",
|
module_id="devices:local",
|
||||||
key="HomePv_P",
|
key="HomePv_P",
|
||||||
name="Home Power from PV",
|
name="Home Power from PV",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
formatter="format_round",
|
formatter="format_round",
|
||||||
@ -114,7 +114,7 @@ SENSOR_PROCESS_DATA = [
|
|||||||
module_id="devices:local",
|
module_id="devices:local",
|
||||||
key="Home_P",
|
key="Home_P",
|
||||||
name="Home Power",
|
name="Home Power",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
formatter="format_round",
|
formatter="format_round",
|
||||||
@ -123,7 +123,7 @@ SENSOR_PROCESS_DATA = [
|
|||||||
module_id="devices:local:ac",
|
module_id="devices:local:ac",
|
||||||
key="P",
|
key="P",
|
||||||
name="AC Power",
|
name="AC Power",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
entity_registry_enabled_default=True,
|
entity_registry_enabled_default=True,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
@ -133,7 +133,7 @@ SENSOR_PROCESS_DATA = [
|
|||||||
module_id="devices:local:pv1",
|
module_id="devices:local:pv1",
|
||||||
key="P",
|
key="P",
|
||||||
name="DC1 Power",
|
name="DC1 Power",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
formatter="format_round",
|
formatter="format_round",
|
||||||
@ -160,7 +160,7 @@ SENSOR_PROCESS_DATA = [
|
|||||||
module_id="devices:local:pv2",
|
module_id="devices:local:pv2",
|
||||||
key="P",
|
key="P",
|
||||||
name="DC2 Power",
|
name="DC2 Power",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
formatter="format_round",
|
formatter="format_round",
|
||||||
@ -187,7 +187,7 @@ SENSOR_PROCESS_DATA = [
|
|||||||
module_id="devices:local:pv3",
|
module_id="devices:local:pv3",
|
||||||
key="P",
|
key="P",
|
||||||
name="DC3 Power",
|
name="DC3 Power",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
formatter="format_round",
|
formatter="format_round",
|
||||||
@ -214,7 +214,7 @@ SENSOR_PROCESS_DATA = [
|
|||||||
module_id="devices:local",
|
module_id="devices:local",
|
||||||
key="PV2Bat_P",
|
key="PV2Bat_P",
|
||||||
name="PV to Battery Power",
|
name="PV to Battery Power",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
formatter="format_round",
|
formatter="format_round",
|
||||||
@ -238,7 +238,7 @@ SENSOR_PROCESS_DATA = [
|
|||||||
module_id="devices:local:battery",
|
module_id="devices:local:battery",
|
||||||
key="P",
|
key="P",
|
||||||
name="Battery Power",
|
name="Battery Power",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
formatter="format_round",
|
formatter="format_round",
|
||||||
|
@ -7,12 +7,12 @@ from homeassistant.components.sensor import (
|
|||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ENERGY_MEGA_WATT_HOUR,
|
ENERGY_MEGA_WATT_HOUR,
|
||||||
POWER_KILO_WATT,
|
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TIME_HOURS,
|
TIME_HOURS,
|
||||||
TIME_MINUTES,
|
TIME_MINUTES,
|
||||||
VOLUME_CUBIC_METERS,
|
VOLUME_CUBIC_METERS,
|
||||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||||
|
UnitOfPower,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import EntityCategory
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
|
|
||||||
@ -97,14 +97,14 @@ HEAT_METER_SENSOR_TYPES = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="power_max_kw",
|
key="power_max_kw",
|
||||||
name="Power max",
|
name="Power max",
|
||||||
native_unit_of_measurement=POWER_KILO_WATT,
|
native_unit_of_measurement=UnitOfPower.KILO_WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="power_max_previous_year_kw",
|
key="power_max_previous_year_kw",
|
||||||
name="Power max previous year",
|
name="Power max previous year",
|
||||||
native_unit_of_measurement=POWER_KILO_WATT,
|
native_unit_of_measurement=UnitOfPower.KILO_WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
|
@ -17,8 +17,8 @@ from homeassistant.const import (
|
|||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_WATT,
|
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
|
UnitOfPower,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||||
@ -105,7 +105,7 @@ LOCAL_SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="current_power",
|
key="current_power",
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
name="Current power",
|
name="Current power",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
|
@ -14,7 +14,7 @@ from homeassistant.components.sensor import (
|
|||||||
SensorEntity,
|
SensorEntity,
|
||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_API_KEY, ENERGY_KILO_WATT_HOUR, POWER_WATT
|
from homeassistant.const import CONF_API_KEY, ENERGY_KILO_WATT_HOUR, UnitOfPower
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -149,7 +149,7 @@ class NeurioEnergy(SensorEntity):
|
|||||||
self._state = None
|
self._state = None
|
||||||
|
|
||||||
if sensor_type == ACTIVE_TYPE:
|
if sensor_type == ACTIVE_TYPE:
|
||||||
self._unit_of_measurement = POWER_WATT
|
self._unit_of_measurement = UnitOfPower.WATT
|
||||||
self._attr_device_class = SensorDeviceClass.POWER
|
self._attr_device_class = SensorDeviceClass.POWER
|
||||||
self._attr_state_class = SensorStateClass.MEASUREMENT
|
self._attr_state_class = SensorStateClass.MEASUREMENT
|
||||||
elif sensor_type == DAILY_TYPE:
|
elif sensor_type == DAILY_TYPE:
|
||||||
|
@ -15,11 +15,11 @@ from homeassistant.const import (
|
|||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
FREQUENCY_HERTZ,
|
FREQUENCY_HERTZ,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_WATT,
|
|
||||||
PRESSURE_PSI,
|
PRESSURE_PSI,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
UnitOfElectricCurrent,
|
UnitOfElectricCurrent,
|
||||||
|
UnitOfPower,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import EntityCategory
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
@ -85,7 +85,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="GeneratorTrueTotalPower",
|
key="GeneratorTrueTotalPower",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
|
@ -16,8 +16,8 @@ from homeassistant.const import (
|
|||||||
CURRENCY_EURO,
|
CURRENCY_EURO,
|
||||||
ELECTRIC_POTENTIAL_VOLT,
|
ELECTRIC_POTENTIAL_VOLT,
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
POWER_WATT,
|
|
||||||
UnitOfElectricCurrent,
|
UnitOfElectricCurrent,
|
||||||
|
UnitOfPower,
|
||||||
UnitOfVolume,
|
UnitOfVolume,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -48,7 +48,7 @@ SENSORS_SMARTMETER: tuple[SensorEntityDescription, ...] = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="power_consumption",
|
key="power_consumption",
|
||||||
name="Power Consumption",
|
name="Power Consumption",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
@ -69,7 +69,7 @@ SENSORS_SMARTMETER: tuple[SensorEntityDescription, ...] = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="power_production",
|
key="power_production",
|
||||||
name="Power Production",
|
name="Power Production",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
@ -140,42 +140,42 @@ SENSORS_PHASES: tuple[SensorEntityDescription, ...] = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="power_consumed_phase_l1",
|
key="power_consumed_phase_l1",
|
||||||
name="Power Consumed Phase L1",
|
name="Power Consumed Phase L1",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="power_consumed_phase_l2",
|
key="power_consumed_phase_l2",
|
||||||
name="Power Consumed Phase L2",
|
name="Power Consumed Phase L2",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="power_consumed_phase_l3",
|
key="power_consumed_phase_l3",
|
||||||
name="Power Consumed Phase L3",
|
name="Power Consumed Phase L3",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="power_produced_phase_l1",
|
key="power_produced_phase_l1",
|
||||||
name="Power Produced Phase L1",
|
name="Power Produced Phase L1",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="power_produced_phase_l2",
|
key="power_produced_phase_l2",
|
||||||
name="Power Produced Phase L2",
|
name="Power Produced Phase L2",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="power_produced_phase_l3",
|
key="power_produced_phase_l3",
|
||||||
name="Power Produced Phase L3",
|
name="Power Produced Phase L3",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
|
@ -12,9 +12,9 @@ from homeassistant.const import (
|
|||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
ENERGY_WATT_HOUR,
|
ENERGY_WATT_HOUR,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_WATT,
|
|
||||||
PRESSURE_BAR,
|
PRESSURE_BAR,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
|
UnitOfPower,
|
||||||
UnitOfVolume,
|
UnitOfVolume,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -108,14 +108,14 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="electricity_consumed",
|
key="electricity_consumed",
|
||||||
name="Electricity consumed",
|
name="Electricity consumed",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="electricity_produced",
|
key="electricity_produced",
|
||||||
name="Electricity produced",
|
name="Electricity produced",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
@ -166,14 +166,14 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="electricity_consumed_off_peak_point",
|
key="electricity_consumed_off_peak_point",
|
||||||
name="Electricity consumed off peak point",
|
name="Electricity consumed off peak point",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="electricity_consumed_peak_point",
|
key="electricity_consumed_peak_point",
|
||||||
name="Electricity consumed peak point",
|
name="Electricity consumed peak point",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
@ -194,14 +194,14 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="electricity_produced_off_peak_point",
|
key="electricity_produced_off_peak_point",
|
||||||
name="Electricity produced off peak point",
|
name="Electricity produced off peak point",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="electricity_produced_peak_point",
|
key="electricity_produced_peak_point",
|
||||||
name="Electricity produced peak point",
|
name="Electricity produced peak point",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
@ -236,7 +236,7 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="net_electricity_point",
|
key="net_electricity_point",
|
||||||
name="Net electricity point",
|
name="Net electricity point",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
|
@ -18,8 +18,8 @@ from homeassistant.const import (
|
|||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
FREQUENCY_HERTZ,
|
FREQUENCY_HERTZ,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_KILO_WATT,
|
|
||||||
UnitOfElectricCurrent,
|
UnitOfElectricCurrent,
|
||||||
|
UnitOfPower,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -72,7 +72,7 @@ POWERWALL_INSTANT_SENSORS = (
|
|||||||
name="Now",
|
name="Now",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
native_unit_of_measurement=POWER_KILO_WATT,
|
native_unit_of_measurement=UnitOfPower.KILO_WATT,
|
||||||
value_fn=_get_meter_power,
|
value_fn=_get_meter_power,
|
||||||
),
|
),
|
||||||
PowerwallSensorEntityDescription(
|
PowerwallSensorEntityDescription(
|
||||||
|
@ -12,7 +12,7 @@ from homeassistant.components.sensor import (
|
|||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_HOST, ENERGY_KILO_WATT_HOUR, POWER_WATT
|
from homeassistant.const import CONF_HOST, ENERGY_KILO_WATT_HOUR, UnitOfPower
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -40,7 +40,7 @@ SENSORS: tuple[PureEnergieSensorEntityDescription, ...] = (
|
|||||||
PureEnergieSensorEntityDescription(
|
PureEnergieSensorEntityDescription(
|
||||||
key="power_flow",
|
key="power_flow",
|
||||||
name="Power Flow",
|
name="Power Flow",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
value_fn=lambda data: data.smartbridge.power_flow,
|
value_fn=lambda data: data.smartbridge.power_flow,
|
||||||
|
@ -17,9 +17,8 @@ from homeassistant.const import (
|
|||||||
ELECTRIC_POTENTIAL_VOLT,
|
ELECTRIC_POTENTIAL_VOLT,
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
ENERGY_WATT_HOUR,
|
ENERGY_WATT_HOUR,
|
||||||
POWER_KILO_WATT,
|
|
||||||
POWER_WATT,
|
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
|
UnitOfPower,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
@ -64,14 +63,14 @@ SENSORS: tuple[PVOutputSensorEntityDescription, ...] = (
|
|||||||
PVOutputSensorEntityDescription(
|
PVOutputSensorEntityDescription(
|
||||||
key="normalized_output",
|
key="normalized_output",
|
||||||
name="Efficiency",
|
name="Efficiency",
|
||||||
native_unit_of_measurement=f"{ENERGY_KILO_WATT_HOUR}/{POWER_KILO_WATT}",
|
native_unit_of_measurement=f"{ENERGY_KILO_WATT_HOUR}/{UnitOfPower.KILO_WATT}",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
value_fn=lambda status: status.normalized_output,
|
value_fn=lambda status: status.normalized_output,
|
||||||
),
|
),
|
||||||
PVOutputSensorEntityDescription(
|
PVOutputSensorEntityDescription(
|
||||||
key="power_consumption",
|
key="power_consumption",
|
||||||
name="Power consumed",
|
name="Power consumed",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
value_fn=lambda status: status.power_consumption,
|
value_fn=lambda status: status.power_consumption,
|
||||||
@ -79,7 +78,7 @@ SENSORS: tuple[PVOutputSensorEntityDescription, ...] = (
|
|||||||
PVOutputSensorEntityDescription(
|
PVOutputSensorEntityDescription(
|
||||||
key="power_generation",
|
key="power_generation",
|
||||||
name="Power generated",
|
name="Power generated",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
value_fn=lambda status: status.power_generation,
|
value_fn=lambda status: status.power_generation,
|
||||||
|
@ -8,7 +8,7 @@ from homeassistant.components.sensor import (
|
|||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ENERGY_KILO_WATT_HOUR, POWER_KILO_WATT
|
from homeassistant.const import ENERGY_KILO_WATT_HOUR, UnitOfPower
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -23,7 +23,7 @@ SENSORS = (
|
|||||||
key="zigbee:InstantaneousDemand",
|
key="zigbee:InstantaneousDemand",
|
||||||
# We can drop the "Eagle-200" part of the name in HA 2021.12
|
# We can drop the "Eagle-200" part of the name in HA 2021.12
|
||||||
name="Eagle-200 Meter Power Demand",
|
name="Eagle-200 Meter Power Demand",
|
||||||
native_unit_of_measurement=POWER_KILO_WATT,
|
native_unit_of_measurement=UnitOfPower.KILO_WATT,
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
|
@ -26,9 +26,9 @@ from homeassistant.const import (
|
|||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
LENGTH_KILOMETERS,
|
LENGTH_KILOMETERS,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_KILO_WATT,
|
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TIME_MINUTES,
|
TIME_MINUTES,
|
||||||
|
UnitOfPower,
|
||||||
UnitOfVolume,
|
UnitOfVolume,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -209,7 +209,7 @@ SENSOR_TYPES: tuple[RenaultSensorEntityDescription[Any], ...] = (
|
|||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
entity_class=RenaultSensor[KamereonVehicleBatteryStatusData],
|
entity_class=RenaultSensor[KamereonVehicleBatteryStatusData],
|
||||||
name="Admissible charging power",
|
name="Admissible charging power",
|
||||||
native_unit_of_measurement=POWER_KILO_WATT,
|
native_unit_of_measurement=UnitOfPower.KILO_WATT,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
RenaultSensorEntityDescription(
|
RenaultSensorEntityDescription(
|
||||||
@ -222,7 +222,7 @@ SENSOR_TYPES: tuple[RenaultSensorEntityDescription[Any], ...] = (
|
|||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
entity_class=RenaultSensor[KamereonVehicleBatteryStatusData],
|
entity_class=RenaultSensor[KamereonVehicleBatteryStatusData],
|
||||||
name="Charging power",
|
name="Charging power",
|
||||||
native_unit_of_measurement=POWER_KILO_WATT,
|
native_unit_of_measurement=UnitOfPower.KILO_WATT,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
value_lambda=_get_charging_power,
|
value_lambda=_get_charging_power,
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user