diff --git a/homeassistant/components/mysensors/binary_sensor.py b/homeassistant/components/mysensors/binary_sensor.py index 91dc454dae3..a2118de3a76 100644 --- a/homeassistant/components/mysensors/binary_sensor.py +++ b/homeassistant/components/mysensors/binary_sensor.py @@ -3,13 +3,9 @@ from __future__ import annotations from homeassistant.components import mysensors from homeassistant.components.binary_sensor import ( - DEVICE_CLASS_MOISTURE, - DEVICE_CLASS_MOTION, - DEVICE_CLASS_SAFETY, - DEVICE_CLASS_SOUND, - DEVICE_CLASS_VIBRATION, DEVICE_CLASSES, DOMAIN, + BinarySensorDeviceClass, BinarySensorEntity, ) from homeassistant.config_entries import ConfigEntry @@ -23,13 +19,13 @@ from .helpers import on_unload SENSORS = { "S_DOOR": "door", - "S_MOTION": DEVICE_CLASS_MOTION, + "S_MOTION": BinarySensorDeviceClass.MOTION, "S_SMOKE": "smoke", - "S_SPRINKLER": DEVICE_CLASS_SAFETY, - "S_WATER_LEAK": DEVICE_CLASS_SAFETY, - "S_SOUND": DEVICE_CLASS_SOUND, - "S_VIBRATION": DEVICE_CLASS_VIBRATION, - "S_MOISTURE": DEVICE_CLASS_MOISTURE, + "S_SPRINKLER": BinarySensorDeviceClass.SAFETY, + "S_WATER_LEAK": BinarySensorDeviceClass.SAFETY, + "S_SOUND": BinarySensorDeviceClass.SOUND, + "S_VIBRATION": BinarySensorDeviceClass.VIBRATION, + "S_MOISTURE": BinarySensorDeviceClass.MOISTURE, } diff --git a/homeassistant/components/mysensors/sensor.py b/homeassistant/components/mysensors/sensor.py index 94a9cde1df2..9d02571cf49 100644 --- a/homeassistant/components/mysensors/sensor.py +++ b/homeassistant/components/mysensors/sensor.py @@ -8,22 +8,15 @@ from awesomeversion import AwesomeVersion from homeassistant.components import mysensors from homeassistant.components.sensor import ( DOMAIN, - STATE_CLASS_MEASUREMENT, - STATE_CLASS_TOTAL_INCREASING, + SensorDeviceClass, SensorEntity, SensorEntityDescription, + SensorStateClass, ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( CONDUCTIVITY, DEGREE, - DEVICE_CLASS_CURRENT, - DEVICE_CLASS_ENERGY, - DEVICE_CLASS_HUMIDITY, - DEVICE_CLASS_ILLUMINANCE, - DEVICE_CLASS_POWER, - DEVICE_CLASS_TEMPERATURE, - DEVICE_CLASS_VOLTAGE, ELECTRIC_CURRENT_AMPERE, ELECTRIC_POTENTIAL_MILLIVOLT, ELECTRIC_POTENTIAL_VOLT, @@ -50,14 +43,14 @@ from .helpers import on_unload SENSORS: dict[str, SensorEntityDescription] = { "V_TEMP": SensorEntityDescription( key="V_TEMP", - device_class=DEVICE_CLASS_TEMPERATURE, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, ), "V_HUM": SensorEntityDescription( key="V_HUM", native_unit_of_measurement=PERCENTAGE, - device_class=DEVICE_CLASS_HUMIDITY, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, ), "V_DIMMER": SensorEntityDescription( key="V_DIMMER", @@ -115,14 +108,14 @@ SENSORS: dict[str, SensorEntityDescription] = { "V_WATT": SensorEntityDescription( key="V_WATT", native_unit_of_measurement=POWER_WATT, - device_class=DEVICE_CLASS_POWER, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, ), "V_KWH": SensorEntityDescription( key="V_KWH", native_unit_of_measurement=ENERGY_KILO_WATT_HOUR, - device_class=DEVICE_CLASS_ENERGY, - state_class=STATE_CLASS_TOTAL_INCREASING, + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, ), "V_LIGHT_LEVEL": SensorEntityDescription( key="V_LIGHT_LEVEL", @@ -150,8 +143,8 @@ SENSORS: dict[str, SensorEntityDescription] = { "V_LEVEL_S_LIGHT_LEVEL": SensorEntityDescription( key="V_LEVEL_S_LIGHT_LEVEL", native_unit_of_measurement=LIGHT_LUX, - device_class=DEVICE_CLASS_ILLUMINANCE, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.ILLUMINANCE, + state_class=SensorStateClass.MEASUREMENT, ), "V_LEVEL_S_MOISTURE": SensorEntityDescription( key="V_LEVEL_S_MOISTURE", @@ -161,14 +154,14 @@ SENSORS: dict[str, SensorEntityDescription] = { "V_VOLTAGE": SensorEntityDescription( key="V_VOLTAGE", native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT, - device_class=DEVICE_CLASS_VOLTAGE, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, ), "V_CURRENT": SensorEntityDescription( key="V_CURRENT", native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE, - device_class=DEVICE_CLASS_CURRENT, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.CURRENT, + state_class=SensorStateClass.MEASUREMENT, ), "V_PH": SensorEntityDescription( key="V_PH",