mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Use new SensorDeviceClass enum in bmp280 (#61320)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
a8d0a54553
commit
0c96b27ab2
@ -8,9 +8,8 @@ from busio import I2C
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
DEVICE_CLASS_PRESSURE,
|
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
|
SensorDeviceClass,
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_NAME, PRESSURE_HPA, TEMP_CELSIUS
|
from homeassistant.const import CONF_NAME, PRESSURE_HPA, TEMP_CELSIUS
|
||||||
@ -87,7 +86,7 @@ class Bmp280TemperatureSensor(Bmp280Sensor):
|
|||||||
def __init__(self, bmp280: Adafruit_BMP280_I2C, name: str) -> None:
|
def __init__(self, bmp280: Adafruit_BMP280_I2C, name: str) -> None:
|
||||||
"""Initialize the entity."""
|
"""Initialize the entity."""
|
||||||
super().__init__(
|
super().__init__(
|
||||||
bmp280, f"{name} Temperature", TEMP_CELSIUS, DEVICE_CLASS_TEMPERATURE
|
bmp280, f"{name} Temperature", TEMP_CELSIUS, SensorDeviceClass.TEMPERATURE
|
||||||
)
|
)
|
||||||
|
|
||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
@ -112,7 +111,7 @@ class Bmp280PressureSensor(Bmp280Sensor):
|
|||||||
def __init__(self, bmp280: Adafruit_BMP280_I2C, name: str) -> None:
|
def __init__(self, bmp280: Adafruit_BMP280_I2C, name: str) -> None:
|
||||||
"""Initialize the entity."""
|
"""Initialize the entity."""
|
||||||
super().__init__(
|
super().__init__(
|
||||||
bmp280, f"{name} Pressure", PRESSURE_HPA, DEVICE_CLASS_PRESSURE
|
bmp280, f"{name} Pressure", PRESSURE_HPA, SensorDeviceClass.PRESSURE
|
||||||
)
|
)
|
||||||
|
|
||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user