mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
parent
7c8d235356
commit
16d16585ae
@ -1,10 +1,10 @@
|
|||||||
"""Support for Plaato Airlock sensors."""
|
"""Support for Plaato Airlock sensors."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from pyplaato.plaato import PlaatoKeg
|
from pyplaato.plaato import PlaatoKeg
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
DEVICE_CLASS_OPENING,
|
BinarySensorDeviceClass,
|
||||||
DEVICE_CLASS_PROBLEM,
|
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -40,11 +40,11 @@ class PlaatoBinarySensor(PlaatoEntity, BinarySensorEntity):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_class(self):
|
def device_class(self) -> BinarySensorDeviceClass | None:
|
||||||
"""Return the class of this device, from component DEVICE_CLASSES."""
|
"""Return the class of this device, from BinarySensorDeviceClass."""
|
||||||
if self._coordinator is None:
|
if self._coordinator is None:
|
||||||
return None
|
return None
|
||||||
if self._sensor_type is PlaatoKeg.Pins.LEAK_DETECTION:
|
if self._sensor_type is PlaatoKeg.Pins.LEAK_DETECTION:
|
||||||
return DEVICE_CLASS_PROBLEM
|
return BinarySensorDeviceClass.PROBLEM
|
||||||
if self._sensor_type is PlaatoKeg.Pins.POURING:
|
if self._sensor_type is PlaatoKeg.Pins.POURING:
|
||||||
return DEVICE_CLASS_OPENING
|
return BinarySensorDeviceClass.OPENING
|
||||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
from pyplaato.models.device import PlaatoDevice
|
from pyplaato.models.device import PlaatoDevice
|
||||||
from pyplaato.plaato import PlaatoKeg
|
from pyplaato.plaato import PlaatoKeg
|
||||||
|
|
||||||
from homeassistant.components.sensor import DEVICE_CLASS_TEMPERATURE, SensorEntity
|
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||||
from homeassistant.helpers.dispatcher import (
|
from homeassistant.helpers.dispatcher import (
|
||||||
async_dispatcher_connect,
|
async_dispatcher_connect,
|
||||||
async_dispatcher_send,
|
async_dispatcher_send,
|
||||||
@ -63,15 +63,15 @@ class PlaatoSensor(PlaatoEntity, SensorEntity):
|
|||||||
"""Representation of a Plaato Sensor."""
|
"""Representation of a Plaato Sensor."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_class(self) -> str | None:
|
def device_class(self) -> SensorDeviceClass | None:
|
||||||
"""Return the class of this device, from component DEVICE_CLASSES."""
|
"""Return the class of this device, from SensorDeviceClass."""
|
||||||
if (
|
if (
|
||||||
self._coordinator is not None
|
self._coordinator is not None
|
||||||
and self._sensor_type == PlaatoKeg.Pins.TEMPERATURE
|
and self._sensor_type == PlaatoKeg.Pins.TEMPERATURE
|
||||||
):
|
):
|
||||||
return DEVICE_CLASS_TEMPERATURE
|
return SensorDeviceClass.TEMPERATURE
|
||||||
if self._sensor_type == ATTR_TEMP:
|
if self._sensor_type == ATTR_TEMP:
|
||||||
return DEVICE_CLASS_TEMPERATURE
|
return SensorDeviceClass.TEMPERATURE
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user