![]() Examples of what should be classified measurement are: current temperature, humidity or electric power. The state represents a measurement in present time, not a historical aggregation such as statistics or a prediction of the future. In most cases, state class measurement or state class total without last_reset should be chosen, this is explained further in How to choose state_class and last_reset below. Generic mass weight is used instead of mass to fit with every day language.Ĭhoose the state class for a sensor with care. Generic stored volume, this device class should be used for sensors representing a stored volume, for example the amount of fuel in a fuel tank. Generic volume, this device class should be used for sensors representing a consumption, for example the amount of fuel consumed by a vehicle. SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS_PARTS SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDSĬoncentration of volatile organic compounds Requires native_value to return a Python datetime.datetime object, with time zone information, or None. SensorDeviceClass.PRECIPITATION_INTENSITYĬbar, bar, hPa, mmHg, inHg, kPa, mbar, Pa, psiįt/s, in/d, in/h, km/h, kn, m/s, mph, mm/d Potential hydrogen (pH) of a aqueous solutionĬoncentration of particulate matter less than 1 micrometerĬoncentration of particulate matter less than 2.5 micrometersĬoncentration of particulate matter less than 10 micrometers Gas consumption measured as energy in kWh instead of a volume should be classified as energy. The options property must be set to a list of possible states when using this device class. The sensor has a limited set of (non-numeric) states. Stored energy, this device class should be used for sensors representing stored energy, for example the amount of electric energy currently stored in a battery or the capacity of a battery. The device or service needs to give a new data point to update.Įnergy, this device class should used for sensors representing energy consumption, for example an electricity meter. Should not update only due to time passing. Requires native_value to be a Python datetime.date object, or None. ConstantĬbar, bar, hPa, mmHG, inHg, kPa, mbar, Pa, psiīit/s, kbit/s, Mbit/s, Gbit/s, B/s, kB/s, MB/s, GB/s, KiB/s, MiB/s, GiB/sīit, kbit, Mbit, Gbit, B, kB, MB, GB, TB, PB, EB, ZB, YB, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiBĭate. If specifying a device class, your sensor entity will need to also return the correct unit of measurement. If extra_state_attributes and the sensor value both frequently change, this can quickly increase the size of the database. Attributes that do not change are only saved in the database once. Instead of adding extra_state_attributes for a sensor entity, create an additional sensor entity. This property is intended to be used by integrations to override automatic unit conversion rules, for example, to make a temperature sensor always display in ☌ regardless of whether the configured unit system prefers ☌ or ☏, or to make a distance sensor always display in miles even if the configured unit system is metric. For sensors without a unique_id, this will be the unit of measurement for the sensor's state. For sensors with a unique_id, this will be used as the initial unit of measurement, which users can then override. The unit of measurement to be used for the sensor's state. The number of decimals which should be used in the sensor's state when it's displayed. If not None, the sensor is assumed to be numerical and will be displayed as a line-chart in the frontend instead of as discrete values. Cannot be combined with state_class or native_unit_of_measurement. Requires the enum device class to be set. In case this sensor provides a textual state, this property can be used to provide a list of possible states. Using a device_class may restrict the types that can be returned by this property. The value of the sensor in the sensor's native_unit_of_measurement. None, datetime.date, datetime.datetime, decimal.Decimal, float, int, string If the native_unit_of_measurement is ☌ or ☏, and its device_class is temperature, the sensor's unit_of_measurement will be the preferred temperature unit configured by the user and the sensor's state will be the native_value after an optional unit conversion. The unit of measurement that the sensor's value is expressed in. When changing last_reset, the state must be a valid number. Note that the datetime.datetime returned by the last_reset property will be converted to an ISO 8601-formatted string when the entity's state attributes are updated. If the time of initialization is unknown, set it to None. ![]() The time when an accumulating sensor such as an electricity usage meter, gas meter, water meter etc. Implement update() or async_update() to fetch data. Properties should always only return information from memory and not do I/O (like network requests).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |