mirror of
https://github.com/home-assistant/core.git
synced 2025-08-07 14:45:09 +02:00
move to sensor/const.py
This commit is contained in:
@@ -17,7 +17,8 @@ from homeassistant.components.binary_sensor import (
|
|||||||
DEVICE_CLASSES as BINARY_SENSOR_DEVICE_CLASSES,
|
DEVICE_CLASSES as BINARY_SENSOR_DEVICE_CLASSES,
|
||||||
)
|
)
|
||||||
from homeassistant.components.cover import DEVICE_CLASSES as COVER_DEVICE_CLASSES
|
from homeassistant.components.cover import DEVICE_CLASSES as COVER_DEVICE_CLASSES
|
||||||
from homeassistant.components.sensor import CONF_STATE_CLASS, STATE_CLASSES_SCHEMA
|
from homeassistant.components.sensor import STATE_CLASSES_SCHEMA
|
||||||
|
from homeassistant.components.sensor.const import CONF_STATE_CLASS
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_ENTITY_ID,
|
CONF_ENTITY_ID,
|
||||||
|
@@ -6,11 +6,8 @@ from typing import Any
|
|||||||
from xknx import XKNX
|
from xknx import XKNX
|
||||||
from xknx.devices import Sensor as XknxSensor
|
from xknx.devices import Sensor as XknxSensor
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import DEVICE_CLASSES, SensorEntity
|
||||||
CONF_STATE_CLASS,
|
from homeassistant.components.sensor.const import CONF_STATE_CLASS
|
||||||
DEVICE_CLASSES,
|
|
||||||
SensorEntity,
|
|
||||||
)
|
|
||||||
from homeassistant.const import CONF_NAME, CONF_TYPE
|
from homeassistant.const import CONF_NAME, CONF_TYPE
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@@ -9,11 +9,11 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant.components import sensor
|
from homeassistant.components import sensor
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
CONF_STATE_CLASS,
|
|
||||||
DEVICE_CLASSES_SCHEMA,
|
DEVICE_CLASSES_SCHEMA,
|
||||||
STATE_CLASSES_SCHEMA,
|
STATE_CLASSES_SCHEMA,
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.components.sensor.const import CONF_STATE_CLASS
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_FORCE_UPDATE,
|
CONF_FORCE_UPDATE,
|
||||||
|
@@ -89,7 +89,6 @@ DEVICE_CLASSES: Final[list[str]] = [
|
|||||||
|
|
||||||
DEVICE_CLASSES_SCHEMA: Final = vol.All(vol.Lower, vol.In(DEVICE_CLASSES))
|
DEVICE_CLASSES_SCHEMA: Final = vol.All(vol.Lower, vol.In(DEVICE_CLASSES))
|
||||||
|
|
||||||
CONF_STATE_CLASS: Final = "state_class"
|
|
||||||
# The state represents a measurement in present time
|
# The state represents a measurement in present time
|
||||||
STATE_CLASS_MEASUREMENT: Final = "measurement"
|
STATE_CLASS_MEASUREMENT: Final = "measurement"
|
||||||
# The state represents a monotonically increasing total, e.g. an amount of consumed gas
|
# The state represents a monotonically increasing total, e.g. an amount of consumed gas
|
||||||
|
4
homeassistant/components/sensor/const.py
Normal file
4
homeassistant/components/sensor/const.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
"""Constants for sensor."""
|
||||||
|
from typing import Final
|
||||||
|
|
||||||
|
CONF_STATE_CLASS: Final = "state_class"
|
@@ -4,7 +4,6 @@ from __future__ import annotations
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
CONF_STATE_CLASS,
|
|
||||||
DEVICE_CLASSES_SCHEMA,
|
DEVICE_CLASSES_SCHEMA,
|
||||||
DOMAIN as SENSOR_DOMAIN,
|
DOMAIN as SENSOR_DOMAIN,
|
||||||
ENTITY_ID_FORMAT,
|
ENTITY_ID_FORMAT,
|
||||||
@@ -12,6 +11,7 @@ from homeassistant.components.sensor import (
|
|||||||
STATE_CLASSES_SCHEMA,
|
STATE_CLASSES_SCHEMA,
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.components.sensor.const import CONF_STATE_CLASS
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
|
Reference in New Issue
Block a user