Skip to content

Commit

Permalink
fix: Replaces deprecated entity config consts with new enum with the …
Browse files Browse the repository at this point in the history
…same purpose
  • Loading branch information
MislavMandaric committed Apr 8, 2022
1 parent 011e475 commit ef18d97
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
7 changes: 3 additions & 4 deletions custom_components/vaillant_vsmart/select.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
"""The Vaillant vSMART climate platform."""
from __future__ import annotations

import datetime
import logging

from homeassistant.components.select import SelectEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import DOMAIN
Expand Down Expand Up @@ -48,10 +47,10 @@ def name(self) -> str:
return f"{self._module.module_name} {self._program.name} Profile"

@property
def entity_category(self) -> str:
def entity_category(self) -> EntityCategory:
"""Return entity category for this select."""

return ENTITY_CATEGORY_DIAGNOSTIC
return EntityCategory.DIAGNOSTIC

@property
def current_option(self) -> str | None:
Expand Down
7 changes: 4 additions & 3 deletions custom_components/vaillant_vsmart/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
STATE_CLASS_MEASUREMENT,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC, PERCENTAGE
from homeassistant.const import PERCENTAGE
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import DOMAIN
Expand Down Expand Up @@ -50,10 +51,10 @@ def name(self) -> str:
return f"{self._module.module_name} Battery"

@property
def entity_category(self) -> str:
def entity_category(self) -> EntityCategory:
"""Return entity category for this sensor."""

return ENTITY_CATEGORY_DIAGNOSTIC
return EntityCategory.DIAGNOSTIC

@property
def device_class(self) -> str:
Expand Down
10 changes: 5 additions & 5 deletions custom_components/vaillant_vsmart/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from homeassistant.components.switch import SwitchEntity, DEVICE_CLASS_SWITCH
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_CONFIG
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from vaillant_netatmo_api import ApiException, SetpointMode

Expand Down Expand Up @@ -54,10 +54,10 @@ def name(self) -> str:
return f"{self._module.module_name} HWB"

@property
def entity_category(self) -> str:
def entity_category(self) -> EntityCategory:
"""Return entity category for this switch."""

return ENTITY_CATEGORY_CONFIG
return EntityCategory.CONFIG

@property
def device_class(self) -> str:
Expand Down Expand Up @@ -120,10 +120,10 @@ def name(self) -> str:
return f"{self._module.module_name} {self._program.name} Schedule"

@property
def entity_category(self) -> str:
def entity_category(self) -> EntityCategory:
"""Return entity category for this switch."""

return ENTITY_CATEGORY_CONFIG
return EntityCategory.CONFIG

@property
def device_class(self) -> str:
Expand Down

0 comments on commit ef18d97

Please sign in to comment.