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

Update deprecated constants in const.py #20

Merged
merged 1 commit into from
Dec 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 33 additions & 35 deletions custom_components/smartevse/const.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
"""Constants for the smartevse component."""
from __future__ import annotations
from homeassistant.const import TEMP_CELSIUS, ELECTRIC_CURRENT_AMPERE, ENERGY_KILO_WATT_HOUR, POWER_KILO_WATT, TIME_MINUTES
from homeassistant.const import (
UnitOfElectricCurrent,
UnitOfEnergy,
UnitOfPower,
UnitOfTemperature,
UnitOfTime,
)

from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING,
SensorDeviceClass,
SensorStateClass,
)
from homeassistant.const import (
PERCENTAGE,
PRESSURE_BAR,
TEMP_CELSIUS,
VOLUME_CUBIC_METERS,
)

from .models import (
SmartEVSENumberEntityDescription,
Expand Down Expand Up @@ -105,7 +103,7 @@
key="smartevse_temp",
name="SmartEVSE Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
unit=TEMP_CELSIUS,
unit=UnitOfTemperature.CELSIUS,
),
SmartEVSESensorEntityDescription(
key="smartevse_access",
Expand Down Expand Up @@ -138,25 +136,25 @@
SmartEVSESensorEntityDescription(
key="smartevse_charge_current",
name="SmartEVSE Charge Current",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
key="smartevse_current_min",
name="SmartEVSE Current Min",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
key="smartevse_current_max",
name="SmartEVSE Current Max",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
key="smartevse_current_main",
name="SmartEVSE Current Main",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
Expand All @@ -166,7 +164,7 @@
SmartEVSESensorEntityDescription(
key="smartevse_home_battery_current",
name="SmartEVSE Home Battery Current",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
Expand All @@ -176,97 +174,97 @@
SmartEVSESensorEntityDescription(
key="smartevse_ev_import_active_energy",
name="SmartEVSE EV Import Active Energy",
unit=ENERGY_KILO_WATT_HOUR,
unit=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL
),
SmartEVSESensorEntityDescription(
key="smartevse_ev_export_active_energy",
name="SmartEVSE EV Export Active Energy",
unit=ENERGY_KILO_WATT_HOUR,
unit=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL
),
SmartEVSESensorEntityDescription(
key="smartevse_ev_import_active_power",
name="SmartEVSE EV Import Active Power",
unit=POWER_KILO_WATT,
unit=UnitOfPower.KILO_WATT,
device_class=SensorDeviceClass.POWER,
),
SmartEVSESensorEntityDescription(
key="smartevse_ev_total_kwh",
name="SmartEVSE EV Total kWh",
unit=ENERGY_KILO_WATT_HOUR,
unit=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING
state_class=SensorStateClass.TOTAL_INCREASING
),
SmartEVSESensorEntityDescription(
key="smartevse_ev_charged_kwh",
name="SmartEVSE EV Charged kWh",
unit=ENERGY_KILO_WATT_HOUR,
unit=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL
),
SmartEVSESensorEntityDescription(
key="smartevse_ev_total",
name="SmartEVSE EV Total",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
key="smartevse_ev_l1",
name="SmartEVSE EV L1",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
key="smartevse_ev_l2",
name="SmartEVSE EV L2",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
key="smartevse_ev_l3",
name="SmartEVSE EV L3",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
key="smartevse_mains_import_active_energy",
name="SmartEVSE Mains Import Active Energy",
unit=ENERGY_KILO_WATT_HOUR,
unit=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL
),
SmartEVSESensorEntityDescription(
key="smartevse_mains_export_active_energy",
name="SmartEVSE Mains Export Active Energy",
unit=ENERGY_KILO_WATT_HOUR,
unit=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL
),
SmartEVSESensorEntityDescription(
key="smartevse_total",
name="SmartEVSE Total Mains",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
key="smartevse_l1",
name="SmartEVSE Mains L1",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
key="smartevse_l2",
name="SmartEVSE Mains L2",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
key="smartevse_l3",
name="SmartEVSE Mains L3",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
Expand Down Expand Up @@ -312,7 +310,7 @@
SmartEVSENumberEntityDescription(
key="smartevse_override_current",
name="SmartEVSE Override Current",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
native_min_value=6,
native_max_value=16,
Expand All @@ -322,7 +320,7 @@
SmartEVSENumberEntityDescription(
key="smartevse_solar_max_import",
name="SmartEVSE Solar Max Import",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
native_min_value=0,
native_max_value=20,
Expand All @@ -332,7 +330,7 @@
SmartEVSENumberEntityDescription(
key="smartevse_solar_start_current",
name="SmartEVSE Solar Start Current",
unit=ELECTRIC_CURRENT_AMPERE,
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
native_min_value=0,
native_max_value=48,
Expand All @@ -342,7 +340,7 @@
SmartEVSENumberEntityDescription(
key="smartevse_solar_stop_time",
name="Solar Stop Time",
unit=TIME_MINUTES,
unit=UnitOfTime.MINUTES,
#device_class=SensorDeviceClass.TIME,
native_min_value=0,
native_max_value=60,
Expand Down
Loading