mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Use enums in zwave (#62131)
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
abb36ff45f
commit
867cbeedb9
@ -59,7 +59,7 @@ class ZWaveBinarySensor(BinarySensorEntity, ZWaveDeviceEntity):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Return the class of this sensor, from DEVICE_CLASSES."""
|
"""Return the class of this sensor, from BinarySensorDeviceClass."""
|
||||||
return self._sensor_type
|
return self._sensor_type
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ from homeassistant.components.cover import (
|
|||||||
DOMAIN,
|
DOMAIN,
|
||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
|
CoverDeviceClass,
|
||||||
CoverEntity,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -156,8 +157,8 @@ class ZwaveGarageDoorBase(ZWaveDeviceEntity, CoverEntity):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Return the class of this device, from component DEVICE_CLASSES."""
|
"""Return the class of this device, from CoverDeviceClass."""
|
||||||
return "garage"
|
return CoverDeviceClass.GARAGE
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Support for Z-Wave sensors."""
|
"""Support for Z-Wave sensors."""
|
||||||
from homeassistant.components.sensor import DEVICE_CLASS_BATTERY, DOMAIN, SensorEntity
|
from homeassistant.components.sensor import DOMAIN, SensorDeviceClass, SensorEntity
|
||||||
from homeassistant.const import DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ class ZWaveMultilevelSensor(ZWaveSensor):
|
|||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Return the class of this device."""
|
"""Return the class of this device."""
|
||||||
if self._units in ["C", "F"]:
|
if self._units in ["C", "F"]:
|
||||||
return DEVICE_CLASS_TEMPERATURE
|
return SensorDeviceClass.TEMPERATURE
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -115,4 +115,4 @@ class ZWaveBatterySensor(ZWaveSensor):
|
|||||||
@property
|
@property
|
||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Return the class of this device."""
|
"""Return the class of this device."""
|
||||||
return DEVICE_CLASS_BATTERY
|
return SensorDeviceClass.BATTERY
|
||||||
|
Loading…
x
Reference in New Issue
Block a user