diff --git a/homeassistant/components/homematicip_cloud/binary_sensor.py b/homeassistant/components/homematicip_cloud/binary_sensor.py index 0cc462ac1f4..0d00d5139b3 100644 --- a/homeassistant/components/homematicip_cloud/binary_sensor.py +++ b/homeassistant/components/homematicip_cloud/binary_sensor.py @@ -30,17 +30,7 @@ from homematicip.aio.group import AsyncSecurityGroup, AsyncSecurityZoneGroup from homematicip.base.enums import SmokeDetectorAlarmType, WindowState from homeassistant.components.binary_sensor import ( - DEVICE_CLASS_BATTERY, - DEVICE_CLASS_DOOR, - DEVICE_CLASS_LIGHT, - DEVICE_CLASS_MOISTURE, - DEVICE_CLASS_MOTION, - DEVICE_CLASS_MOVING, - DEVICE_CLASS_OPENING, - DEVICE_CLASS_POWER, - DEVICE_CLASS_PRESENCE, - DEVICE_CLASS_SAFETY, - DEVICE_CLASS_SMOKE, + BinarySensorDeviceClass, BinarySensorEntity, ) from homeassistant.config_entries import ConfigEntry @@ -205,7 +195,7 @@ class HomematicipBaseActionSensor(HomematicipGenericEntity, BinarySensorEntity): @property def device_class(self) -> str: """Return the class of this sensor.""" - return DEVICE_CLASS_MOVING + return BinarySensorDeviceClass.MOVING @property def is_on(self) -> bool: @@ -250,7 +240,7 @@ class HomematicipMultiContactInterface(HomematicipGenericEntity, BinarySensorEnt @property def device_class(self) -> str: """Return the class of this sensor.""" - return DEVICE_CLASS_OPENING + return BinarySensorDeviceClass.OPENING @property def is_on(self) -> bool | None: @@ -284,7 +274,7 @@ class HomematicipShutterContact(HomematicipMultiContactInterface, BinarySensorEn @property def device_class(self) -> str: """Return the class of this sensor.""" - return DEVICE_CLASS_DOOR + return BinarySensorDeviceClass.DOOR @property def extra_state_attributes(self) -> dict[str, Any]: @@ -305,7 +295,7 @@ class HomematicipMotionDetector(HomematicipGenericEntity, BinarySensorEntity): @property def device_class(self) -> str: """Return the class of this sensor.""" - return DEVICE_CLASS_MOTION + return BinarySensorDeviceClass.MOTION @property def is_on(self) -> bool: @@ -319,7 +309,7 @@ class HomematicipPresenceDetector(HomematicipGenericEntity, BinarySensorEntity): @property def device_class(self) -> str: """Return the class of this sensor.""" - return DEVICE_CLASS_PRESENCE + return BinarySensorDeviceClass.PRESENCE @property def is_on(self) -> bool: @@ -333,7 +323,7 @@ class HomematicipSmokeDetector(HomematicipGenericEntity, BinarySensorEntity): @property def device_class(self) -> str: """Return the class of this sensor.""" - return DEVICE_CLASS_SMOKE + return BinarySensorDeviceClass.SMOKE @property def is_on(self) -> bool: @@ -352,7 +342,7 @@ class HomematicipWaterDetector(HomematicipGenericEntity, BinarySensorEntity): @property def device_class(self) -> str: """Return the class of this sensor.""" - return DEVICE_CLASS_MOISTURE + return BinarySensorDeviceClass.MOISTURE @property def is_on(self) -> bool: @@ -388,7 +378,7 @@ class HomematicipRainSensor(HomematicipGenericEntity, BinarySensorEntity): @property def device_class(self) -> str: """Return the class of this sensor.""" - return DEVICE_CLASS_MOISTURE + return BinarySensorDeviceClass.MOISTURE @property def is_on(self) -> bool: @@ -406,7 +396,7 @@ class HomematicipSunshineSensor(HomematicipGenericEntity, BinarySensorEntity): @property def device_class(self) -> str: """Return the class of this sensor.""" - return DEVICE_CLASS_LIGHT + return BinarySensorDeviceClass.LIGHT @property def is_on(self) -> bool: @@ -435,7 +425,7 @@ class HomematicipBatterySensor(HomematicipGenericEntity, BinarySensorEntity): @property def device_class(self) -> str: """Return the class of this sensor.""" - return DEVICE_CLASS_BATTERY + return BinarySensorDeviceClass.BATTERY @property def is_on(self) -> bool: @@ -455,7 +445,7 @@ class HomematicipPluggableMainsFailureSurveillanceSensor( @property def device_class(self) -> str: """Return the class of this sensor.""" - return DEVICE_CLASS_POWER + return BinarySensorDeviceClass.POWER @property def is_on(self) -> bool: @@ -474,7 +464,7 @@ class HomematicipSecurityZoneSensorGroup(HomematicipGenericEntity, BinarySensorE @property def device_class(self) -> str: """Return the class of this sensor.""" - return DEVICE_CLASS_SAFETY + return BinarySensorDeviceClass.SAFETY @property def available(self) -> bool: diff --git a/homeassistant/components/homematicip_cloud/cover.py b/homeassistant/components/homematicip_cloud/cover.py index 0d0278ac455..937e36a15fc 100644 --- a/homeassistant/components/homematicip_cloud/cover.py +++ b/homeassistant/components/homematicip_cloud/cover.py @@ -15,9 +15,7 @@ from homematicip.base.enums import DoorCommand, DoorState from homeassistant.components.cover import ( ATTR_POSITION, ATTR_TILT_POSITION, - DEVICE_CLASS_BLIND, - DEVICE_CLASS_GARAGE, - DEVICE_CLASS_SHUTTER, + CoverDeviceClass, CoverEntity, ) from homeassistant.config_entries import ConfigEntry @@ -69,7 +67,7 @@ class HomematicipBlindModule(HomematicipGenericEntity, CoverEntity): @property def device_class(self) -> str: """Return the class of the cover.""" - return DEVICE_CLASS_BLIND + return CoverDeviceClass.BLIND @property def current_cover_position(self) -> int | None: @@ -162,7 +160,7 @@ class HomematicipMultiCoverShutter(HomematicipGenericEntity, CoverEntity): @property def device_class(self) -> str: """Return the class of the cover.""" - return DEVICE_CLASS_SHUTTER + return CoverDeviceClass.SHUTTER @property def current_cover_position(self) -> int | None: @@ -280,7 +278,7 @@ class HomematicipGarageDoorModule(HomematicipGenericEntity, CoverEntity): @property def device_class(self) -> str: """Return the class of the cover.""" - return DEVICE_CLASS_GARAGE + return CoverDeviceClass.GARAGE @property def is_closed(self) -> bool | None: @@ -311,7 +309,7 @@ class HomematicipCoverShutterGroup(HomematicipGenericEntity, CoverEntity): @property def device_class(self) -> str: """Return the class of the cover.""" - return DEVICE_CLASS_SHUTTER + return CoverDeviceClass.SHUTTER @property def current_cover_position(self) -> int | None: diff --git a/homeassistant/components/homematicip_cloud/sensor.py b/homeassistant/components/homematicip_cloud/sensor.py index d1c3f71a83f..323d462dbf8 100644 --- a/homeassistant/components/homematicip_cloud/sensor.py +++ b/homeassistant/components/homematicip_cloud/sensor.py @@ -27,17 +27,12 @@ from homematicip.aio.device import ( from homematicip.base.enums import ValveState from homeassistant.components.sensor import ( - STATE_CLASS_MEASUREMENT, - STATE_CLASS_TOTAL_INCREASING, + SensorDeviceClass, SensorEntity, + SensorStateClass, ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( - DEVICE_CLASS_ENERGY, - DEVICE_CLASS_HUMIDITY, - DEVICE_CLASS_ILLUMINANCE, - DEVICE_CLASS_POWER, - DEVICE_CLASS_TEMPERATURE, ENERGY_KILO_WATT_HOUR, LENGTH_MILLIMETERS, LIGHT_LUX, @@ -134,7 +129,7 @@ async def async_setup_entry( class HomematicipAccesspointDutyCycle(HomematicipGenericEntity, SensorEntity): """Representation of then HomeMaticIP access point.""" - _attr_state_class = STATE_CLASS_MEASUREMENT + _attr_state_class = SensorStateClass.MEASUREMENT def __init__(self, hap: HomematicipHAP, device) -> None: """Initialize access point status entity.""" @@ -188,7 +183,7 @@ class HomematicipHeatingThermostat(HomematicipGenericEntity, SensorEntity): class HomematicipHumiditySensor(HomematicipGenericEntity, SensorEntity): """Representation of the HomematicIP humidity sensor.""" - _attr_state_class = STATE_CLASS_MEASUREMENT + _attr_state_class = SensorStateClass.MEASUREMENT def __init__(self, hap: HomematicipHAP, device) -> None: """Initialize the thermometer device.""" @@ -197,7 +192,7 @@ class HomematicipHumiditySensor(HomematicipGenericEntity, SensorEntity): @property def device_class(self) -> str: """Return the device class of the sensor.""" - return DEVICE_CLASS_HUMIDITY + return SensorDeviceClass.HUMIDITY @property def native_value(self) -> int: @@ -213,7 +208,7 @@ class HomematicipHumiditySensor(HomematicipGenericEntity, SensorEntity): class HomematicipTemperatureSensor(HomematicipGenericEntity, SensorEntity): """Representation of the HomematicIP thermometer.""" - _attr_state_class = STATE_CLASS_MEASUREMENT + _attr_state_class = SensorStateClass.MEASUREMENT def __init__(self, hap: HomematicipHAP, device) -> None: """Initialize the thermometer device.""" @@ -222,7 +217,7 @@ class HomematicipTemperatureSensor(HomematicipGenericEntity, SensorEntity): @property def device_class(self) -> str: """Return the device class of the sensor.""" - return DEVICE_CLASS_TEMPERATURE + return SensorDeviceClass.TEMPERATURE @property def native_value(self) -> float: @@ -252,7 +247,7 @@ class HomematicipTemperatureSensor(HomematicipGenericEntity, SensorEntity): class HomematicipIlluminanceSensor(HomematicipGenericEntity, SensorEntity): """Representation of the HomematicIP Illuminance sensor.""" - _attr_state_class = STATE_CLASS_MEASUREMENT + _attr_state_class = SensorStateClass.MEASUREMENT def __init__(self, hap: HomematicipHAP, device) -> None: """Initialize the device.""" @@ -261,7 +256,7 @@ class HomematicipIlluminanceSensor(HomematicipGenericEntity, SensorEntity): @property def device_class(self) -> str: """Return the device class of the sensor.""" - return DEVICE_CLASS_ILLUMINANCE + return SensorDeviceClass.ILLUMINANCE @property def native_value(self) -> float: @@ -291,7 +286,7 @@ class HomematicipIlluminanceSensor(HomematicipGenericEntity, SensorEntity): class HomematicipPowerSensor(HomematicipGenericEntity, SensorEntity): """Representation of the HomematicIP power measuring sensor.""" - _attr_state_class = STATE_CLASS_MEASUREMENT + _attr_state_class = SensorStateClass.MEASUREMENT def __init__(self, hap: HomematicipHAP, device) -> None: """Initialize the device.""" @@ -300,7 +295,7 @@ class HomematicipPowerSensor(HomematicipGenericEntity, SensorEntity): @property def device_class(self) -> str: """Return the device class of the sensor.""" - return DEVICE_CLASS_POWER + return SensorDeviceClass.POWER @property def native_value(self) -> float: @@ -316,7 +311,7 @@ class HomematicipPowerSensor(HomematicipGenericEntity, SensorEntity): class HomematicipEnergySensor(HomematicipGenericEntity, SensorEntity): """Representation of the HomematicIP energy measuring sensor.""" - _attr_state_class = STATE_CLASS_TOTAL_INCREASING + _attr_state_class = SensorStateClass.TOTAL_INCREASING def __init__(self, hap: HomematicipHAP, device) -> None: """Initialize the device.""" @@ -325,7 +320,7 @@ class HomematicipEnergySensor(HomematicipGenericEntity, SensorEntity): @property def device_class(self) -> str: """Return the device class of the sensor.""" - return DEVICE_CLASS_ENERGY + return SensorDeviceClass.ENERGY @property def native_value(self) -> float: