Skip to content

Commit 60562bf

Browse files
authored
Fix deprecated constants (#1032)
* Fix deprecated constants * Fix linting * Redo consts * fix linting
1 parent 5cc81ac commit 60562bf

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

custom_components/ocpp/api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from homeassistant.components.persistent_notification import DOMAIN as PN_DOMAIN
1313
from homeassistant.config_entries import ConfigEntry
14-
from homeassistant.const import STATE_OK, STATE_UNAVAILABLE, STATE_UNKNOWN, TIME_MINUTES
14+
from homeassistant.const import STATE_OK, STATE_UNAVAILABLE, STATE_UNKNOWN, UnitOfTime
1515
from homeassistant.core import HomeAssistant
1616
from homeassistant.helpers import device_registry, entity_component, entity_registry
1717
import homeassistant.helpers.config_validation as cv
@@ -111,6 +111,8 @@
111111
# logging.getLogger("asyncio").setLevel(logging.DEBUG)
112112
# logging.getLogger("websockets").setLevel(logging.DEBUG)
113113

114+
TIME_MINUTES = UnitOfTime.MINUTES
115+
114116
UFW_SERVICE_DATA_SCHEMA = vol.Schema(
115117
{
116118
vol.Required("firmware_url"): cv.string,

custom_components/ocpp/number.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
NumberEntityDescription,
1111
RestoreNumber,
1212
)
13-
from homeassistant.const import ELECTRIC_CURRENT_AMPERE
13+
from homeassistant.const import UnitOfElectricCurrent
1414
from homeassistant.core import HomeAssistant, callback
1515
from homeassistant.helpers.dispatcher import async_dispatcher_connect
1616
from homeassistant.helpers.entity import DeviceInfo
@@ -35,6 +35,8 @@ class OcppNumberDescription(NumberEntityDescription):
3535
initial_value: float | None = None
3636

3737

38+
ELECTRIC_CURRENT_AMPERE = UnitOfElectricCurrent.AMPERE
39+
3840
NUMBERS: Final = [
3941
OcppNumberDescription(
4042
key="maximum_current",

custom_components/ocpp/switch.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
SwitchEntity,
1010
SwitchEntityDescription,
1111
)
12-
from homeassistant.const import POWER_KILO_WATT
12+
from homeassistant.const import UnitOfPower
1313
from homeassistant.helpers.entity import DeviceInfo
1414

1515
from ocpp.v16.enums import ChargePointStatus, Measurand
@@ -33,6 +33,8 @@ class OcppSwitchDescription(SwitchEntityDescription):
3333
default_state: bool = False
3434

3535

36+
POWER_KILO_WATT = UnitOfPower.KILO_WATT
37+
3638
SWITCHES: Final = [
3739
OcppSwitchDescription(
3840
key="charge_control",

0 commit comments

Comments
 (0)