mirror of
https://github.com/home-assistant/core.git
synced 2026-08-17 10:44:08 +01:00
Use LightEntityStateAttribute enum in RFXtrx (#175955)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
65ba8eb006
commit
64e0d2eae0
@@ -5,7 +5,12 @@ from typing import Any, override
|
||||
|
||||
import RFXtrx as rfxtrxmod
|
||||
|
||||
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
ColorMode,
|
||||
LightEntity,
|
||||
LightEntityStateAttribute,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import STATE_ON
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
@@ -70,7 +75,9 @@ class RfxtrxLight(RfxtrxCommandEntity, LightEntity):
|
||||
old_state = await self.async_get_last_state()
|
||||
if old_state is not None:
|
||||
self._attr_is_on = old_state.state == STATE_ON
|
||||
if brightness := old_state.attributes.get(ATTR_BRIGHTNESS):
|
||||
if brightness := old_state.attributes.get(
|
||||
LightEntityStateAttribute.BRIGHTNESS
|
||||
):
|
||||
self._attr_brightness = int(brightness)
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user