Use enums in ping (#62066)

This commit is contained in:
Robert Hillis 2021-12-16 09:38:02 -05:00 committed by GitHub
parent 42fab1bb51
commit a5cf783e6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,8 +13,8 @@ from icmplib import NameLookupError, async_ping
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.const import CONF_HOST, CONF_NAME, STATE_ON from homeassistant.const import CONF_HOST, CONF_NAME, STATE_ON
@ -99,9 +99,9 @@ class PingBinarySensor(RestoreEntity, BinarySensorEntity):
return self._available return self._available
@property @property
def device_class(self) -> str: def device_class(self) -> BinarySensorDeviceClass:
"""Return the class of this sensor.""" """Return the class of this sensor."""
return DEVICE_CLASS_CONNECTIVITY return BinarySensorDeviceClass.CONNECTIVITY
@property @property
def is_on(self) -> bool: def is_on(self) -> bool: