Skip to content

Commit

Permalink
Switch from constants to enums (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
raman325 authored May 30, 2023
1 parent 5e6083a commit 08feba2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions custom_components/zoom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
from aiohttp.client_exceptions import ClientResponseError
from aiohttp.web_exceptions import HTTPUnauthorized
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntry
from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET, CONF_ID, CONF_NAME
from homeassistant.const import (
CONF_CLIENT_ID,
CONF_CLIENT_SECRET,
CONF_ID,
CONF_NAME,
Platform,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_entry_oauth2_flow, config_validation as cv
from homeassistant.helpers.typing import ConfigType
Expand Down Expand Up @@ -49,7 +55,7 @@ def ensure_multiple_have_names(value: List[Dict[str, str]]) -> List[Dict[str, st
extra=vol.ALLOW_EXTRA,
)

PLATFORMS = ["binary_sensor"]
PLATFORMS = [Platform.BINARY_SENSOR]


async def async_setup(hass: HomeAssistant, config: ConfigType):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/zoom/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from aiohttp.web import HTTPUnauthorized
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.config_entries import ConfigEntry
Expand Down Expand Up @@ -81,7 +81,7 @@ def __init__(self, hass: HomeAssistantType, config_entry: ConfigEntry) -> None:
self._zoom_event_state = None
self._state = STATE_OFF

self._attr_device_class = DEVICE_CLASS_CONNECTIVITY
self._attr_device_class = BinarySensorDeviceClass.CONNECTIVITY
self._attr_unique_id = f"{DOMAIN}_{slugify(self._name)}"
self._attr_available = True
self._attr_should_poll = False
Expand Down

0 comments on commit 08feba2

Please sign in to comment.