mirror of
https://github.com/home-assistant/core.git
synced 2025-08-13 09:35:20 +02:00
move to sensor/__init__.py
This commit is contained in:
@@ -17,14 +17,13 @@ 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 STATE_CLASSES_SCHEMA
|
from homeassistant.components.sensor import CONF_STATE_CLASS, STATE_CLASSES_SCHEMA
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_ENTITY_ID,
|
CONF_ENTITY_ID,
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_PORT,
|
CONF_PORT,
|
||||||
CONF_STATE_CLASS,
|
|
||||||
CONF_TYPE,
|
CONF_TYPE,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
@@ -6,8 +6,12 @@ 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 DEVICE_CLASSES, SensorEntity
|
from homeassistant.components.sensor import (
|
||||||
from homeassistant.const import CONF_NAME, CONF_STATE_CLASS, CONF_TYPE
|
CONF_STATE_CLASS,
|
||||||
|
DEVICE_CLASSES,
|
||||||
|
SensorEntity,
|
||||||
|
)
|
||||||
|
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
|
||||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, StateType
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, StateType
|
||||||
|
@@ -9,6 +9,7 @@ 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,
|
||||||
@@ -17,7 +18,6 @@ from homeassistant.const import (
|
|||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_FORCE_UPDATE,
|
CONF_FORCE_UPDATE,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_STATE_CLASS,
|
|
||||||
CONF_UNIT_OF_MEASUREMENT,
|
CONF_UNIT_OF_MEASUREMENT,
|
||||||
CONF_VALUE_TEMPLATE,
|
CONF_VALUE_TEMPLATE,
|
||||||
)
|
)
|
||||||
|
@@ -66,6 +66,7 @@ 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"
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@ 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,
|
||||||
@@ -38,7 +39,6 @@ from .const import (
|
|||||||
CONF_AVAILABILITY_TEMPLATE,
|
CONF_AVAILABILITY_TEMPLATE,
|
||||||
CONF_OBJECT_ID,
|
CONF_OBJECT_ID,
|
||||||
CONF_PICTURE,
|
CONF_PICTURE,
|
||||||
CONF_STATE_CLASS,
|
|
||||||
CONF_TRIGGER,
|
CONF_TRIGGER,
|
||||||
)
|
)
|
||||||
from .template_entity import TemplateEntity
|
from .template_entity import TemplateEntity
|
||||||
|
@@ -181,7 +181,6 @@ CONF_SLAVE: Final = "slave"
|
|||||||
CONF_SOURCE: Final = "source"
|
CONF_SOURCE: Final = "source"
|
||||||
CONF_SSL: Final = "ssl"
|
CONF_SSL: Final = "ssl"
|
||||||
CONF_STATE: Final = "state"
|
CONF_STATE: Final = "state"
|
||||||
CONF_STATE_CLASS: Final = "state_class"
|
|
||||||
CONF_STATE_TEMPLATE: Final = "state_template"
|
CONF_STATE_TEMPLATE: Final = "state_template"
|
||||||
CONF_STRUCTURE: Final = "structure"
|
CONF_STRUCTURE: Final = "structure"
|
||||||
CONF_SWITCHES: Final = "switches"
|
CONF_SWITCHES: Final = "switches"
|
||||||
|
Reference in New Issue
Block a user