mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 12:15:08 +02:00
Avoid recording additional light attributes (#121776)
This commit is contained in:
@@ -864,6 +864,16 @@ class LightEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
|||||||
ATTR_MAX_MIREDS,
|
ATTR_MAX_MIREDS,
|
||||||
ATTR_MIN_COLOR_TEMP_KELVIN,
|
ATTR_MIN_COLOR_TEMP_KELVIN,
|
||||||
ATTR_MAX_COLOR_TEMP_KELVIN,
|
ATTR_MAX_COLOR_TEMP_KELVIN,
|
||||||
|
ATTR_BRIGHTNESS,
|
||||||
|
ATTR_COLOR_MODE,
|
||||||
|
ATTR_COLOR_TEMP,
|
||||||
|
ATTR_COLOR_TEMP_KELVIN,
|
||||||
|
ATTR_EFFECT,
|
||||||
|
ATTR_HS_COLOR,
|
||||||
|
ATTR_RGB_COLOR,
|
||||||
|
ATTR_RGBW_COLOR,
|
||||||
|
ATTR_RGBWW_COLOR,
|
||||||
|
ATTR_XY_COLOR,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -9,12 +9,23 @@ import pytest
|
|||||||
|
|
||||||
from homeassistant.components import light
|
from homeassistant.components import light
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
|
ATTR_BRIGHTNESS,
|
||||||
|
ATTR_COLOR_MODE,
|
||||||
|
ATTR_COLOR_TEMP,
|
||||||
|
ATTR_COLOR_TEMP_KELVIN,
|
||||||
|
ATTR_EFFECT,
|
||||||
ATTR_EFFECT_LIST,
|
ATTR_EFFECT_LIST,
|
||||||
|
ATTR_HS_COLOR,
|
||||||
ATTR_MAX_COLOR_TEMP_KELVIN,
|
ATTR_MAX_COLOR_TEMP_KELVIN,
|
||||||
ATTR_MAX_MIREDS,
|
ATTR_MAX_MIREDS,
|
||||||
ATTR_MIN_COLOR_TEMP_KELVIN,
|
ATTR_MIN_COLOR_TEMP_KELVIN,
|
||||||
ATTR_MIN_MIREDS,
|
ATTR_MIN_MIREDS,
|
||||||
|
ATTR_RGB_COLOR,
|
||||||
|
ATTR_RGBW_COLOR,
|
||||||
|
ATTR_RGBWW_COLOR,
|
||||||
ATTR_SUPPORTED_COLOR_MODES,
|
ATTR_SUPPORTED_COLOR_MODES,
|
||||||
|
ATTR_XY_COLOR,
|
||||||
|
DOMAIN,
|
||||||
)
|
)
|
||||||
from homeassistant.components.recorder import Recorder
|
from homeassistant.components.recorder import Recorder
|
||||||
from homeassistant.components.recorder.history import get_significant_states
|
from homeassistant.components.recorder.history import get_significant_states
|
||||||
@@ -50,7 +61,7 @@ async def test_exclude_attributes(recorder_mock: Recorder, hass: HomeAssistant)
|
|||||||
await async_wait_recording_done(hass)
|
await async_wait_recording_done(hass)
|
||||||
|
|
||||||
states = await hass.async_add_executor_job(
|
states = await hass.async_add_executor_job(
|
||||||
get_significant_states, hass, now, None, hass.states.async_entity_ids()
|
get_significant_states, hass, now, None, hass.states.async_entity_ids(DOMAIN)
|
||||||
)
|
)
|
||||||
assert len(states) >= 1
|
assert len(states) >= 1
|
||||||
for entity_states in states.values():
|
for entity_states in states.values():
|
||||||
@@ -62,3 +73,13 @@ async def test_exclude_attributes(recorder_mock: Recorder, hass: HomeAssistant)
|
|||||||
assert ATTR_FRIENDLY_NAME in state.attributes
|
assert ATTR_FRIENDLY_NAME in state.attributes
|
||||||
assert ATTR_MAX_COLOR_TEMP_KELVIN not in state.attributes
|
assert ATTR_MAX_COLOR_TEMP_KELVIN not in state.attributes
|
||||||
assert ATTR_MIN_COLOR_TEMP_KELVIN not in state.attributes
|
assert ATTR_MIN_COLOR_TEMP_KELVIN not in state.attributes
|
||||||
|
assert ATTR_BRIGHTNESS not in state.attributes
|
||||||
|
assert ATTR_COLOR_MODE not in state.attributes
|
||||||
|
assert ATTR_COLOR_TEMP not in state.attributes
|
||||||
|
assert ATTR_COLOR_TEMP_KELVIN not in state.attributes
|
||||||
|
assert ATTR_EFFECT not in state.attributes
|
||||||
|
assert ATTR_HS_COLOR not in state.attributes
|
||||||
|
assert ATTR_RGB_COLOR not in state.attributes
|
||||||
|
assert ATTR_RGBW_COLOR not in state.attributes
|
||||||
|
assert ATTR_RGBWW_COLOR not in state.attributes
|
||||||
|
assert ATTR_XY_COLOR not in state.attributes
|
||||||
|
Reference in New Issue
Block a user