Skip to content

Commit 0acb45f

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent a0e4a72 commit 0acb45f

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

custom_components/adaptive_lighting/switch.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@
106106
CONF_COLOR_SUNSET_TIME,
107107
CONF_DETECT_NON_HA_CHANGES,
108108
CONF_INCLUDE_CONFIG_IN_ATTRIBUTES,
109-
CONF_INDEPENDENT_COLOR,
110109
CONF_INITIAL_TRANSITION,
111110
CONF_INTERCEPT,
112111
CONF_INTERVAL,

webapp/app.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
"""Simple web app to visualize brightness over time."""
22

3-
import sys
43
import datetime as dt
5-
from contextlib import suppress
4+
import importlib.util
5+
import sys
6+
import types
67
from pathlib import Path
78
from typing import Any
89

10+
import homeassistant_util_color
911
import matplotlib.pyplot as plt
1012
import numpy as np
1113
import shinyswatch
1214
from astral import LocationInfo
1315
from astral.location import Location
1416
from homeassistant_util_color import color_temperature_to_rgb
15-
import types
16-
import homeassistant_util_color
17-
import importlib.util
1817
from shiny import App, render, ui
1918

2019
# Mock homeassistant.util.color
@@ -26,7 +25,6 @@
2625
sys.modules["homeassistant.util.color"] = homeassistant_util_color
2726

2827

29-
3028
def date_range(tzinfo: dt.tzinfo) -> list[dt.datetime]:
3129
"""Return a list of datetimes for the current day."""
3230
start_of_day = dt.datetime.now(tzinfo).replace(
@@ -44,7 +42,12 @@ def date_range(tzinfo: dt.tzinfo) -> list[dt.datetime]:
4442

4543

4644
# Load color_and_brightness directly from file, bypassing package __init__
47-
component_path = Path(__file__).parent.parent / "custom_components" / "adaptive_lighting" / "color_and_brightness.py"
45+
component_path = (
46+
Path(__file__).parent.parent
47+
/ "custom_components"
48+
/ "adaptive_lighting"
49+
/ "color_and_brightness.py"
50+
)
4851
spec = importlib.util.spec_from_file_location("color_and_brightness", component_path)
4952
module = importlib.util.module_from_spec(spec)
5053
sys.modules["color_and_brightness"] = module
@@ -53,7 +56,6 @@ def date_range(tzinfo: dt.tzinfo) -> list[dt.datetime]:
5356
from color_and_brightness import SunLightSettings
5457

5558

56-
5759
def plot_brightness(inputs: dict[str, Any], sleep_mode: bool):
5860
"""Plot the brightness over time for different modes."""
5961
# Define the time range for our simulation
@@ -355,17 +357,13 @@ def _kw(input):
355357
"timezone": location.timezone,
356358
# Separate color timing parameters
357359
"color_sunrise_time": (
358-
float_to_time(input.color_sunrise_time())
359-
if independent_color
360-
else None
360+
float_to_time(input.color_sunrise_time()) if independent_color else None
361361
),
362362
"color_sunrise_offset": dt.timedelta(0),
363363
"color_min_sunrise_time": None,
364364
"color_max_sunrise_time": None,
365365
"color_sunset_time": (
366-
float_to_time(input.color_sunset_time())
367-
if independent_color
368-
else None
366+
float_to_time(input.color_sunset_time()) if independent_color else None
369367
),
370368
"color_sunset_offset": dt.timedelta(0),
371369
"color_min_sunset_time": None,

0 commit comments

Comments
 (0)