Skip to content

Commit

Permalink
Merge pull request #132 from Khayrisill/Khayrisill-UpdateConstants
Browse files Browse the repository at this point in the history
Update constants
  • Loading branch information
nbogojevic authored Jan 25, 2024
2 parents 6917d18 + d0e7412 commit 096d7bc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
17 changes: 7 additions & 10 deletions custom_components/midea_dehumidifier_lan/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
PRESET_ECO,
PRESET_NONE,
PRESET_SLEEP,
SUPPORT_FAN_MODE,
SUPPORT_PRESET_MODE,
SUPPORT_SWING_MODE,
SUPPORT_TARGET_TEMPERATURE,
ClimateEntityFeature,
SWING_BOTH,
SWING_HORIZONTAL,
SWING_OFF,
Expand All @@ -28,7 +25,7 @@
HVACMode,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_HALVES, TEMP_CELSIUS
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_HALVES, UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback

Expand Down Expand Up @@ -128,13 +125,13 @@ class AirConditionerEntity(ApplianceEntity, ClimateEntity):
_attr_max_temp = MAX_TARGET_TEMPERATURE
_attr_min_temp = MIN_TARGET_TEMPERATURE
_attr_precision = PRECISION_HALVES
_attr_temperature_unit = TEMP_CELSIUS
_attr_temperature_unit = UnitOfTemperature.CELSIUS

_attr_supported_features = (
SUPPORT_TARGET_TEMPERATURE
| SUPPORT_FAN_MODE
| SUPPORT_SWING_MODE
| SUPPORT_PRESET_MODE
ClimateEntityFeature.TARGET_TEMPERATURE
| ClimateEntityFeature.FAN_MODE
| ClimateEntityFeature.SWING_MODE
| ClimateEntityFeature.PRESET_MODE
)

_name_suffix = ""
Expand Down
4 changes: 2 additions & 2 deletions custom_components/midea_dehumidifier_lan/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Any, Final

from homeassistant.components.fan import (
SUPPORT_PRESET_MODE,
FanEntityFeature,
FanEntity,
)
from homeassistant.config_entries import ConfigEntry
Expand Down Expand Up @@ -52,7 +52,7 @@ async def async_setup_entry(
class DehumidiferFan(ApplianceEntity, FanEntity):
"""Entity for managing dehumidifer fan"""

_attr_supported_features = SUPPORT_PRESET_MODE
_attr_supported_features = FanEntityFeature.PRESET_MODE
_attr_preset_modes = PRESET_MODES_7
_attr_speed_count = len(PRESET_MODES_7)
_name_suffix = " Fan"
Expand Down
4 changes: 2 additions & 2 deletions custom_components/midea_dehumidifier_lan/humidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Final

from homeassistant.components.humidifier import HumidifierDeviceClass, HumidifierEntity
from homeassistant.components.humidifier.const import SUPPORT_MODES
from homeassistant.components.humidifier.const import HumidifierEntityFeature
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -71,7 +71,7 @@ class DehumidifierEntity(ApplianceEntity, HumidifierEntity):
_attr_device_class = HumidifierDeviceClass.DEHUMIDIFIER
_attr_max_humidity = MAX_TARGET_HUMIDITY
_attr_min_humidity = MIN_TARGET_HUMIDITY
_attr_supported_features = SUPPORT_MODES
_attr_supported_features = HumidifierEntityFeature.MODES
_name_suffix = ""
_add_extra_attrs = True

Expand Down
6 changes: 3 additions & 3 deletions custom_components/midea_dehumidifier_lan/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
PERCENTAGE,
TEMP_CELSIUS,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -63,7 +63,7 @@ class CurrentTemperatureSensor(ApplianceEntity, SensorEntity):
"""Current environment temperature sensor"""

_attr_device_class = SensorDeviceClass.TEMPERATURE
_attr_native_unit_of_measurement = TEMP_CELSIUS
_attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
_attr_state_class = SensorStateClass.MEASUREMENT
_name_suffix = " Temperature"

Expand Down Expand Up @@ -92,7 +92,7 @@ class OutsideTemperatureSensor(ApplianceEntity, SensorEntity):
"""Current outside temperature sensor"""

_attr_device_class = SensorDeviceClass.TEMPERATURE
_attr_native_unit_of_measurement = TEMP_CELSIUS
_attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
_attr_state_class = SensorStateClass.MEASUREMENT
_unique_id_prefx = UNIQUE_CLIMATE_PREFIX
_name_suffix = " Outdoor Temperature"
Expand Down

0 comments on commit 096d7bc

Please sign in to comment.