mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-16 22:06:29 +00:00
Replace device class strings with enums in dev docs (#1610)
This commit is contained in:
parent
7f88317945
commit
dfd77cabdf
@ -219,7 +219,7 @@ The below code snippet gives an example of best practices for when to implement
|
||||
|
||||
```py
|
||||
class SomeEntity():
|
||||
_attr_device_clas = DEVICE_CLASS_TEMPERATURE # This will be common to all instances of SomeEntity
|
||||
_attr_device_clas = SensorDeviceClass.TEMPERATURE # This will be common to all instances of SomeEntity
|
||||
def __init__(self, device):
|
||||
self._device = device
|
||||
self._attr_available = False # This overrides the default
|
||||
|
@ -18,33 +18,33 @@ Properties should always only return information from memory and not do I/O (lik
|
||||
|
||||
### Available device classes
|
||||
|
||||
| Value | Description
|
||||
| Constant | Description
|
||||
| ----- | -----------
|
||||
| battery | On means low, Off means normal.
|
||||
| battery_charging | On means charging, Off means not charging.
|
||||
| co | On means carbon monoxide detected, Off means no carbon monoxide (clear).
|
||||
| cold | On means cold, Off means normal.
|
||||
| connectivity | On means connected, Off means disconnected.
|
||||
| door | On means open, Off means closed.
|
||||
| garage_door | On means open, Off means closed.
|
||||
| gas | On means gas detected, Off means no gas (clear).
|
||||
| heat | On means hot, Off means normal.
|
||||
| light | On means light detected, Off means no light.
|
||||
| lock | On means open (unlocked), Off means closed (locked).
|
||||
| moisture | On means wet, Off means dry.
|
||||
| motion | On means motion detected, Off means no motion (clear).
|
||||
| moving | On means moving, Off means not moving (stopped).
|
||||
| occupancy | On means occupied, Off means not occupied (clear).
|
||||
| opening | On means open, Off means closed.
|
||||
| plug | On means plugged in, Off means unplugged.
|
||||
| power | On means power detected, Off means no power.
|
||||
| presence | On means home, Off means away.
|
||||
| problem | On means problem detected, Off means no problem (OK).
|
||||
| running | On means running, Off means not running.
|
||||
| safety | On means unsafe, Off means safe.
|
||||
| smoke | On means smoke detected, Off means no smoke (clear).
|
||||
| sound | On means sound detected, Off means no sound (clear).
|
||||
| tamper | On means tampering detected, Off means no tampering (clear)
|
||||
| update | On means update available, Off means up-to-date. The use of this device class should be avoided, please consider using the [`update`](/docs/core/entity/update) entity instead.
|
||||
| vibration | On means vibration detected, Off means no vibration.
|
||||
| window | On means open, Off means closed.
|
||||
| `BinarySensorDeviceClass.BATTERY` | On means low, Off means normal.
|
||||
| `BinarySensorDeviceClass.BATTERY_CHARGING` | On means charging, Off means not charging.
|
||||
| `BinarySensorDeviceClass.CO` | On means carbon monoxide detected, Off means no carbon monoxide (clear).
|
||||
| `BinarySensorDeviceClass.COLD` | On means cold, Off means normal.
|
||||
| `BinarySensorDeviceClass.CONNECTIVITY` | On means connected, Off means disconnected.
|
||||
| `BinarySensorDeviceClass.DOOR` | On means open, Off means closed.
|
||||
| `BinarySensorDeviceClass.GARAGE_DOOR` | On means open, Off means closed.
|
||||
| `BinarySensorDeviceClass.GAS` | On means gas detected, Off means no gas (clear).
|
||||
| `BinarySensorDeviceClass.HEAT` | On means hot, Off means normal.
|
||||
| `BinarySensorDeviceClass.LIGHT` | On means light detected, Off means no light.
|
||||
| `BinarySensorDeviceClass.LOCK` | On means open (unlocked), Off means closed (locked).
|
||||
| `BinarySensorDeviceClass.MOISTURE` | On means wet, Off means dry.
|
||||
| `BinarySensorDeviceClass.MOTION` | On means motion detected, Off means no motion (clear).
|
||||
| `BinarySensorDeviceClass.MOVING` | On means moving, Off means not moving (stopped).
|
||||
| `BinarySensorDeviceClass.OCCUPANCY` | On means occupied, Off means not occupied (clear).
|
||||
| `BinarySensorDeviceClass.OPENING` | On means open, Off means closed.
|
||||
| `BinarySensorDeviceClass.PLUG` | On means plugged in, Off means unplugged.
|
||||
| `BinarySensorDeviceClass.POWER` | On means power detected, Off means no power.
|
||||
| `BinarySensorDeviceClass.PRESENCE` | On means home, Off means away.
|
||||
| `BinarySensorDeviceClass.PROBLEM` | On means problem detected, Off means no problem (OK).
|
||||
| `BinarySensorDeviceClass.RUNNING` | On means running, Off means not running.
|
||||
| `BinarySensorDeviceClass.SAFETY` | On means unsafe, Off means safe.
|
||||
| `BinarySensorDeviceClass.SMOKE` | On means smoke detected, Off means no smoke (clear).
|
||||
| `BinarySensorDeviceClass.SOUND` | On means sound detected, Off means no sound (clear).
|
||||
| `BinarySensorDeviceClass.TAMPER` | On means tampering detected, Off means no tampering (clear)
|
||||
| `BinarySensorDeviceClass.UPDATE` | On means update available, Off means up-to-date. The use of this device class should be avoided, please consider using the [`update`](/docs/core/entity/update) entity instead.
|
||||
| `BinarySensorDeviceClass.VIBRATION` | On means vibration detected, Off means no vibration.
|
||||
| `BinarySensorDeviceClass.WINDOW` | On means open, Off means closed.
|
||||
|
@ -44,7 +44,7 @@ class MyButton(ButtonEntity):
|
||||
|
||||
Optionally specifies what type of entity it is. It will possibly map to Google device types.
|
||||
|
||||
| Value | Description
|
||||
| Constant | Description
|
||||
| ----- | -----------
|
||||
| restart | The button entity restarts the device.
|
||||
| update | The button entity updates the software of the device. The use of this device class should be avoided, please consider using the [`update`](/docs/core/entity/update) entity instead.
|
||||
| `ButtonDeviceClass.RESTART` | The button entity restarts the device.
|
||||
| `ButtonDeviceClass.UPDATE` | The button entity updates the software of the device. The use of this device class should be avoided, please consider using the [`update`](/docs/core/entity/update) entity instead.
|
||||
|
@ -11,16 +11,16 @@ A camera entity can display images, and optionally a video stream. Derive a plat
|
||||
Properties should always only return information from memory and not do I/O (like network requests). Implement `update()` or `async_update()` to fetch data.
|
||||
:::
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| ------------------------ | ----- | ------- | ----------------------------------------------------------------------------------------------------------------------- |
|
||||
| is_recording | bool | `None` | Indication of whether the camera is recording. Used to determine `state`. |
|
||||
| is_streaming | bool | `None` | Indication of whether the camera is streaming. Used to determine `state`. |
|
||||
| motion_detection_enabled | bool | False | Indication of whether the camera has motion detection enabled. |
|
||||
| is_on | bool | `None` | Indication camera is on. |
|
||||
| brand | str | `None` | The brand (manufacturer) of the camera. |
|
||||
| model | str | `None` | The model of the camera. |
|
||||
| frame_interval | float | 0.5 | The interval between frames of the stream. |
|
||||
| frontend_stream_type | str | None | Used with `CameraEntityFeature.STREAM` to tell the frontend which type of stream to use (`StreamType.HLS` or `StreamType.WEB_RTC`) |
|
||||
| Name | Type | Default | Description |
|
||||
| ------------------------ | ----- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| is_recording | bool | `None` | Indication of whether the camera is recording. Used to determine `state`. |
|
||||
| is_streaming | bool | `None` | Indication of whether the camera is streaming. Used to determine `state`. |
|
||||
| motion_detection_enabled | bool | False | Indication of whether the camera has motion detection enabled. |
|
||||
| is_on | bool | `None` | Indication camera is on. |
|
||||
| brand | str | `None` | The brand (manufacturer) of the camera. |
|
||||
| model | str | `None` | The model of the camera. |
|
||||
| frame_interval | float | 0.5 | The interval between frames of the stream. |
|
||||
| frontend_stream_type | str | None | Used with `CameraEntityFeature.STREAM` to tell the frontend which type of stream to use (`StreamType.HLS` or `StreamType.WEB_RTC`) |
|
||||
|
||||
## Supported Features
|
||||
|
||||
|
@ -32,16 +32,16 @@ Properties should always only return information from memory and not do I/O (lik
|
||||
|
||||
| Constant | Description
|
||||
|----------|-----------------------|
|
||||
| `DEVICE_CLASS_AWNING` | Control of an awning, such as an exterior retractible window, door, or patio cover.
|
||||
| `DEVICE_CLASS_BLIND` | Control of blinds, which are linked slats that expand or collapse to cover an opening or may be tilted to partially cover an opening, such as window blinds.
|
||||
| `DEVICE_CLASS_CURTAIN` | Control of curtains or drapes, which is often fabric hung above a window or door that can be drawn open.
|
||||
| `DEVICE_CLASS_DAMPER` | Control of a mechanical damper that reduces air flow, sound, or light.
|
||||
| `DEVICE_CLASS_DOOR` | Control of a door that provides access to an area which is typically part of a structure.
|
||||
| `DEVICE_CLASS_GARAGE` | Control of a garage door that provides access to a garage.
|
||||
| `DEVICE_CLASS_GATE` | Control of a gate that provides access to a driveway or other area. Gates are found outside of a structure and are typically part of a fence.
|
||||
| `DEVICE_CLASS_SHADE` | Control of shades, which are a continuous plane of material or connected cells that expanded or collapsed over an opening, such as window shades.
|
||||
| `DEVICE_CLASS_SHUTTER` | Control of shutters, which are linked slats that swing out/in to cover an opening or may be tilted to partially cover an opening, such as indoor or exterior window shutters.
|
||||
| `DEVICE_CLASS_WINDOW` | Control of a physical window that opens and closes or may tilt.
|
||||
| `CoverDeviceClass.AWNING` | Control of an awning, such as an exterior retractible window, door, or patio cover.
|
||||
| `CoverDeviceClass.BLIND` | Control of blinds, which are linked slats that expand or collapse to cover an opening or may be tilted to partially cover an opening, such as window blinds.
|
||||
| `CoverDeviceClass.CURTAIN` | Control of curtains or drapes, which is often fabric hung above a window or door that can be drawn open.
|
||||
| `CoverDeviceClass.DAMPER` | Control of a mechanical damper that reduces air flow, sound, or light.
|
||||
| `CoverDeviceClass.DOOR` | Control of a door that provides access to an area which is typically part of a structure.
|
||||
| `CoverDeviceClass.GARAGE` | Control of a garage door that provides access to a garage.
|
||||
| `CoverDeviceClass.GATE` | Control of a gate that provides access to a driveway or other area. Gates are found outside of a structure and are typically part of a fence.
|
||||
| `CoverDeviceClass.SHADE` | Control of shades, which are a continuous plane of material or connected cells that expanded or collapsed over an opening, such as window shades.
|
||||
| `CoverDeviceClass.SHUTTER` | Control of shutters, which are linked slats that swing out/in to cover an opening or may be tilted to partially cover an opening, such as indoor or exterior window shutters.
|
||||
| `CoverDeviceClass.WINDOW` | Control of a physical window that opens and closes or may tilt.
|
||||
|
||||
### States
|
||||
|
||||
|
@ -20,7 +20,7 @@ Properties should always only return information from memory and not do I/O (lik
|
||||
| available_modes | list | `NotImplementedError()` | The available modes. Requires `SUPPORT_MODES`. |
|
||||
| supported_features | int | (abstract method) | Bitmap of supported features. See below. |
|
||||
| is_on | bool | `None` | Whether the device is on or off. |
|
||||
| device_class | string | `None` | Either DEVICE_CLASS_HUMIDIFIER or DEVICE_CLASS_DEHUMIDIFIER |
|
||||
| device_class | string | `None` | Either `HumidifierDeviceClass.HUMIDIFIER` or `HumidiferDeviceClass,DEHUMIDIFIER` |
|
||||
|
||||
### Modes
|
||||
|
||||
|
@ -29,50 +29,50 @@ The default step value is dynamically chosen based on the range (max - min) valu
|
||||
|
||||
If specifying a device class, your number entity will need to also return the correct unit of measurement.
|
||||
|
||||
| Type | Supported units | Description
|
||||
| Constant | Supported units | Description
|
||||
| ---- | ---- | -----------
|
||||
| apparent_power | VA | Apparent power |
|
||||
| aqi | | Air Quality Index
|
||||
| atmospheric_pressure | cbar, bar, hPa, inHg, kPa, mbar, Pa, psi | Atmospheric pressure, statistics will be stored in Pa.
|
||||
| battery | % | Percentage of battery that is left
|
||||
| carbon_dioxide | ppm | Concentration of carbon dioxide.
|
||||
| carbon_monoxide | ppm | Concentration of carbon monoxide.
|
||||
| current | A, mA | Current
|
||||
| data_rate | bit/s, kbit/s, Mbit/s, Gbit/s, B/s, kB/s, MB/s, GB/s, KiB/s, MiB/s, GiB/s | Data rate
|
||||
| data_size | bit, kbit, Mbit, Gbit, B, kB, MB, GB, TB, PB, EB, ZB, YB, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB | Data size
|
||||
| distance | km, m, cm, mm, mi, yd, in | Generic distance
|
||||
| energy | Wh, kWh, MWh | Energy. Represents _power_ over _time_. Not to be confused with `power`.
|
||||
| frequency | Hz, kHz, MHz, GHz | Frequency
|
||||
| gas | m³, ft³, CCF | Volume of gas. Gas consumption measured as energy in kWh instead of a volume should be classified as energy.
|
||||
| humidity | % | Relative humidity
|
||||
| illuminance | lx | Light level
|
||||
| irradiance | W/m², BTU/(h⋅ft²) | Irradiance
|
||||
| moisture | % | Moisture
|
||||
| monetary | [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) | Monetary value with a currency.
|
||||
| nitrogen_dioxide | µg/m³ | Concentration of nitrogen dioxide |
|
||||
| nitrogen_monoxide | µg/m³ | Concentration of nitrogen monoxide |
|
||||
| nitrous_oxide | µg/m³ | Concentration of nitrous oxide |
|
||||
| ozone | µg/m³ | Concentration of ozone |
|
||||
| pm1 | µg/m³ | Concentration of particulate matter less than 1 micrometer |
|
||||
| pm25 | µg/m³ | Concentration of particulate matter less than 2.5 micrometers |
|
||||
| pm10 | µg/m³ | Concentration of particulate matter less than 10 micrometers |
|
||||
| power | W, kW | Power.
|
||||
| power_factor | % | Power Factor
|
||||
| precipitation | cm, in, mm | Precipitation
|
||||
| precipitation_intensity | in/d, in/h, mm/d, mm/h | Precipitation intensity
|
||||
| pressure | cbar, bar, hPa, inHg, kPa, mbar, Pa, psi | Pressure.
|
||||
| reactive_power | var | Reactive power |
|
||||
| signal_strength | dB, dBm | Signal strength
|
||||
| sound_pressure | dB, dBA | Sound pressure
|
||||
| speed | ft/s, in/d, in/h, km/h, kn, m/s, mph, mm/d | Generic speed
|
||||
| sulphur_dioxide | µg/m³ | Concentration of sulphure dioxide |
|
||||
| temperature | °C, °F | Temperature.
|
||||
| volatile_organic_compounds | µg/m³ | Concentration of volatile organic compounds
|
||||
| voltage | V, mV | Voltage
|
||||
| volume | L, mL, gal, fl. oz., m³, ft³, CCF | Generic volume
|
||||
| water | L, gal, m³, ft³, CCF | Water consumption
|
||||
| weight | kg, g, mg, µg, oz, lb, st | Generic mass; `weight` is used instead of `mass` to fit with every day language.
|
||||
| wind_speed | ft/s, km/h, kn, m/s, mph | Wind speed
|
||||
| `NumberDeviceClass.APPARANT_POWER` | VA | Apparent power |
|
||||
| `NumberDeviceClass.AQI` | | Air Quality Index
|
||||
| `NumberDeviceClass.ATMOSPHERIC_PRESSURE` | cbar, bar, hPa, inHg, kPa, mbar, Pa, psi | Atmospheric pressure, statistics will be stored in Pa.
|
||||
| `NumberDeviceClass.BATTERY` | % | Percentage of battery that is left
|
||||
| `NumberDeviceClass.CARBON_DIOXIDE` | ppm | Concentration of carbon dioxide.
|
||||
| `NumberDeviceClass.CARBON_MONOXIDE` | ppm | Concentration of carbon monoxide.
|
||||
| `NumberDeviceClass.CURRENT` | A, mA | Current
|
||||
| `NumberDeviceClass.DATA_RATE` | bit/s, kbit/s, Mbit/s, Gbit/s, B/s, kB/s, MB/s, GB/s, KiB/s, MiB/s, GiB/s | Data rate
|
||||
| `NumberDeviceClass.DATA_SIZE` | bit, kbit, Mbit, Gbit, B, kB, MB, GB, TB, PB, EB, ZB, YB, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB | Data size
|
||||
| `NumberDeviceClass.DISTANCE` | km, m, cm, mm, mi, yd, in | Generic distance
|
||||
| `NumberDeviceClass.ENERGY` | Wh, kWh, MWh | Energy. Represents _power_ over _time_. Not to be confused with `power`.
|
||||
| `NumberDeviceClass.FREQUENCY` | Hz, kHz, MHz, GHz | Frequency
|
||||
| `NumberDeviceClass.GAS` | m³, ft³, CCF | Volume of gas. Gas consumption measured as energy in kWh instead of a volume should be classified as energy.
|
||||
| `NumberDeviceClass.HUMIDITY` | % | Relative humidity
|
||||
| `NumberDeviceClass.ILLUMINANCE` | lx | Light level
|
||||
| `NumberDeviceClass.IRRADIANCE` | W/m², BTU/(h⋅ft²) | Irradiance
|
||||
| `NumberDeviceClass.MOISTURE` | % | Moisture
|
||||
| `NumberDeviceClass.MONETARY` | [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) | Monetary value with a currency.
|
||||
| `NumberDeviceClass.NITROGEN_DIOXIDE` | µg/m³ | Concentration of nitrogen dioxide |
|
||||
| `NumberDeviceClass.NITROGEN_MONOXIDE` | µg/m³ | Concentration of nitrogen monoxide |
|
||||
| `NumberDeviceClass.NITROUS_OXIDE` | µg/m³ | Concentration of nitrous oxide |
|
||||
| `NumberDeviceClass.OZONE` | µg/m³ | Concentration of ozone |
|
||||
| `NumberDeviceClass.PM1` | µg/m³ | Concentration of particulate matter less than 1 micrometer |
|
||||
| `NumberDeviceClass.PM25` | µg/m³ | Concentration of particulate matter less than 2.5 micrometers |
|
||||
| `NumberDeviceClass.PM10` | µg/m³ | Concentration of particulate matter less than 10 micrometers |
|
||||
| `NumberDeviceClass.POWER` | W, kW | Power.
|
||||
| `NumberDeviceClass.POWER_FACTOR` | % | Power Factor
|
||||
| `NumberDeviceClass.PRECIPITATION` | cm, in, mm | Precipitation
|
||||
| `NumberDeviceClass.PRECIPITATION_INTENSITY` | in/d, in/h, mm/d, mm/h | Precipitation intensity
|
||||
| `NumberDeviceClass.PRESSURE` | cbar, bar, hPa, inHg, kPa, mbar, Pa, psi | Pressure.
|
||||
| `NumberDeviceClass.REACTIVE_POWER` | var | Reactive power |
|
||||
| `NumberDeviceClass.SIGNAL_STRENGTH` | dB, dBm | Signal strength
|
||||
| `NumberDeviceClass.SOUND_PRESSURE` | dB, dBA | Sound pressure
|
||||
| `NumberDeviceClass.SPEED` | ft/s, in/d, in/h, km/h, kn, m/s, mph, mm/d | Generic speed
|
||||
| `NumberDeviceClass.SULPHUR_DIOXIDE` | µg/m³ | Concentration of sulphure dioxide |
|
||||
| `NumberDeviceClass.TEMPERATURE` | °C, °F | Temperature.
|
||||
| `NumberDeviceClass.VOLATILE_ORGANIC_COMPOUNDS` | µg/m³ | Concentration of volatile organic compounds
|
||||
| `NumberDeviceClass.VOLTAGE` | V, mV | Voltage
|
||||
| `NumberDeviceClass.VOLUME` | L, mL, gal, fl. oz., m³, ft³, CCF | Generic volume
|
||||
| `NumberDeviceClass.WATER` | L, gal, m³, ft³, CCF | Water consumption
|
||||
| `NumberDeviceClass.WEIGHT` | kg, g, mg, µg, oz, lb, st | Generic mass; `weight` is used instead of `mass` to fit with every day language.
|
||||
| `NumberDeviceClass.WIND_SPEED` | ft/s, km/h, kn, m/s, mph | Wind speed
|
||||
|
||||
## Restoring number states
|
||||
|
||||
|
@ -29,54 +29,54 @@ Instead of adding `extra_state_attributes` for a sensor entity, create an additi
|
||||
|
||||
If specifying a device class, your sensor entity will need to also return the correct unit of measurement.
|
||||
|
||||
| Type | Supported units | Description
|
||||
| Constant | Supported units | Description
|
||||
| ---- | ---- | -----------
|
||||
| apparent_power | VA | Apparent power |
|
||||
| aqi | | Air Quality Index
|
||||
| atmospheric_pressure | cbar, bar, hPa, inHg, kPa, mbar, Pa, psi | Atmospheric pressure, statistics will be stored in Pa.
|
||||
| battery | % | Percentage of battery that is left
|
||||
| carbon_dioxide | ppm | Concentration of carbon dioxide.
|
||||
| carbon_monoxide | ppm | Concentration of carbon monoxide.
|
||||
| current | A, mA | Current
|
||||
| data_rate | bit/s, kbit/s, Mbit/s, Gbit/s, B/s, kB/s, MB/s, GB/s, KiB/s, MiB/s, GiB/s | Data rate
|
||||
| data_size | bit, kbit, Mbit, Gbit, B, kB, MB, GB, TB, PB, EB, ZB, YB, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB | Data size
|
||||
| date | | Date. Requires `native_value` to be a Python `datetime.date` object, or `None`.
|
||||
| distance | km, m, cm, mm, mi, yd, in | Generic distance
|
||||
| duration | d, h, min, s | Time period. Should not update only due to time passing. The device or service needs to give a new data point to update.
|
||||
| energy | Wh, kWh, MWh | Energy, statistics will be stored in kWh. Represents _power_ over _time_. Not to be confused with `power`.
|
||||
| enum | | The sensor has a limited set of (non-numeric) states. The `options` property must be set to a list of possible states when using this device class.
|
||||
| frequency | Hz, kHz, MHz, GHz | Frequency
|
||||
| gas | m³, ft³, CCF | Volume of gas, statistics will be stored in m³. Gas consumption measured as energy in kWh instead of a volume should be classified as energy.
|
||||
| humidity | % | Relative humidity
|
||||
| illuminance | lx | Light level
|
||||
| irradiance | W/m², BTU/(h⋅ft²) | Irradiance
|
||||
| moisture | % | Moisture
|
||||
| monetary | [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) | Monetary value with a currency.
|
||||
| nitrogen_dioxide | µg/m³ | Concentration of nitrogen dioxide |
|
||||
| nitrogen_monoxide | µg/m³ | Concentration of nitrogen monoxide |
|
||||
| nitrous_oxide | µg/m³ | Concentration of nitrous oxide |
|
||||
| ozone | µg/m³ | Concentration of ozone |
|
||||
| pm1 | µg/m³ | Concentration of particulate matter less than 1 micrometer |
|
||||
| pm25 | µg/m³ | Concentration of particulate matter less than 2.5 micrometers |
|
||||
| pm10 | µg/m³ | Concentration of particulate matter less than 10 micrometers |
|
||||
| power | W, kW | Power, statistics will be stored in W.
|
||||
| power_factor | % | Power Factor
|
||||
| precipitation | cm, in, mm | Accumulated precipitation
|
||||
| precipitation_intensity | in/d, in/h, mm/d, mm/h | Precipitation intensity
|
||||
| pressure | cbar, bar, hPa, inHg, kPa, mbar, Pa, psi | Pressure, statistics will be stored in Pa.
|
||||
| reactive_power | var | Reactive power |
|
||||
| signal_strength | dB, dBm | Signal strength
|
||||
| sound_pressure | dB, dBA | Sound pressure
|
||||
| speed | ft/s, in/d, in/h, km/h, kn, m/s, mph, mm/d | Generic speed
|
||||
| sulphur_dioxide | µg/m³ | Concentration of sulphure dioxide |
|
||||
| temperature | °C, °F | Temperature, statistics will be stored in °C.
|
||||
| timestamp | | Timestamp. Requires `native_value` to return a Python `datetime.datetime` object, with time zone information, or `None`.
|
||||
| volatile_organic_compounds | µg/m³ | Concentration of volatile organic compounds
|
||||
| voltage | V, mV | Voltage
|
||||
| volume | L, mL, gal, fl. oz., m³, ft³, CCF | Generic volume
|
||||
| water | L, gal, m³, ft³, CCF | Water consumption
|
||||
| weight | kg, g, mg, µg, oz, lb, st | Generic mass; `weight` is used instead of `mass` to fit with every day language.
|
||||
| wind_speed | ft/s, km/h, kn, m/s, mph | Wind speed
|
||||
| `SensorDeviceClass.APPARENT_POWER` | VA | Apparent power |
|
||||
| `SensorDeviceClass.AQI` | | Air Quality Index
|
||||
| `SensorDeviceClass.ATMOSPHERIC_PRESSURE` | cbar, bar, hPa, inHg, kPa, mbar, Pa, psi | Atmospheric pressure, statistics will be stored in Pa.
|
||||
| `SensorDeviceClass.BATTERY` | % | Percentage of battery that is left
|
||||
| `SensorDeviceClass.CARBON_DIOXIDE` | ppm | Concentration of carbon dioxide.
|
||||
| `SensorDeviceClass.CARBON_MONOXIDE` | ppm | Concentration of carbon monoxide.
|
||||
| `SensorDeviceClass.CURRENT` | A, mA | Current
|
||||
| `SensorDeviceClass.DATA_RATE` | bit/s, kbit/s, Mbit/s, Gbit/s, B/s, kB/s, MB/s, GB/s, KiB/s, MiB/s, GiB/s | Data rate
|
||||
| `SensorDeviceClass.DATA_SIZE` | bit, kbit, Mbit, Gbit, B, kB, MB, GB, TB, PB, EB, ZB, YB, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB | Data size
|
||||
| `SensorDeviceClass.DATE` | | Date. Requires `native_value` to be a Python `datetime.date` object, or `None`.
|
||||
| `SensorDeviceClass.DISTANCE` | km, m, cm, mm, mi, yd, in | Generic distance
|
||||
| `SensorDeviceClass.DURATION` | d, h, min, s | Time period. Should not update only due to time passing. The device or service needs to give a new data point to update.
|
||||
| `SensorDeviceClass.ENERGY` | Wh, kWh, MWh | Energy, statistics will be stored in kWh. Represents _power_ over _time_. Not to be confused with `power`.
|
||||
| `SensorDeviceClass.ENUM` | | The sensor has a limited set of (non-numeric) states. The `options` property must be set to a list of possible states when using this device class.
|
||||
| `SensorDeviceClass.FREQUENCY` | Hz, kHz, MHz, GHz | Frequency
|
||||
| `SensorDeviceClass.GAS` | m³, ft³, CCF | Volume of gas, statistics will be stored in m³. Gas consumption measured as energy in kWh instead of a volume should be classified as energy.
|
||||
| `SensorDeviceClass.HUMIDITY` | % | Relative humidity
|
||||
| `SensorDeviceClass.ILLUMINANCE` | lx | Light level
|
||||
| `SensorDeviceClass.IRRADIANCE` | W/m², BTU/(h⋅ft²) | Irradiance
|
||||
| `SensorDeviceClass.MOISTURE` | % | Moisture
|
||||
| `SensorDeviceClass.MONETARY` | [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) | Monetary value with a currency.
|
||||
| `SensorDeviceClass.NITROGEN_DIOXIDE` | µg/m³ | Concentration of nitrogen dioxide |
|
||||
| `SensorDeviceClass.NITROGEN_MONOXIDE` | µg/m³ | Concentration of nitrogen monoxide |
|
||||
| `SensorDeviceClass.NITROUS_OXIDE` | µg/m³ | Concentration of nitrous oxide |
|
||||
| `SensorDeviceClass.OZONE` | µg/m³ | Concentration of ozone |
|
||||
| `SensorDeviceClass.PM1` | µg/m³ | Concentration of particulate matter less than 1 micrometer |
|
||||
| `SensorDeviceClass.PM25` | µg/m³ | Concentration of particulate matter less than 2.5 micrometers |
|
||||
| `SensorDeviceClass.PM10` | µg/m³ | Concentration of particulate matter less than 10 micrometers |
|
||||
| `SensorDeviceClass.POWER` | W, kW | Power, statistics will be stored in W.
|
||||
| `SensorDeviceClass.POWER_FACTOR` | % | Power Factor
|
||||
| `SensorDeviceClass.PRECIPITATION` | cm, in, mm | Accumulated precipitation
|
||||
| `SensorDeviceClass.PRECIPITATION_INTENSITY` | in/d, in/h, mm/d, mm/h | Precipitation intensity
|
||||
| `SensorDeviceClass.PRESSURE` | cbar, bar, hPa, inHg, kPa, mbar, Pa, psi | Pressure, statistics will be stored in Pa.
|
||||
| `SensorDeviceClass.REACTIVE_POWER` | var | Reactive power |
|
||||
| `SensorDeviceClass.SIGNAL_STRENGTH` | dB, dBm | Signal strength
|
||||
| `SensorDeviceClass.SOUND_PRESSURE` | dB, dBA | Sound pressure
|
||||
| `SensorDeviceClass.SPEED` | ft/s, in/d, in/h, km/h, kn, m/s, mph, mm/d | Generic speed
|
||||
| `SensorDeviceClass.SULPHUR_DIOXIDE` | µg/m³ | Concentration of sulphure dioxide |
|
||||
| `SensorDeviceClass.TEMPERATURE` | °C, °F | Temperature, statistics will be stored in °C.
|
||||
| `SensorDeviceClass.TIMESTAMP` | | Timestamp. Requires `native_value` to return a Python `datetime.datetime` object, with time zone information, or `None`.
|
||||
| `SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS` | µg/m³ | Concentration of volatile organic compounds
|
||||
| `SensorDeviceClass.VOLTAGE` | V, mV | Voltage
|
||||
| `SensorDeviceClass.VOLUME` | L, mL, gal, fl. oz., m³, ft³, CCF | Generic volume
|
||||
| `SensorDeviceClass.WATER` | L, gal, m³, ft³, CCF | Water consumption
|
||||
| `SensorDeviceClass.WEIGHT` | kg, g, mg, µg, oz, lb, st | Generic mass; `weight` is used instead of `mass` to fit with every day language.
|
||||
| `SensorDeviceClass.WIND_SPEED` | ft/s, km/h, kn, m/s, mph | Wind speed
|
||||
|
||||
### Available state classes
|
||||
|
||||
|
@ -77,7 +77,7 @@ class MySwitch(SwitchEntity):
|
||||
|
||||
Optional. What type of device this. It will possibly map to google device types.
|
||||
|
||||
| Value | Description
|
||||
| Constant | Description
|
||||
| ----- | -----------
|
||||
| outlet | Device is an outlet for power.
|
||||
| switch | Device is switch for some type of entity.
|
||||
| `SwitchDeviceClass.OUTLET` | Device is an outlet for power.
|
||||
| `SwitchDeviceClass.SWITCH` | Device is switch for some type of entity.
|
||||
|
@ -104,6 +104,6 @@ class MyUpdate(UpdateEntity):
|
||||
|
||||
Optionally specifies what type of entity it is.
|
||||
|
||||
| Value | Description
|
||||
| Constant | Description
|
||||
| ----- | -----------
|
||||
| firmware | The update is a firmware update for a device.
|
||||
| `UpdateDeviceClass.FIRMWARE` | The update is a firmware update for a device.
|
||||
|
Loading…
x
Reference in New Issue
Block a user