Use new enums in tasmota (#62427)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-20 21:00:53 +01:00 committed by GitHub
parent 69df7bc43d
commit 3724a4fb2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,6 @@ from homeassistant.const import (
ELECTRIC_CURRENT_AMPERE, ELECTRIC_CURRENT_AMPERE,
ELECTRIC_POTENTIAL_VOLT, ELECTRIC_POTENTIAL_VOLT,
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
ENTITY_CATEGORY_DIAGNOSTIC,
FREQUENCY_HERTZ, FREQUENCY_HERTZ,
LENGTH_CENTIMETERS, LENGTH_CENTIMETERS,
LIGHT_LUX, LIGHT_LUX,
@ -42,6 +41,7 @@ from homeassistant.const import (
) )
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DATA_REMOVE_DISCOVER_COMPONENT from .const import DATA_REMOVE_DISCOVER_COMPONENT
@ -277,7 +277,7 @@ class TasmotaSensor(TasmotaAvailability, TasmotaDiscoveryUpdate, SensorEntity):
def entity_category(self) -> str | None: def entity_category(self) -> str | None:
"""Return the category of the entity, if any.""" """Return the category of the entity, if any."""
if self._tasmota_entity.quantity in status_sensor.SENSORS: if self._tasmota_entity.quantity in status_sensor.SENSORS:
return ENTITY_CATEGORY_DIAGNOSTIC return EntityCategory.DIAGNOSTIC
return None return None
@property @property