Code styling tweaks to the WLED integration (#85466)
This commit is contained in:
parent
8f7aca7b69
commit
36f16b0ff2
2 changed files with 30 additions and 6 deletions
|
@ -65,10 +65,11 @@ class WLEDNightlightSwitch(WLEDEntity, SwitchEntity):
|
||||||
@property
|
@property
|
||||||
def extra_state_attributes(self) -> dict[str, Any] | None:
|
def extra_state_attributes(self) -> dict[str, Any] | None:
|
||||||
"""Return the state attributes of the entity."""
|
"""Return the state attributes of the entity."""
|
||||||
|
state = self.coordinator.data.state
|
||||||
return {
|
return {
|
||||||
ATTR_DURATION: self.coordinator.data.state.nightlight.duration,
|
ATTR_DURATION: state.nightlight.duration,
|
||||||
ATTR_FADE: self.coordinator.data.state.nightlight.fade,
|
ATTR_FADE: state.nightlight.fade,
|
||||||
ATTR_TARGET_BRIGHTNESS: self.coordinator.data.state.nightlight.target_brightness,
|
ATTR_TARGET_BRIGHTNESS: state.nightlight.target_brightness,
|
||||||
}
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -50,7 +50,10 @@ async def test_diagnostics(
|
||||||
"brightness": 127,
|
"brightness": 127,
|
||||||
"nightlight": {
|
"nightlight": {
|
||||||
"__type": "<class 'wled.models.Nightlight'>",
|
"__type": "<class 'wled.models.Nightlight'>",
|
||||||
"repr": "Nightlight(duration=60, fade=True, on=False, mode=<NightlightMode.FADE: 1>, target_brightness=0)",
|
"repr": (
|
||||||
|
"Nightlight(duration=60, fade=True, on=False,"
|
||||||
|
" mode=<NightlightMode.FADE: 1>, target_brightness=0)"
|
||||||
|
),
|
||||||
},
|
},
|
||||||
"on": True,
|
"on": True,
|
||||||
"playlist": -1,
|
"playlist": -1,
|
||||||
|
@ -58,11 +61,31 @@ async def test_diagnostics(
|
||||||
"segments": [
|
"segments": [
|
||||||
{
|
{
|
||||||
"__type": "<class 'wled.models.Segment'>",
|
"__type": "<class 'wled.models.Segment'>",
|
||||||
"repr": "Segment(brightness=127, clones=-1, color_primary=(255, 159, 0), color_secondary=(0, 0, 0), color_tertiary=(0, 0, 0), effect=Effect(effect_id=0, name='Solid'), intensity=128, length=20, on=True, palette=Palette(name='Default', palette_id=0), reverse=False, segment_id=0, selected=True, speed=32, start=0, stop=19)",
|
"repr": (
|
||||||
|
"Segment(brightness=127, clones=-1,"
|
||||||
|
" color_primary=(255, 159, 0),"
|
||||||
|
" color_secondary=(0, 0, 0),"
|
||||||
|
" color_tertiary=(0, 0, 0),"
|
||||||
|
" effect=Effect(effect_id=0, name='Solid'),"
|
||||||
|
" intensity=128, length=20, on=True,"
|
||||||
|
" palette=Palette(name='Default', palette_id=0),"
|
||||||
|
" reverse=False, segment_id=0, selected=True,"
|
||||||
|
" speed=32, start=0, stop=19)"
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type": "<class 'wled.models.Segment'>",
|
"__type": "<class 'wled.models.Segment'>",
|
||||||
"repr": "Segment(brightness=127, clones=-1, color_primary=(0, 255, 123), color_secondary=(0, 0, 0), color_tertiary=(0, 0, 0), effect=Effect(effect_id=1, name='Blink'), intensity=64, length=10, on=True, palette=Palette(name='Random Cycle', palette_id=1), reverse=True, segment_id=1, selected=True, speed=16, start=20, stop=30)",
|
"repr": (
|
||||||
|
"Segment(brightness=127, clones=-1,"
|
||||||
|
" color_primary=(0, 255, 123),"
|
||||||
|
" color_secondary=(0, 0, 0),"
|
||||||
|
" color_tertiary=(0, 0, 0),"
|
||||||
|
" effect=Effect(effect_id=1, name='Blink'),"
|
||||||
|
" intensity=64, length=10, on=True,"
|
||||||
|
" palette=Palette(name='Random Cycle', palette_id=1),"
|
||||||
|
" reverse=True, segment_id=1, selected=True,"
|
||||||
|
" speed=16, start=20, stop=30)"
|
||||||
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"sync": {
|
"sync": {
|
||||||
|
|
Loading…
Add table
Reference in a new issue