Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 1, 2024
1 parent 28e9170 commit 6c2308b
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions custom_components/adaptive_lighting/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
from __future__ import annotations

import asyncio
import aiohttp
import aiohue_BenoitAnastay
import json
import datetime
import logging
import zoneinfo
from aiohue_BenoitAnastay.discovery import discover_nupnp
from copy import deepcopy
from datetime import timedelta
from typing import TYPE_CHECKING, Any, Literal

import aiohttp
import aiohue_BenoitAnastay
import homeassistant.helpers.config_validation as cv
import homeassistant.util.dt as dt_util
import ulid_transform
Expand Down Expand Up @@ -118,6 +116,7 @@
CONF_BRIGHTNESS_MODE_TIME_DARK,
CONF_BRIGHTNESS_MODE_TIME_LIGHT,
CONF_DETECT_NON_HA_CHANGES,
CONF_HUE_KEYWORD,
CONF_INCLUDE_CONFIG_IN_ATTRIBUTES,
CONF_INITIAL_TRANSITION,
CONF_INTERCEPT,
Expand Down Expand Up @@ -151,7 +150,6 @@
CONF_TRANSITION,
CONF_TURN_ON_LIGHTS,
CONF_USE_DEFAULTS,
CONF_HUE_KEYWORD,
DOMAIN,
EXTRA_VALIDATION,
ICON_BRIGHTNESS,
Expand Down Expand Up @@ -1589,9 +1587,9 @@ async def update_hue_run(self, websession, service_data: ServiceData):
return

_LOGGER.debug(
"%s: Will updates scenes containing %s",
self._name,
self.hue_keyword,
"%s: Will updates scenes containing %s",
self._name,
self.hue_keyword,
)
await self.hue_bridge.initialize()
for id in self.hue_bridge.scenes:
Expand All @@ -1607,13 +1605,19 @@ async def update_hue_run(self, websession, service_data: ServiceData):
lightstates = await scene.lightstates
for light_id in scene.lights:
try:
await scene.set_lightstate(id=light_id,on=lightstates[light_id]["on"],bri=brightness,ct=color_temp)
await scene.set_lightstate(
id=light_id,
on=lightstates[light_id]["on"],
bri=brightness,
ct=color_temp,
)
except Exception:
_LOGGER.error(
"Cannot update scene %s",
id,
)


class SimpleSwitch(SwitchEntity, RestoreEntity):
"""Representation of a Adaptive Lighting switch."""

Expand Down

0 comments on commit 6c2308b

Please sign in to comment.