From 138aaebc73e3c5167eb2ad7d36e72755db3185ed Mon Sep 17 00:00:00 2001 From: Augustas Cirba Date: Thu, 25 Jan 2024 20:49:42 +0200 Subject: [PATCH] Updating deprecated constants (#29) --- custom_components/eldes_alarm/alarm_control_panel.py | 11 +++++------ custom_components/eldes_alarm/sensor.py | 7 +++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/custom_components/eldes_alarm/alarm_control_panel.py b/custom_components/eldes_alarm/alarm_control_panel.py index 38ef679..ad4626e 100644 --- a/custom_components/eldes_alarm/alarm_control_panel.py +++ b/custom_components/eldes_alarm/alarm_control_panel.py @@ -1,13 +1,12 @@ """Interfaces with Eldes control panels.""" import logging -from homeassistant.components.alarm_control_panel import AlarmControlPanelEntity +from homeassistant.components.alarm_control_panel import ( + AlarmControlPanelEntity, + AlarmControlPanelEntityFeature +) from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback -from homeassistant.components.alarm_control_panel.const import ( - SUPPORT_ALARM_ARM_AWAY, - SUPPORT_ALARM_ARM_HOME -) from homeassistant.const import ( STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, @@ -71,7 +70,7 @@ def extra_state_attributes(self): @property def supported_features(self): """Return the list of supported features.""" - return SUPPORT_ALARM_ARM_AWAY | SUPPORT_ALARM_ARM_HOME + return AlarmControlPanelEntityFeature.ARM_AWAY | AlarmControlPanelEntityFeature.ARM_HOME async def async_alarm_disarm(self, code=None): """Send disarm command.""" diff --git a/custom_components/eldes_alarm/sensor.py b/custom_components/eldes_alarm/sensor.py index e9de0a7..0923aa0 100644 --- a/custom_components/eldes_alarm/sensor.py +++ b/custom_components/eldes_alarm/sensor.py @@ -5,7 +5,10 @@ from homeassistant.components.sensor import SensorEntity, SensorDeviceClass from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback -from homeassistant.const import PERCENTAGE, TEMP_CELSIUS +from homeassistant.const import ( + PERCENTAGE, + UnitOfTemperature +) from .const import ( DATA_CLIENT, @@ -141,7 +144,7 @@ def device_class(self): @property def native_unit_of_measurement(self): """Return the unit of measurement.""" - return TEMP_CELSIUS + return UnitOfTemperature.CELSIUS @property def native_value(self):