Add enum device_class and state options property to sensor entities (#82489)

This commit is contained in:
Franck Nijhof 2022-12-02 09:11:15 +01:00 committed by GitHub
parent 3feea879dd
commit ce00f093d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 272 additions and 8 deletions

View file

@ -29,13 +29,14 @@ from homeassistant.const import (
VOLUME_CUBIC_FEET,
VOLUME_CUBIC_METERS,
)
from homeassistant.core import HomeAssistant, State, split_entity_id
from homeassistant.core import HomeAssistant, State, callback, split_entity_id
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.entity import entity_sources
from homeassistant.util import dt as dt_util
from . import (
ATTR_LAST_RESET,
ATTR_OPTIONS,
ATTR_STATE_CLASS,
DOMAIN,
STATE_CLASS_MEASUREMENT,
@ -724,3 +725,9 @@ def validate_statistics(
)
return validation_result
@callback
def exclude_attributes(hass: HomeAssistant) -> set[str]:
"""Exclude attributes from being recorded in the database."""
return {ATTR_OPTIONS}