@@ -15,8 +15,12 @@ class States(str, Enum):
1515 """Sensor entity states."""
1616
1717 UNAVAILABLE = "UNAVAILABLE"
18+ """The sensor is currently not available.
19+ The UI will render the sensor as inactive until the sensor becomes active again."""
1820 UNKNOWN = "UNKNOWN"
21+ """The sensor is available but the current state is unknown."""
1922 ON = "ON"
23+ """The sensor is available and providing measurements."""
2024
2125
2226class Features (str , Enum ):
@@ -27,42 +31,73 @@ class Attributes(str, Enum):
2731 """Sensor entity attributes."""
2832
2933 STATE = "state"
34+ """Optional state of the sensor."""
3035 VALUE = "value"
36+ """The native measurement value of the sensor."""
3137 UNIT = "unit"
38+ """Optional unit of the ``value`` if no default unit is set."""
3239
3340
3441class Commands (str , Enum ):
3542 """Sensor entity commands."""
3643
3744
3845class DeviceClasses (str , Enum ):
39- """Sensor entity device classes."""
46+ """Sensor entity device classes.
47+
48+ See https://unfoldedcircle.github.io/core-api/entities/entity_sensor.html
49+ for more information about binary sensors.
50+ """
4051
4152 CUSTOM = "custom"
53+ """Generic sensor with custom unit"""
4254 BATTERY = "battery"
55+ """Battery charge in %"""
4356 CURRENT = "current"
57+ """Electrical current in ampere"""
4458 ENERGY = "energy"
59+ """Energy in kilowatt-hour"""
4560 HUMIDITY = "humidity"
61+ """Humidity in %"""
4662 POWER = "power"
63+ """Power in watt or kilowatt"""
4764 TEMPERATURE = "temperature"
4865 VOLTAGE = "voltage"
66+ """Voltage in volt"""
67+ BINARY = "binary"
68+ """Binary sensor.
69+ The binary specific device class is stored in the ``unit`` attribute."""
4970
5071
5172class Options (str , Enum ):
5273 """Sensor entity options."""
5374
5475 CUSTOM_UNIT = "custom_unit"
76+ """Unit label for a custom sensor if device_class is not specified or to override
77+ a default unit."""
5578 NATIVE_UNIT = "native_unit"
79+ """The sensor's native unit of measurement to perform automatic conversion.
80+ Applicable to device classes: ``temperature``."""
5681 DECIMALS = "decimals"
82+ """Number of decimal places to show in the UI if the sensor provides the measurement
83+ as a number. Not applicable to string values."""
5784 MIN_VALUE = "min_value"
85+ """Not yet supported.
86+
87+ Optional minimum value of the sensor output. This can be used in the UI for graphs
88+ or gauges."""
5889 MAX_VALUE = "max_value"
90+ """Not yet supported.
91+
92+ Optional maximum value of the sensor output. This can be used in the UI for graphs
93+ or gauges."""
5994
6095
6196class Sensor (Entity ):
6297 """
6398 Sensor entity class.
6499
65- See https://github.com/unfoldedcircle/ core-api/blob/main/doc/ entities/entity_sensor.md
100+ See https://unfoldedcircle. github.io/ core-api/entities/entity_sensor.html
66101 for more information.
67102 """
68103
@@ -78,7 +113,7 @@ def __init__(
78113 area : str | None = None ,
79114 ):
80115 """
81- Create sensor-entity instance.
116+ Create a sensor-entity instance.
82117
83118 :param identifier: entity identifier
84119 :param name: friendly name
0 commit comments