Replace device class strings with enums in dev docs (#1610)

This commit is contained in:
Franck Nijhof 2023-01-03 23:37:28 +01:00 committed by GitHub
parent 7f88317945
commit dfd77cabdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 149 additions and 149 deletions

View File

@ -219,7 +219,7 @@ The below code snippet gives an example of best practices for when to implement
```py ```py
class SomeEntity(): 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): def __init__(self, device):
self._device = device self._device = device
self._attr_available = False # This overrides the default self._attr_available = False # This overrides the default

View File

@ -18,33 +18,33 @@ Properties should always only return information from memory and not do I/O (lik
### Available device classes ### Available device classes
| Value | Description | Constant | Description
| ----- | ----------- | ----- | -----------
| battery | On means low, Off means normal. | `BinarySensorDeviceClass.BATTERY` | On means low, Off means normal.
| battery_charging | On means charging, Off means not charging. | `BinarySensorDeviceClass.BATTERY_CHARGING` | On means charging, Off means not charging.
| co | On means carbon monoxide detected, Off means no carbon monoxide (clear). | `BinarySensorDeviceClass.CO` | On means carbon monoxide detected, Off means no carbon monoxide (clear).
| cold | On means cold, Off means normal. | `BinarySensorDeviceClass.COLD` | On means cold, Off means normal.
| connectivity | On means connected, Off means disconnected. | `BinarySensorDeviceClass.CONNECTIVITY` | On means connected, Off means disconnected.
| door | On means open, Off means closed. | `BinarySensorDeviceClass.DOOR` | On means open, Off means closed.
| garage_door | On means open, Off means closed. | `BinarySensorDeviceClass.GARAGE_DOOR` | On means open, Off means closed.
| gas | On means gas detected, Off means no gas (clear). | `BinarySensorDeviceClass.GAS` | On means gas detected, Off means no gas (clear).
| heat | On means hot, Off means normal. | `BinarySensorDeviceClass.HEAT` | On means hot, Off means normal.
| light | On means light detected, Off means no light. | `BinarySensorDeviceClass.LIGHT` | On means light detected, Off means no light.
| lock | On means open (unlocked), Off means closed (locked). | `BinarySensorDeviceClass.LOCK` | On means open (unlocked), Off means closed (locked).
| moisture | On means wet, Off means dry. | `BinarySensorDeviceClass.MOISTURE` | On means wet, Off means dry.
| motion | On means motion detected, Off means no motion (clear). | `BinarySensorDeviceClass.MOTION` | On means motion detected, Off means no motion (clear).
| moving | On means moving, Off means not moving (stopped). | `BinarySensorDeviceClass.MOVING` | On means moving, Off means not moving (stopped).
| occupancy | On means occupied, Off means not occupied (clear). | `BinarySensorDeviceClass.OCCUPANCY` | On means occupied, Off means not occupied (clear).
| opening | On means open, Off means closed. | `BinarySensorDeviceClass.OPENING` | On means open, Off means closed.
| plug | On means plugged in, Off means unplugged. | `BinarySensorDeviceClass.PLUG` | On means plugged in, Off means unplugged.
| power | On means power detected, Off means no power. | `BinarySensorDeviceClass.POWER` | On means power detected, Off means no power.
| presence | On means home, Off means away. | `BinarySensorDeviceClass.PRESENCE` | On means home, Off means away.
| problem | On means problem detected, Off means no problem (OK). | `BinarySensorDeviceClass.PROBLEM` | On means problem detected, Off means no problem (OK).
| running | On means running, Off means not running. | `BinarySensorDeviceClass.RUNNING` | On means running, Off means not running.
| safety | On means unsafe, Off means safe. | `BinarySensorDeviceClass.SAFETY` | On means unsafe, Off means safe.
| smoke | On means smoke detected, Off means no smoke (clear). | `BinarySensorDeviceClass.SMOKE` | On means smoke detected, Off means no smoke (clear).
| sound | On means sound detected, Off means no sound (clear). | `BinarySensorDeviceClass.SOUND` | On means sound detected, Off means no sound (clear).
| tamper | On means tampering detected, Off means no tampering (clear) | `BinarySensorDeviceClass.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. | `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.
| vibration | On means vibration detected, Off means no vibration. | `BinarySensorDeviceClass.VIBRATION` | On means vibration detected, Off means no vibration.
| window | On means open, Off means closed. | `BinarySensorDeviceClass.WINDOW` | On means open, Off means closed.

View File

@ -44,7 +44,7 @@ class MyButton(ButtonEntity):
Optionally specifies what type of entity it is. It will possibly map to Google device types. 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. | `ButtonDeviceClass.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.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.

View File

@ -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. 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 | | Name | Type | Default | Description |
| ------------------------ | ----- | ------- | ----------------------------------------------------------------------------------------------------------------------- | | ------------------------ | ----- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| is_recording | bool | `None` | Indication of whether the camera is recording. Used to determine `state`. | | 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`. | | 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. | | motion_detection_enabled | bool | False | Indication of whether the camera has motion detection enabled. |
| is_on | bool | `None` | Indication camera is on. | | is_on | bool | `None` | Indication camera is on. |
| brand | str | `None` | The brand (manufacturer) of the camera. | | brand | str | `None` | The brand (manufacturer) of the camera. |
| model | str | `None` | The model of the camera. | | model | str | `None` | The model of the camera. |
| frame_interval | float | 0.5 | The interval between frames of the stream. | | 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`) | | 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 ## Supported Features

View File

@ -32,16 +32,16 @@ Properties should always only return information from memory and not do I/O (lik
| Constant | Description | Constant | Description
|----------|-----------------------| |----------|-----------------------|
| `DEVICE_CLASS_AWNING` | Control of an awning, such as an exterior retractible window, door, or patio cover. | `CoverDeviceClass.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. | `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.
| `DEVICE_CLASS_CURTAIN` | Control of curtains or drapes, which is often fabric hung above a window or door that can be drawn open. | `CoverDeviceClass.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. | `CoverDeviceClass.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. | `CoverDeviceClass.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. | `CoverDeviceClass.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. | `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.
| `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. | `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.
| `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. | `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.
| `DEVICE_CLASS_WINDOW` | Control of a physical window that opens and closes or may tilt. | `CoverDeviceClass.WINDOW` | Control of a physical window that opens and closes or may tilt.
### States ### States

View File

@ -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`. | | available_modes | list | `NotImplementedError()` | The available modes. Requires `SUPPORT_MODES`. |
| supported_features | int | (abstract method) | Bitmap of supported features. See below. | | supported_features | int | (abstract method) | Bitmap of supported features. See below. |
| is_on | bool | `None` | Whether the device is on or off. | | 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 ### Modes

View File

@ -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. 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 | | `NumberDeviceClass.APPARANT_POWER` | VA | Apparent power |
| aqi | | Air Quality Index | `NumberDeviceClass.AQI` | | Air Quality Index
| atmospheric_pressure | cbar, bar, hPa, inHg, kPa, mbar, Pa, psi | Atmospheric pressure, statistics will be stored in Pa. | `NumberDeviceClass.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 | `NumberDeviceClass.BATTERY` | % | Percentage of battery that is left
| carbon_dioxide | ppm | Concentration of carbon dioxide. | `NumberDeviceClass.CARBON_DIOXIDE` | ppm | Concentration of carbon dioxide.
| carbon_monoxide | ppm | Concentration of carbon monoxide. | `NumberDeviceClass.CARBON_MONOXIDE` | ppm | Concentration of carbon monoxide.
| current | A, mA | Current | `NumberDeviceClass.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 | `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
| 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.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 | `NumberDeviceClass.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`. | `NumberDeviceClass.ENERGY` | Wh, kWh, MWh | Energy. Represents _power_ over _time_. Not to be confused with `power`.
| frequency | Hz, kHz, MHz, GHz | Frequency | `NumberDeviceClass.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. | `NumberDeviceClass.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 | `NumberDeviceClass.HUMIDITY` | % | Relative humidity
| illuminance | lx | Light level | `NumberDeviceClass.ILLUMINANCE` | lx | Light level
| irradiance | W/m², BTU/(h⋅ft²) | Irradiance | `NumberDeviceClass.IRRADIANCE` | W/m², BTU/(h⋅ft²) | Irradiance
| moisture | % | Moisture | `NumberDeviceClass.MOISTURE` | % | Moisture
| monetary | [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) | Monetary value with a currency. | `NumberDeviceClass.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 | | `NumberDeviceClass.NITROGEN_DIOXIDE` | µg/m³ | Concentration of nitrogen dioxide |
| nitrogen_monoxide | µg/m³ | Concentration of nitrogen monoxide | | `NumberDeviceClass.NITROGEN_MONOXIDE` | µg/m³ | Concentration of nitrogen monoxide |
| nitrous_oxide | µg/m³ | Concentration of nitrous oxide | | `NumberDeviceClass.NITROUS_OXIDE` | µg/m³ | Concentration of nitrous oxide |
| ozone | µg/m³ | Concentration of ozone | | `NumberDeviceClass.OZONE` | µg/m³ | Concentration of ozone |
| pm1 | µg/m³ | Concentration of particulate matter less than 1 micrometer | | `NumberDeviceClass.PM1` | µg/m³ | Concentration of particulate matter less than 1 micrometer |
| pm25 | µg/m³ | Concentration of particulate matter less than 2.5 micrometers | | `NumberDeviceClass.PM25` | µg/m³ | Concentration of particulate matter less than 2.5 micrometers |
| pm10 | µg/m³ | Concentration of particulate matter less than 10 micrometers | | `NumberDeviceClass.PM10` | µg/m³ | Concentration of particulate matter less than 10 micrometers |
| power | W, kW | Power. | `NumberDeviceClass.POWER` | W, kW | Power.
| power_factor | % | Power Factor | `NumberDeviceClass.POWER_FACTOR` | % | Power Factor
| precipitation | cm, in, mm | Precipitation | `NumberDeviceClass.PRECIPITATION` | cm, in, mm | Precipitation
| precipitation_intensity | in/d, in/h, mm/d, mm/h | Precipitation intensity | `NumberDeviceClass.PRECIPITATION_INTENSITY` | in/d, in/h, mm/d, mm/h | Precipitation intensity
| pressure | cbar, bar, hPa, inHg, kPa, mbar, Pa, psi | Pressure. | `NumberDeviceClass.PRESSURE` | cbar, bar, hPa, inHg, kPa, mbar, Pa, psi | Pressure.
| reactive_power | var | Reactive power | | `NumberDeviceClass.REACTIVE_POWER` | var | Reactive power |
| signal_strength | dB, dBm | Signal strength | `NumberDeviceClass.SIGNAL_STRENGTH` | dB, dBm | Signal strength
| sound_pressure | dB, dBA | Sound pressure | `NumberDeviceClass.SOUND_PRESSURE` | dB, dBA | Sound pressure
| speed | ft/s, in/d, in/h, km/h, kn, m/s, mph, mm/d | Generic speed | `NumberDeviceClass.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 | | `NumberDeviceClass.SULPHUR_DIOXIDE` | µg/m³ | Concentration of sulphure dioxide |
| temperature | °C, °F | Temperature. | `NumberDeviceClass.TEMPERATURE` | °C, °F | Temperature.
| volatile_organic_compounds | µg/m³ | Concentration of volatile organic compounds | `NumberDeviceClass.VOLATILE_ORGANIC_COMPOUNDS` | µg/m³ | Concentration of volatile organic compounds
| voltage | V, mV | Voltage | `NumberDeviceClass.VOLTAGE` | V, mV | Voltage
| volume | L, mL, gal, fl. oz., m³, ft³, CCF | Generic volume | `NumberDeviceClass.VOLUME` | L, mL, gal, fl. oz., m³, ft³, CCF | Generic volume
| water | L, gal, m³, ft³, CCF | Water consumption | `NumberDeviceClass.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. | `NumberDeviceClass.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.WIND_SPEED` | ft/s, km/h, kn, m/s, mph | Wind speed
## Restoring number states ## Restoring number states

View File

@ -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. 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 | | `SensorDeviceClass.APPARENT_POWER` | VA | Apparent power |
| aqi | | Air Quality Index | `SensorDeviceClass.AQI` | | Air Quality Index
| atmospheric_pressure | cbar, bar, hPa, inHg, kPa, mbar, Pa, psi | Atmospheric pressure, statistics will be stored in Pa. | `SensorDeviceClass.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 | `SensorDeviceClass.BATTERY` | % | Percentage of battery that is left
| carbon_dioxide | ppm | Concentration of carbon dioxide. | `SensorDeviceClass.CARBON_DIOXIDE` | ppm | Concentration of carbon dioxide.
| carbon_monoxide | ppm | Concentration of carbon monoxide. | `SensorDeviceClass.CARBON_MONOXIDE` | ppm | Concentration of carbon monoxide.
| current | A, mA | Current | `SensorDeviceClass.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 | `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
| 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.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`. | `SensorDeviceClass.DATE` | | Date. Requires `native_value` to be a Python `datetime.date` object, or `None`.
| distance | km, m, cm, mm, mi, yd, in | Generic distance | `SensorDeviceClass.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. | `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.
| energy | Wh, kWh, MWh | Energy, statistics will be stored in kWh. Represents _power_ over _time_. Not to be confused with `power`. | `SensorDeviceClass.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. | `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.
| frequency | Hz, kHz, MHz, GHz | Frequency | `SensorDeviceClass.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. | `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.
| humidity | % | Relative humidity | `SensorDeviceClass.HUMIDITY` | % | Relative humidity
| illuminance | lx | Light level | `SensorDeviceClass.ILLUMINANCE` | lx | Light level
| irradiance | W/m², BTU/(h⋅ft²) | Irradiance | `SensorDeviceClass.IRRADIANCE` | W/m², BTU/(h⋅ft²) | Irradiance
| moisture | % | Moisture | `SensorDeviceClass.MOISTURE` | % | Moisture
| monetary | [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) | Monetary value with a currency. | `SensorDeviceClass.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 | | `SensorDeviceClass.NITROGEN_DIOXIDE` | µg/m³ | Concentration of nitrogen dioxide |
| nitrogen_monoxide | µg/m³ | Concentration of nitrogen monoxide | | `SensorDeviceClass.NITROGEN_MONOXIDE` | µg/m³ | Concentration of nitrogen monoxide |
| nitrous_oxide | µg/m³ | Concentration of nitrous oxide | | `SensorDeviceClass.NITROUS_OXIDE` | µg/m³ | Concentration of nitrous oxide |
| ozone | µg/m³ | Concentration of ozone | | `SensorDeviceClass.OZONE` | µg/m³ | Concentration of ozone |
| pm1 | µg/m³ | Concentration of particulate matter less than 1 micrometer | | `SensorDeviceClass.PM1` | µg/m³ | Concentration of particulate matter less than 1 micrometer |
| pm25 | µg/m³ | Concentration of particulate matter less than 2.5 micrometers | | `SensorDeviceClass.PM25` | µg/m³ | Concentration of particulate matter less than 2.5 micrometers |
| pm10 | µg/m³ | Concentration of particulate matter less than 10 micrometers | | `SensorDeviceClass.PM10` | µg/m³ | Concentration of particulate matter less than 10 micrometers |
| power | W, kW | Power, statistics will be stored in W. | `SensorDeviceClass.POWER` | W, kW | Power, statistics will be stored in W.
| power_factor | % | Power Factor | `SensorDeviceClass.POWER_FACTOR` | % | Power Factor
| precipitation | cm, in, mm | Accumulated precipitation | `SensorDeviceClass.PRECIPITATION` | cm, in, mm | Accumulated precipitation
| precipitation_intensity | in/d, in/h, mm/d, mm/h | Precipitation intensity | `SensorDeviceClass.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. | `SensorDeviceClass.PRESSURE` | cbar, bar, hPa, inHg, kPa, mbar, Pa, psi | Pressure, statistics will be stored in Pa.
| reactive_power | var | Reactive power | | `SensorDeviceClass.REACTIVE_POWER` | var | Reactive power |
| signal_strength | dB, dBm | Signal strength | `SensorDeviceClass.SIGNAL_STRENGTH` | dB, dBm | Signal strength
| sound_pressure | dB, dBA | Sound pressure | `SensorDeviceClass.SOUND_PRESSURE` | dB, dBA | Sound pressure
| speed | ft/s, in/d, in/h, km/h, kn, m/s, mph, mm/d | Generic speed | `SensorDeviceClass.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 | | `SensorDeviceClass.SULPHUR_DIOXIDE` | µg/m³ | Concentration of sulphure dioxide |
| temperature | °C, °F | Temperature, statistics will be stored in °C. | `SensorDeviceClass.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`. | `SensorDeviceClass.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 | `SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS` | µg/m³ | Concentration of volatile organic compounds
| voltage | V, mV | Voltage | `SensorDeviceClass.VOLTAGE` | V, mV | Voltage
| volume | L, mL, gal, fl. oz., m³, ft³, CCF | Generic volume | `SensorDeviceClass.VOLUME` | L, mL, gal, fl. oz., m³, ft³, CCF | Generic volume
| water | L, gal, m³, ft³, CCF | Water consumption | `SensorDeviceClass.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. | `SensorDeviceClass.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.WIND_SPEED` | ft/s, km/h, kn, m/s, mph | Wind speed
### Available state classes ### Available state classes

View File

@ -77,7 +77,7 @@ class MySwitch(SwitchEntity):
Optional. What type of device this. It will possibly map to google device types. 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. | `SwitchDeviceClass.OUTLET` | Device is an outlet for power.
| switch | Device is switch for some type of entity. | `SwitchDeviceClass.SWITCH` | Device is switch for some type of entity.

View File

@ -104,6 +104,6 @@ class MyUpdate(UpdateEntity):
Optionally specifies what type of entity it is. 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.