mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 17:57:55 +00:00
Update black to 23.1.0 (#87188)
This commit is contained in:
parent
f7666239ff
commit
5e81d28116
@ -20,7 +20,7 @@ repos:
|
|||||||
- --remove-all-unused-imports
|
- --remove-all-unused-imports
|
||||||
stages: [manual]
|
stages: [manual]
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 22.12.0
|
rev: 23.1.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
args:
|
args:
|
||||||
|
@ -406,7 +406,6 @@ def async_enable_logging(
|
|||||||
if (err_path_exists and os.access(err_log_path, os.W_OK)) or (
|
if (err_path_exists and os.access(err_log_path, os.W_OK)) or (
|
||||||
not err_path_exists and os.access(err_dir, os.W_OK)
|
not err_path_exists and os.access(err_dir, os.W_OK)
|
||||||
):
|
):
|
||||||
|
|
||||||
err_handler: (
|
err_handler: (
|
||||||
logging.handlers.RotatingFileHandler
|
logging.handlers.RotatingFileHandler
|
||||||
| logging.handlers.TimedRotatingFileHandler
|
| logging.handlers.TimedRotatingFileHandler
|
||||||
|
@ -24,7 +24,6 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
|
|||||||
# convert title and unique_id to string
|
# convert title and unique_id to string
|
||||||
if config_entry.version == 1:
|
if config_entry.version == 1:
|
||||||
if isinstance(config_entry.unique_id, int):
|
if isinstance(config_entry.unique_id, int):
|
||||||
|
|
||||||
hass.config_entries.async_update_entry(
|
hass.config_entries.async_update_entry(
|
||||||
config_entry,
|
config_entry,
|
||||||
unique_id=str(config_entry.unique_id),
|
unique_id=str(config_entry.unique_id),
|
||||||
|
@ -88,7 +88,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
self.hass.config_entries.async_update_entry(
|
self.hass.config_entries.async_update_entry(
|
||||||
self.entry,
|
self.entry,
|
||||||
data={
|
data={
|
||||||
|
@ -270,7 +270,6 @@ class Alert(Entity):
|
|||||||
await self._send_notification_message(message)
|
await self._send_notification_message(message)
|
||||||
|
|
||||||
async def _send_notification_message(self, message: Any) -> None:
|
async def _send_notification_message(self, message: Any) -> None:
|
||||||
|
|
||||||
if not self._notifiers:
|
if not self._notifiers:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -103,7 +103,6 @@ class Auth:
|
|||||||
return dt.utcnow() < preemptive_expire_time
|
return dt.utcnow() < preemptive_expire_time
|
||||||
|
|
||||||
async def _async_request_new_token(self, lwa_params):
|
async def _async_request_new_token(self, lwa_params):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
session = aiohttp_client.async_get_clientsession(self.hass)
|
session = aiohttp_client.async_get_clientsession(self.hass)
|
||||||
async with async_timeout.timeout(10):
|
async with async_timeout.timeout(10):
|
||||||
|
@ -193,7 +193,6 @@ def resolve_slot_synonyms(key, request):
|
|||||||
and "resolutionsPerAuthority" in request["resolutions"]
|
and "resolutionsPerAuthority" in request["resolutions"]
|
||||||
and len(request["resolutions"]["resolutionsPerAuthority"]) >= 1
|
and len(request["resolutions"]["resolutionsPerAuthority"]) >= 1
|
||||||
):
|
):
|
||||||
|
|
||||||
# Extract all of the possible values from each authority with a
|
# Extract all of the possible values from each authority with a
|
||||||
# successful match
|
# successful match
|
||||||
possible_values = []
|
possible_values = []
|
||||||
|
@ -274,7 +274,6 @@ class AsusWrtRouter:
|
|||||||
entity_reg, self._entry.entry_id
|
entity_reg, self._entry.entry_id
|
||||||
)
|
)
|
||||||
for entry in track_entries:
|
for entry in track_entries:
|
||||||
|
|
||||||
if entry.domain != TRACKER_DOMAIN:
|
if entry.domain != TRACKER_DOMAIN:
|
||||||
continue
|
continue
|
||||||
device_mac = format_mac(entry.unique_id)
|
device_mac = format_mac(entry.unique_id)
|
||||||
|
@ -112,7 +112,6 @@ class AxisBinarySensor(AxisEventEntity, BinarySensorEntity):
|
|||||||
self._attr_name = self.device.api.vapix.ports[event.id].name
|
self._attr_name = self.device.api.vapix.ports[event.id].name
|
||||||
|
|
||||||
elif event.group == EventGroup.MOTION:
|
elif event.group == EventGroup.MOTION:
|
||||||
|
|
||||||
for event_topic, event_data in (
|
for event_topic, event_data in (
|
||||||
(EventTopic.FENCE_GUARD, self.device.api.vapix.fence_guard),
|
(EventTopic.FENCE_GUARD, self.device.api.vapix.fence_guard),
|
||||||
(EventTopic.LOITERING_GUARD, self.device.api.vapix.loitering_guard),
|
(EventTopic.LOITERING_GUARD, self.device.api.vapix.loitering_guard),
|
||||||
@ -120,7 +119,6 @@ class AxisBinarySensor(AxisEventEntity, BinarySensorEntity):
|
|||||||
(EventTopic.OBJECT_ANALYTICS, self.device.api.vapix.object_analytics),
|
(EventTopic.OBJECT_ANALYTICS, self.device.api.vapix.object_analytics),
|
||||||
(EventTopic.MOTION_DETECTION_4, self.device.api.vapix.vmd4),
|
(EventTopic.MOTION_DETECTION_4, self.device.api.vapix.vmd4),
|
||||||
):
|
):
|
||||||
|
|
||||||
if (
|
if (
|
||||||
event.topic_base == event_topic
|
event.topic_base == event_topic
|
||||||
and event_data
|
and event_data
|
||||||
|
@ -399,7 +399,6 @@ class BayesianBinarySensor(BinarySensorEntity):
|
|||||||
|
|
||||||
observations_by_entity: dict[str, list[Observation]] = {}
|
observations_by_entity: dict[str, list[Observation]] = {}
|
||||||
for observation in self._observations:
|
for observation in self._observations:
|
||||||
|
|
||||||
if (key := observation.entity_id) is None:
|
if (key := observation.entity_id) is None:
|
||||||
continue
|
continue
|
||||||
observations_by_entity.setdefault(key, []).append(observation)
|
observations_by_entity.setdefault(key, []).append(observation)
|
||||||
|
@ -396,7 +396,6 @@ class BluesoundPlayer(MediaPlayerEntity):
|
|||||||
_LOGGER.debug("Calling URL: %s", url)
|
_LOGGER.debug("Calling URL: %s", url)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
async with async_timeout.timeout(125):
|
async with async_timeout.timeout(125):
|
||||||
response = await self._polling_session.get(
|
response = await self._polling_session.get(
|
||||||
url, headers={CONNECTION: KEEP_ALIVE}
|
url, headers={CONNECTION: KEEP_ALIVE}
|
||||||
|
@ -12,7 +12,6 @@ from home_assistant_bluetooth import BluetoothServiceInfoBleak
|
|||||||
from homeassistant.util.dt import monotonic_time_coarse
|
from homeassistant.util.dt import monotonic_time_coarse
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
||||||
from .manager import BluetoothManager
|
from .manager import BluetoothManager
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,7 +95,6 @@ async def async_setup_entry(
|
|||||||
session: SHCSession = hass.data[DOMAIN][config_entry.entry_id][DATA_SESSION]
|
session: SHCSession = hass.data[DOMAIN][config_entry.entry_id][DATA_SESSION]
|
||||||
|
|
||||||
for switch in session.device_helper.smart_plugs:
|
for switch in session.device_helper.smart_plugs:
|
||||||
|
|
||||||
entities.append(
|
entities.append(
|
||||||
SHCSwitch(
|
SHCSwitch(
|
||||||
device=switch,
|
device=switch,
|
||||||
@ -113,7 +112,6 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
for switch in session.device_helper.light_switches:
|
for switch in session.device_helper.light_switches:
|
||||||
|
|
||||||
entities.append(
|
entities.append(
|
||||||
SHCSwitch(
|
SHCSwitch(
|
||||||
device=switch,
|
device=switch,
|
||||||
@ -124,7 +122,6 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
for switch in session.device_helper.smart_plugs_compact:
|
for switch in session.device_helper.smart_plugs_compact:
|
||||||
|
|
||||||
entities.append(
|
entities.append(
|
||||||
SHCSwitch(
|
SHCSwitch(
|
||||||
device=switch,
|
device=switch,
|
||||||
@ -135,7 +132,6 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
for switch in session.device_helper.camera_eyes:
|
for switch in session.device_helper.camera_eyes:
|
||||||
|
|
||||||
entities.append(
|
entities.append(
|
||||||
SHCSwitch(
|
SHCSwitch(
|
||||||
device=switch,
|
device=switch,
|
||||||
@ -146,7 +142,6 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
for switch in session.device_helper.camera_360:
|
for switch in session.device_helper.camera_360:
|
||||||
|
|
||||||
entities.append(
|
entities.append(
|
||||||
SHCSwitch(
|
SHCSwitch(
|
||||||
device=switch,
|
device=switch,
|
||||||
|
@ -231,7 +231,10 @@ SENSOR_DESCRIPTIONS = {
|
|||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
# UV index (-)
|
# UV index (-)
|
||||||
(BTHomeSensorDeviceClass.UV_INDEX, None,): SensorEntityDescription(
|
(
|
||||||
|
BTHomeSensorDeviceClass.UV_INDEX,
|
||||||
|
None,
|
||||||
|
): SensorEntityDescription(
|
||||||
key=f"{BTHomeSensorDeviceClass.UV_INDEX}",
|
key=f"{BTHomeSensorDeviceClass.UV_INDEX}",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
@ -256,7 +259,10 @@ SENSOR_DESCRIPTIONS = {
|
|||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
# Volume (L)
|
# Volume (L)
|
||||||
(BTHomeSensorDeviceClass.VOLUME, Units.VOLUME_LITERS,): SensorEntityDescription(
|
(
|
||||||
|
BTHomeSensorDeviceClass.VOLUME,
|
||||||
|
Units.VOLUME_LITERS,
|
||||||
|
): SensorEntityDescription(
|
||||||
key=f"{BTHomeSensorDeviceClass.VOLUME}_{Units.VOLUME_LITERS}",
|
key=f"{BTHomeSensorDeviceClass.VOLUME}_{Units.VOLUME_LITERS}",
|
||||||
device_class=SensorDeviceClass.VOLUME,
|
device_class=SensorDeviceClass.VOLUME,
|
||||||
native_unit_of_measurement=UnitOfVolume.LITERS,
|
native_unit_of_measurement=UnitOfVolume.LITERS,
|
||||||
|
@ -735,7 +735,6 @@ class BrSensor(SensorEntity):
|
|||||||
or sensor_type.endswith("_4d")
|
or sensor_type.endswith("_4d")
|
||||||
or sensor_type.endswith("_5d")
|
or sensor_type.endswith("_5d")
|
||||||
):
|
):
|
||||||
|
|
||||||
# update forecasting sensors:
|
# update forecasting sensors:
|
||||||
fcday = 0
|
fcday = 0
|
||||||
if sensor_type.endswith("_2d"):
|
if sensor_type.endswith("_2d"):
|
||||||
|
@ -96,7 +96,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
errors = {}
|
errors = {}
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
|
||||||
hub = Control4Validator(
|
hub = Control4Validator(
|
||||||
user_input[CONF_HOST],
|
user_input[CONF_HOST],
|
||||||
user_input[CONF_USERNAME],
|
user_input[CONF_USERNAME],
|
||||||
|
@ -188,6 +188,7 @@ class DarkSkyWeather(WeatherEntity):
|
|||||||
@property
|
@property
|
||||||
def forecast(self):
|
def forecast(self):
|
||||||
"""Return the forecast array."""
|
"""Return the forecast array."""
|
||||||
|
|
||||||
# Per conversation with Joshua Reyes of Dark Sky, to get the total
|
# Per conversation with Joshua Reyes of Dark Sky, to get the total
|
||||||
# forecasted precipitation, you have to multiple the intensity by
|
# forecasted precipitation, you have to multiple the intensity by
|
||||||
# the hours for the forecast interval
|
# the hours for the forecast interval
|
||||||
|
@ -271,7 +271,6 @@ class DeconzBinarySensor(DeconzDevice[SensorResources], BinarySensorEntity):
|
|||||||
attr[ATTR_TEMPERATURE] = self._device.internal_temperature
|
attr[ATTR_TEMPERATURE] = self._device.internal_temperature
|
||||||
|
|
||||||
if isinstance(self._device, Presence):
|
if isinstance(self._device, Presence):
|
||||||
|
|
||||||
if self._device.dark is not None:
|
if self._device.dark is not None:
|
||||||
attr[ATTR_DARK] = self._device.dark
|
attr[ATTR_DARK] = self._device.dark
|
||||||
|
|
||||||
|
@ -87,7 +87,6 @@ class DeconzFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
If no bridge is found allow user to manually input configuration.
|
If no bridge is found allow user to manually input configuration.
|
||||||
"""
|
"""
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
|
||||||
if user_input[CONF_HOST] == CONF_MANUAL_INPUT:
|
if user_input[CONF_HOST] == CONF_MANUAL_INPUT:
|
||||||
return await self.async_step_manual_input()
|
return await self.async_step_manual_input()
|
||||||
|
|
||||||
|
@ -372,7 +372,6 @@ class DeconzSensor(DeconzDevice[SensorResources], SensorEntity):
|
|||||||
attr[ATTR_DAYLIGHT] = self._device.daylight
|
attr[ATTR_DAYLIGHT] = self._device.daylight
|
||||||
|
|
||||||
elif isinstance(self._device, LightLevel):
|
elif isinstance(self._device, LightLevel):
|
||||||
|
|
||||||
if self._device.dark is not None:
|
if self._device.dark is not None:
|
||||||
attr[ATTR_DARK] = self._device.dark
|
attr[ATTR_DARK] = self._device.dark
|
||||||
|
|
||||||
|
@ -186,10 +186,8 @@ async def async_remove_orphaned_entries_service(gateway: DeconzGateway) -> None:
|
|||||||
devices_to_be_removed.remove(event.device_id)
|
devices_to_be_removed.remove(event.device_id)
|
||||||
|
|
||||||
for entry in entity_entries:
|
for entry in entity_entries:
|
||||||
|
|
||||||
# Don't remove available entities
|
# Don't remove available entities
|
||||||
if entry.unique_id in gateway.entities[entry.domain]:
|
if entry.unique_id in gateway.entities[entry.domain]:
|
||||||
|
|
||||||
# Don't remove devices with available entities
|
# Don't remove devices with available entities
|
||||||
if entry.device_id in devices_to_be_removed:
|
if entry.device_id in devices_to_be_removed:
|
||||||
devices_to_be_removed.remove(entry.device_id)
|
devices_to_be_removed.remove(entry.device_id)
|
||||||
|
@ -121,6 +121,6 @@ class DeLijnPublicTransportSensor(SensorEntity):
|
|||||||
self._attr_extra_state_attributes["next_passages"] = self.line.passages
|
self._attr_extra_state_attributes["next_passages"] = self.line.passages
|
||||||
|
|
||||||
self._attr_available = True
|
self._attr_available = True
|
||||||
except (KeyError) as error:
|
except KeyError as error:
|
||||||
_LOGGER.error("Invalid data received from De Lijn: %s", error)
|
_LOGGER.error("Invalid data received from De Lijn: %s", error)
|
||||||
self._attr_available = False
|
self._attr_available = False
|
||||||
|
@ -245,7 +245,7 @@ class DerivativeSensor(RestoreEntity, SensorEntity):
|
|||||||
derivative = new_derivative
|
derivative = new_derivative
|
||||||
else:
|
else:
|
||||||
derivative = Decimal(0)
|
derivative = Decimal(0)
|
||||||
for (start, end, value) in self._state_list:
|
for start, end, value in self._state_list:
|
||||||
weight = calculate_weight(start, end, new_state.last_updated)
|
weight = calculate_weight(start, end, new_state.last_updated)
|
||||||
derivative = derivative + (value * Decimal(weight))
|
derivative = derivative + (value * Decimal(weight))
|
||||||
|
|
||||||
|
@ -214,7 +214,6 @@ async def activate_automation( # noqa: C901
|
|||||||
elif start_point and start_point < now < get_astral_event_next(
|
elif start_point and start_point < now < get_astral_event_next(
|
||||||
hass, SUN_EVENT_SUNSET
|
hass, SUN_EVENT_SUNSET
|
||||||
):
|
):
|
||||||
|
|
||||||
# Check for every light if it would be on if someone was home
|
# Check for every light if it would be on if someone was home
|
||||||
# when the fading in started and turn it on if so
|
# when the fading in started and turn it on if so
|
||||||
for index, light_id in enumerate(light_ids):
|
for index, light_id in enumerate(light_ids):
|
||||||
|
@ -93,7 +93,6 @@ class DnsIPConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
errors = {}
|
errors = {}
|
||||||
|
|
||||||
if user_input:
|
if user_input:
|
||||||
|
|
||||||
hostname = user_input[CONF_HOSTNAME]
|
hostname = user_input[CONF_HOSTNAME]
|
||||||
name = DEFAULT_NAME if hostname == DEFAULT_HOSTNAME else hostname
|
name = DEFAULT_NAME if hostname == DEFAULT_HOSTNAME else hostname
|
||||||
resolver = user_input.get(CONF_RESOLVER, DEFAULT_RESOLVER)
|
resolver = user_input.get(CONF_RESOLVER, DEFAULT_RESOLVER)
|
||||||
|
@ -255,7 +255,6 @@ class Doods(ImageProcessingEntity):
|
|||||||
)
|
)
|
||||||
|
|
||||||
for label, values in matches.items():
|
for label, values in matches.items():
|
||||||
|
|
||||||
# Draw custom label regions/areas
|
# Draw custom label regions/areas
|
||||||
if label in self._label_areas and self._label_areas[label] != [0, 0, 1, 1]:
|
if label in self._label_areas and self._label_areas[label] != [0, 0, 1, 1]:
|
||||||
box_label = f"{label.capitalize()} Detection Area"
|
box_label = f"{label.capitalize()} Detection Area"
|
||||||
|
@ -66,7 +66,6 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
server_address = (conf.get(CONF_HOST), conf.get(CONF_PORT))
|
server_address = (conf.get(CONF_HOST), conf.get(CONF_PORT))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
ebusdpy.init(server_address)
|
ebusdpy.init(server_address)
|
||||||
hass.data[DOMAIN] = EbusdData(server_address, circuit)
|
hass.data[DOMAIN] = EbusdData(server_address, circuit)
|
||||||
|
|
||||||
|
@ -160,7 +160,6 @@ class EcovacsVacuum(VacuumEntity):
|
|||||||
def set_fan_speed(self, fan_speed: str, **kwargs: Any) -> None:
|
def set_fan_speed(self, fan_speed: str, **kwargs: Any) -> None:
|
||||||
"""Set fan speed."""
|
"""Set fan speed."""
|
||||||
if self.is_on:
|
if self.is_on:
|
||||||
|
|
||||||
self.device.run(sucks.Clean(mode=self.device.clean_status, speed=fan_speed))
|
self.device.run(sucks.Clean(mode=self.device.clean_status, speed=fan_speed))
|
||||||
|
|
||||||
def send_command(
|
def send_command(
|
||||||
|
@ -87,7 +87,7 @@ class SmartPlugSwitch(SwitchEntity):
|
|||||||
self._state = self._pca.get_state(self._device_id)
|
self._state = self._pca.get_state(self._device_id)
|
||||||
self._available = True
|
self._available = True
|
||||||
|
|
||||||
except (OSError) as ex:
|
except OSError as ex:
|
||||||
if self._available:
|
if self._available:
|
||||||
_LOGGER.warning("Could not read state for %s: %s", self.name, ex)
|
_LOGGER.warning("Could not read state for %s: %s", self.name, ex)
|
||||||
self._available = False
|
self._available = False
|
||||||
|
@ -106,7 +106,6 @@ def setup_platform(
|
|||||||
sensors = []
|
sensors = []
|
||||||
|
|
||||||
for elem in data.data:
|
for elem in data.data:
|
||||||
|
|
||||||
if exclude_feeds is not None and int(elem["id"]) in exclude_feeds:
|
if exclude_feeds is not None and int(elem["id"]) in exclude_feeds:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ class HueOneLightChangeView(HomeAssistantView):
|
|||||||
else:
|
else:
|
||||||
parsed[STATE_ON] = entity.state != STATE_OFF
|
parsed[STATE_ON] = entity.state != STATE_OFF
|
||||||
|
|
||||||
for (key, attr) in (
|
for key, attr in (
|
||||||
(HUE_API_STATE_BRI, STATE_BRIGHTNESS),
|
(HUE_API_STATE_BRI, STATE_BRIGHTNESS),
|
||||||
(HUE_API_STATE_HUE, STATE_HUE),
|
(HUE_API_STATE_HUE, STATE_HUE),
|
||||||
(HUE_API_STATE_SAT, STATE_SATURATION),
|
(HUE_API_STATE_SAT, STATE_SATURATION),
|
||||||
@ -587,7 +587,7 @@ class HueOneLightChangeView(HomeAssistantView):
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
for (key, val) in (
|
for key, val in (
|
||||||
(STATE_BRIGHTNESS, HUE_API_STATE_BRI),
|
(STATE_BRIGHTNESS, HUE_API_STATE_BRI),
|
||||||
(STATE_HUE, HUE_API_STATE_HUE),
|
(STATE_HUE, HUE_API_STATE_HUE),
|
||||||
(STATE_SATURATION, HUE_API_STATE_SAT),
|
(STATE_SATURATION, HUE_API_STATE_SAT),
|
||||||
@ -705,7 +705,7 @@ def get_entity_state_dict(config: Config, entity: State) -> dict[str, Any]:
|
|||||||
data[STATE_SATURATION] = 0
|
data[STATE_SATURATION] = 0
|
||||||
|
|
||||||
# Clamp brightness, hue, saturation, and color temp to valid values
|
# Clamp brightness, hue, saturation, and color temp to valid values
|
||||||
for (key, v_min, v_max) in (
|
for key, v_min, v_max in (
|
||||||
(STATE_BRIGHTNESS, HUE_API_STATE_BRI_MIN, HUE_API_STATE_BRI_MAX),
|
(STATE_BRIGHTNESS, HUE_API_STATE_BRI_MIN, HUE_API_STATE_BRI_MAX),
|
||||||
(STATE_HUE, HUE_API_STATE_HUE_MIN, HUE_API_STATE_HUE_MAX),
|
(STATE_HUE, HUE_API_STATE_HUE_MIN, HUE_API_STATE_HUE_MAX),
|
||||||
(STATE_SATURATION, HUE_API_STATE_SAT_MIN, HUE_API_STATE_SAT_MAX),
|
(STATE_SATURATION, HUE_API_STATE_SAT_MIN, HUE_API_STATE_SAT_MAX),
|
||||||
|
@ -21,7 +21,6 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
async def _async_has_devices(hass: HomeAssistant) -> bool:
|
async def _async_has_devices(hass: HomeAssistant) -> bool:
|
||||||
|
|
||||||
controller_ready = asyncio.Event()
|
controller_ready = asyncio.Event()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
@ -66,7 +66,6 @@ async def async_setup_entry(
|
|||||||
camera_entities = []
|
camera_entities = []
|
||||||
|
|
||||||
for camera, value in coordinator.data.items():
|
for camera, value in coordinator.data.items():
|
||||||
|
|
||||||
camera_rtsp_entry = [
|
camera_rtsp_entry = [
|
||||||
item
|
item
|
||||||
for item in hass.config_entries.async_entries(DOMAIN)
|
for item in hass.config_entries.async_entries(DOMAIN)
|
||||||
@ -81,7 +80,6 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if camera_rtsp_entry:
|
if camera_rtsp_entry:
|
||||||
|
|
||||||
ffmpeg_arguments = camera_rtsp_entry[0].options[CONF_FFMPEG_ARGUMENTS]
|
ffmpeg_arguments = camera_rtsp_entry[0].options[CONF_FFMPEG_ARGUMENTS]
|
||||||
camera_username = camera_rtsp_entry[0].data[CONF_USERNAME]
|
camera_username = camera_rtsp_entry[0].data[CONF_USERNAME]
|
||||||
camera_password = camera_rtsp_entry[0].data[CONF_PASSWORD]
|
camera_password = camera_rtsp_entry[0].data[CONF_PASSWORD]
|
||||||
@ -96,7 +94,6 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
discovery_flow.async_create_flow(
|
discovery_flow.async_create_flow(
|
||||||
hass,
|
hass,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
@ -182,7 +182,6 @@ class EzvizConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
errors = {}
|
errors = {}
|
||||||
|
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
|
||||||
if user_input[CONF_URL] == CONF_CUSTOMIZE:
|
if user_input[CONF_URL] == CONF_CUSTOMIZE:
|
||||||
self.context["data"] = {
|
self.context["data"] = {
|
||||||
CONF_USERNAME: user_input[CONF_USERNAME],
|
CONF_USERNAME: user_input[CONF_USERNAME],
|
||||||
|
@ -25,7 +25,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
errors = {}
|
errors = {}
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
|
||||||
await self.async_set_unique_id(user_input[CONF_ID])
|
await self.async_set_unique_id(user_input[CONF_ID])
|
||||||
self._abort_if_unique_id_configured()
|
self._abort_if_unique_id_configured()
|
||||||
|
|
||||||
|
@ -507,7 +507,6 @@ class RangeFilter(Filter, SensorEntity):
|
|||||||
new_state_value = cast(float, new_state.state)
|
new_state_value = cast(float, new_state.state)
|
||||||
|
|
||||||
if self._upper_bound is not None and new_state_value > self._upper_bound:
|
if self._upper_bound is not None and new_state_value > self._upper_bound:
|
||||||
|
|
||||||
self._stats_internal["erasures_up"] += 1
|
self._stats_internal["erasures_up"] += 1
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
@ -519,7 +518,6 @@ class RangeFilter(Filter, SensorEntity):
|
|||||||
new_state.state = self._upper_bound
|
new_state.state = self._upper_bound
|
||||||
|
|
||||||
elif self._lower_bound is not None and new_state_value < self._lower_bound:
|
elif self._lower_bound is not None and new_state_value < self._lower_bound:
|
||||||
|
|
||||||
self._stats_internal["erasures_low"] += 1
|
self._stats_internal["erasures_low"] += 1
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
@ -564,7 +562,6 @@ class OutlierFilter(Filter, SensorEntity):
|
|||||||
len(self.states) == self.states.maxlen
|
len(self.states) == self.states.maxlen
|
||||||
and abs(new_state_value - median) > self._radius
|
and abs(new_state_value - median) > self._radius
|
||||||
):
|
):
|
||||||
|
|
||||||
self._stats_internal["erasures"] += 1
|
self._stats_internal["erasures"] += 1
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
|
@ -208,7 +208,6 @@ class FinTsClient:
|
|||||||
holdings_accounts = []
|
holdings_accounts = []
|
||||||
|
|
||||||
for account in self.client.get_sepa_accounts():
|
for account in self.client.get_sepa_accounts():
|
||||||
|
|
||||||
if self.is_balance_account(account):
|
if self.is_balance_account(account):
|
||||||
balance_accounts.append(account)
|
balance_accounts.append(account)
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
|
|||||||
_LOGGER.debug("Closing Firmata board %s", config_entry.data[CONF_NAME])
|
_LOGGER.debug("Closing Firmata board %s", config_entry.data[CONF_NAME])
|
||||||
|
|
||||||
unload_entries = []
|
unload_entries = []
|
||||||
for (conf, platform) in CONF_PLATFORM_MAP.items():
|
for conf, platform in CONF_PLATFORM_MAP.items():
|
||||||
if conf in config_entry.data:
|
if conf in config_entry.data:
|
||||||
unload_entries.append(
|
unload_entries.append(
|
||||||
hass.config_entries.async_forward_entry_unload(config_entry, platform)
|
hass.config_entries.async_forward_entry_unload(config_entry, platform)
|
||||||
|
@ -86,7 +86,6 @@ class FleetGoDeviceScanner:
|
|||||||
|
|
||||||
for device in devices:
|
for device in devices:
|
||||||
if not self._include or device.license_plate in self._include:
|
if not self._include or device.license_plate in self._include:
|
||||||
|
|
||||||
if device.active or device.current_address is None:
|
if device.active or device.current_address is None:
|
||||||
device.get_map_details()
|
device.get_map_details()
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class FliprDataUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
data = await self.hass.async_add_executor_job(
|
data = await self.hass.async_add_executor_job(
|
||||||
self.client.get_pool_measure_latest, self.flipr_id
|
self.client.get_pool_measure_latest, self.flipr_id
|
||||||
)
|
)
|
||||||
except (FliprError) as error:
|
except FliprError as error:
|
||||||
raise UpdateFailed(error) from error
|
raise UpdateFailed(error) from error
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
@ -43,7 +43,7 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
await self.send_presence_ping()
|
await self.send_presence_ping()
|
||||||
await self._update_device()
|
await self._update_device()
|
||||||
await self._update_consumption_data()
|
await self._update_consumption_data()
|
||||||
except (RequestError) as error:
|
except RequestError as error:
|
||||||
raise UpdateFailed(error) from error
|
raise UpdateFailed(error) from error
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -97,7 +97,6 @@ async def async_setup_entry(
|
|||||||
]
|
]
|
||||||
flume_entity_list = []
|
flume_entity_list = []
|
||||||
for device in flume_devices:
|
for device in flume_devices:
|
||||||
|
|
||||||
device_id = device[KEY_DEVICE_ID]
|
device_id = device[KEY_DEVICE_ID]
|
||||||
device_timezone = device[KEY_DEVICE_LOCATION][KEY_DEVICE_LOCATION_TIMEZONE]
|
device_timezone = device[KEY_DEVICE_LOCATION][KEY_DEVICE_LOCATION_TIMEZONE]
|
||||||
device_location_name = device[KEY_DEVICE_LOCATION][KEY_DEVICE_LOCATION_NAME]
|
device_location_name = device[KEY_DEVICE_LOCATION][KEY_DEVICE_LOCATION_NAME]
|
||||||
|
@ -102,7 +102,6 @@ async def _async_port_entities_list(
|
|||||||
_LOGGER.debug("IP source for %s is %s", avm_wrapper.host, local_ip)
|
_LOGGER.debug("IP source for %s is %s", avm_wrapper.host, local_ip)
|
||||||
|
|
||||||
for i in range(port_forwards_count):
|
for i in range(port_forwards_count):
|
||||||
|
|
||||||
portmap = await avm_wrapper.async_get_port_mapping(
|
portmap = await avm_wrapper.async_get_port_mapping(
|
||||||
avm_wrapper.device_conn_type, i
|
avm_wrapper.device_conn_type, i
|
||||||
)
|
)
|
||||||
@ -406,7 +405,6 @@ class FritzBoxPortSwitch(FritzBoxBaseSwitch, SwitchEntity):
|
|||||||
self._attributes[attr] = self.port_mapping[key]
|
self._attributes[attr] = self.port_mapping[key]
|
||||||
|
|
||||||
async def _async_switch_on_off_executor(self, turn_on: bool) -> bool:
|
async def _async_switch_on_off_executor(self, turn_on: bool) -> bool:
|
||||||
|
|
||||||
if self.port_mapping is None:
|
if self.port_mapping is None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -262,7 +262,6 @@ async def async_setup_entry(
|
|||||||
if entity_id := ent_reg.async_get_entity_id(
|
if entity_id := ent_reg.async_get_entity_id(
|
||||||
Platform.SENSOR, DOMAIN, old_unique_id
|
Platform.SENSOR, DOMAIN, old_unique_id
|
||||||
):
|
):
|
||||||
|
|
||||||
ent_reg.async_update_entity(
|
ent_reg.async_update_entity(
|
||||||
entity_id, new_unique_id=f"{config_entry.entry_id}-{new_key}"
|
entity_id, new_unique_id=f"{config_entry.entry_id}-{new_key}"
|
||||||
)
|
)
|
||||||
|
@ -289,7 +289,6 @@ class AbstractConfig(ABC):
|
|||||||
return
|
return
|
||||||
|
|
||||||
for user_agent_id, _ in self._store.agent_user_ids.items():
|
for user_agent_id, _ in self._store.agent_user_ids.items():
|
||||||
|
|
||||||
if (webhook_id := self.get_local_webhook_id(user_agent_id)) is None:
|
if (webhook_id := self.get_local_webhook_id(user_agent_id)) is None:
|
||||||
setup_successful = False
|
setup_successful = False
|
||||||
break
|
break
|
||||||
|
@ -64,7 +64,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
errors = {}
|
errors = {}
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
validated = await validate_input(user_input)
|
validated = await validate_input(user_input)
|
||||||
except CannotConnect:
|
except CannotConnect:
|
||||||
|
@ -316,7 +316,12 @@ class HomematicipHeatingGroup(HomematicipGenericEntity, ClimateEntity):
|
|||||||
@property
|
@property
|
||||||
def _first_radiator_thermostat(
|
def _first_radiator_thermostat(
|
||||||
self,
|
self,
|
||||||
) -> AsyncHeatingThermostat | AsyncHeatingThermostatCompact | AsyncHeatingThermostatEvo | None:
|
) -> (
|
||||||
|
AsyncHeatingThermostat
|
||||||
|
| AsyncHeatingThermostatCompact
|
||||||
|
| AsyncHeatingThermostatEvo
|
||||||
|
| None
|
||||||
|
):
|
||||||
"""Return the first radiator thermostat from the hmip heating group."""
|
"""Return the first radiator thermostat from the hmip heating group."""
|
||||||
for device in self._device.devices:
|
for device in self._device.devices:
|
||||||
if isinstance(
|
if isinstance(
|
||||||
|
@ -343,7 +343,6 @@ class HoneywellUSThermostat(ClimateEntity):
|
|||||||
_LOGGER.error("Can not get system mode")
|
_LOGGER.error("Can not get system mode")
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
|
||||||
# Set permanent hold
|
# Set permanent hold
|
||||||
# and Set temperature
|
# and Set temperature
|
||||||
if mode in COOLING_MODES:
|
if mode in COOLING_MODES:
|
||||||
|
@ -67,7 +67,6 @@ class HoneywellConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
self.hass.config_entries.async_update_entry(
|
self.hass.config_entries.async_update_entry(
|
||||||
self.entry,
|
self.entry,
|
||||||
data={
|
data={
|
||||||
|
@ -92,7 +92,6 @@ async def handle_v2_migration(hass: core.HomeAssistant, entry: ConfigEntry) -> N
|
|||||||
|
|
||||||
# initialize bridge connection just for the migration
|
# initialize bridge connection just for the migration
|
||||||
async with HueBridgeV2(host, api_key) as api:
|
async with HueBridgeV2(host, api_key) as api:
|
||||||
|
|
||||||
sensor_class_mapping = {
|
sensor_class_mapping = {
|
||||||
SensorDeviceClass.BATTERY.value: ResourceTypes.DEVICE_POWER,
|
SensorDeviceClass.BATTERY.value: ResourceTypes.DEVICE_POWER,
|
||||||
BinarySensorDeviceClass.MOTION.value: ResourceTypes.MOTION,
|
BinarySensorDeviceClass.MOTION.value: ResourceTypes.MOTION,
|
||||||
@ -130,7 +129,6 @@ async def handle_v2_migration(hass: core.HomeAssistant, entry: ConfigEntry) -> N
|
|||||||
|
|
||||||
# loop through all entities for device and find match
|
# loop through all entities for device and find match
|
||||||
for ent in async_entries_for_device(ent_reg, hass_dev_id, True):
|
for ent in async_entries_for_device(ent_reg, hass_dev_id, True):
|
||||||
|
|
||||||
if ent.entity_id.startswith("light"):
|
if ent.entity_id.startswith("light"):
|
||||||
# migrate light
|
# migrate light
|
||||||
# should always return one lightid here
|
# should always return one lightid here
|
||||||
|
@ -48,7 +48,6 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
for partial_station in station_information.get("partialStations", []):
|
for partial_station in station_information.get("partialStations", []):
|
||||||
for elevator in partial_station.get("elevators", []):
|
for elevator in partial_station.get("elevators", []):
|
||||||
|
|
||||||
state = elevator.get("state") != "READY"
|
state = elevator.get("state") != "READY"
|
||||||
available = elevator.get("state") != "UNKNOWN"
|
available = elevator.get("state") != "UNKNOWN"
|
||||||
label = elevator.get("label")
|
label = elevator.get("label")
|
||||||
|
@ -81,7 +81,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
async def async_step_station(self, user_input=None):
|
async def async_step_station(self, user_input=None):
|
||||||
"""Handle the step where the user inputs his/her station."""
|
"""Handle the step where the user inputs his/her station."""
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
|
||||||
errors = {}
|
errors = {}
|
||||||
|
|
||||||
check_name = await self.hub.gti.checkName(
|
check_name = await self.hub.gti.checkName(
|
||||||
@ -145,7 +144,6 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
"""Manage the options."""
|
"""Manage the options."""
|
||||||
errors = {}
|
errors = {}
|
||||||
if not self.departure_filters:
|
if not self.departure_filters:
|
||||||
|
|
||||||
departure_list = {}
|
departure_list = {}
|
||||||
hub: GTIHub = self.hass.data[DOMAIN][self.config_entry.entry_id]
|
hub: GTIHub = self.hass.data[DOMAIN][self.config_entry.entry_id]
|
||||||
|
|
||||||
@ -172,7 +170,6 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if user_input is not None and not errors:
|
if user_input is not None and not errors:
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
CONF_FILTER: [
|
CONF_FILTER: [
|
||||||
self.departure_filters[x] for x in user_input[CONF_FILTER]
|
self.departure_filters[x] for x in user_input[CONF_FILTER]
|
||||||
|
@ -259,7 +259,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
for device_entry in dr.async_entries_for_config_entry(
|
for device_entry in dr.async_entries_for_config_entry(
|
||||||
device_registry, entry.entry_id
|
device_registry, entry.entry_id
|
||||||
):
|
):
|
||||||
for (kind, key) in device_entry.identifiers:
|
for kind, key in device_entry.identifiers:
|
||||||
if kind == DOMAIN and key in known_devices:
|
if kind == DOMAIN and key in known_devices:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
@ -77,7 +77,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
target_keys[target] = api_keys[target]
|
target_keys[target] = api_keys[target]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
for target, key in target_keys.items():
|
for target, key in target_keys.items():
|
||||||
res = pyfttt.send_event(key, event, value1, value2, value3)
|
res = pyfttt.send_event(key, event, value1, value2, value3)
|
||||||
if res.status_code != HTTPStatus.OK:
|
if res.status_code != HTTPStatus.OK:
|
||||||
|
@ -119,7 +119,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
|
||||||
control_schema = vol.Schema(
|
control_schema = vol.Schema(
|
||||||
{
|
{
|
||||||
vol.Required(
|
vol.Required(
|
||||||
|
@ -33,7 +33,6 @@ class IntellifireDataUpdateCoordinator(DataUpdateCoordinator[IntellifirePollData
|
|||||||
self._api = api
|
self._api = api
|
||||||
|
|
||||||
async def _async_update_data(self) -> IntellifirePollData:
|
async def _async_update_data(self) -> IntellifirePollData:
|
||||||
|
|
||||||
if not self._api.is_polling_in_background:
|
if not self._api.is_polling_in_background:
|
||||||
LOGGER.info("Starting Intellifire Background Polling Loop")
|
LOGGER.info("Starting Intellifire Background Polling Loop")
|
||||||
await self._api.start_background_polling()
|
await self._api.start_background_polling()
|
||||||
|
@ -95,7 +95,7 @@ async def async_setup_entry(
|
|||||||
entities_by_address[node.address] = entity
|
entities_by_address[node.address] = entity
|
||||||
|
|
||||||
# Handle some special child node cases for Insteon Devices
|
# Handle some special child node cases for Insteon Devices
|
||||||
for (node, device_class, device_type, device_info) in child_nodes:
|
for node, device_class, device_type, device_info in child_nodes:
|
||||||
subnode_id = int(node.address.split(" ")[-1], 16)
|
subnode_id = int(node.address.split(" ")[-1], 16)
|
||||||
# Handle Insteon Thermostats
|
# Handle Insteon Thermostats
|
||||||
if device_type is not None and device_type.startswith(TYPE_CATEGORY_CLIMATE):
|
if device_type is not None and device_type.startswith(TYPE_CATEGORY_CLIMATE):
|
||||||
|
@ -109,7 +109,6 @@ def _check_for_insteon_type(
|
|||||||
device_type.startswith(t)
|
device_type.startswith(t)
|
||||||
for t in set(NODE_FILTERS[platform][FILTER_INSTEON_TYPE])
|
for t in set(NODE_FILTERS[platform][FILTER_INSTEON_TYPE])
|
||||||
):
|
):
|
||||||
|
|
||||||
# Hacky special-cases for certain devices with different platforms
|
# Hacky special-cases for certain devices with different platforms
|
||||||
# included as subnodes. Note that special-cases are not necessary
|
# included as subnodes. Note that special-cases are not necessary
|
||||||
# on ISY 5.x firmware as it uses the superior NodeDefs method
|
# on ISY 5.x firmware as it uses the superior NodeDefs method
|
||||||
|
@ -173,6 +173,7 @@ class ControllerDevice(ClimateEntity):
|
|||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Call on adding to hass."""
|
"""Call on adding to hass."""
|
||||||
|
|
||||||
# Register for connect/disconnect/update events
|
# Register for connect/disconnect/update events
|
||||||
@callback
|
@callback
|
||||||
def controller_disconnected(ctrl: Controller, ex: Exception) -> None:
|
def controller_disconnected(ctrl: Controller, ex: Exception) -> None:
|
||||||
@ -290,7 +291,7 @@ class ControllerDevice(ClimateEntity):
|
|||||||
return HVACMode.OFF
|
return HVACMode.OFF
|
||||||
if (mode := self._controller.mode) == Controller.Mode.FREE_AIR:
|
if (mode := self._controller.mode) == Controller.Mode.FREE_AIR:
|
||||||
return HVACMode.FAN_ONLY
|
return HVACMode.FAN_ONLY
|
||||||
for (key, value) in self._state_to_pizone.items():
|
for key, value in self._state_to_pizone.items():
|
||||||
if value == mode:
|
if value == mode:
|
||||||
return key
|
return key
|
||||||
raise RuntimeError("Should be unreachable")
|
raise RuntimeError("Should be unreachable")
|
||||||
@ -527,7 +528,7 @@ class ZoneDevice(ClimateEntity):
|
|||||||
def hvac_mode(self) -> HVACMode | None:
|
def hvac_mode(self) -> HVACMode | None:
|
||||||
"""Return current operation ie. heat, cool, idle."""
|
"""Return current operation ie. heat, cool, idle."""
|
||||||
mode = self._zone.mode
|
mode = self._zone.mode
|
||||||
for (key, value) in self._state_to_pizone.items():
|
for key, value in self._state_to_pizone.items():
|
||||||
if value == mode:
|
if value == mode:
|
||||||
return key
|
return key
|
||||||
return None
|
return None
|
||||||
|
@ -17,7 +17,6 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
async def _async_has_devices(hass: HomeAssistant) -> bool:
|
async def _async_has_devices(hass: HomeAssistant) -> bool:
|
||||||
|
|
||||||
controller_ready = asyncio.Event()
|
controller_ready = asyncio.Event()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
@ -46,7 +46,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
errors = {}
|
errors = {}
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
|
||||||
await self.async_set_unique_id(user_input[CONF_ACCESS_TOKEN])
|
await self.async_set_unique_id(user_input[CONF_ACCESS_TOKEN])
|
||||||
self._abort_if_unique_id_configured()
|
self._abort_if_unique_id_configured()
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class DemoFixFlow(RepairsFlow):
|
|||||||
) -> data_entry_flow.FlowResult:
|
) -> data_entry_flow.FlowResult:
|
||||||
"""Handle the first step of a fix flow."""
|
"""Handle the first step of a fix flow."""
|
||||||
|
|
||||||
return await (self.async_step_confirm())
|
return await self.async_step_confirm()
|
||||||
|
|
||||||
async def async_step_confirm(
|
async def async_step_confirm(
|
||||||
self, user_input: dict[str, str] | None = None
|
self, user_input: dict[str, str] | None = None
|
||||||
|
@ -62,7 +62,6 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
|
|||||||
|
|
||||||
# Removing domain name and config entry id from entity unique id's, replacing it with device number
|
# Removing domain name and config entry id from entity unique id's, replacing it with device number
|
||||||
if config_entry.version == 1:
|
if config_entry.version == 1:
|
||||||
|
|
||||||
config_entry.version = 2
|
config_entry.version = 2
|
||||||
|
|
||||||
device_number = config_entry.data["device_number"]
|
device_number = config_entry.data["device_number"]
|
||||||
|
@ -296,7 +296,6 @@ class LIFXManager:
|
|||||||
)
|
)
|
||||||
|
|
||||||
elif service == SERVICE_EFFECT_MORPH:
|
elif service == SERVICE_EFFECT_MORPH:
|
||||||
|
|
||||||
theme_name = kwargs.get(ATTR_THEME, "exciting")
|
theme_name = kwargs.get(ATTR_THEME, "exciting")
|
||||||
palette = kwargs.get(ATTR_PALETTE, None)
|
palette = kwargs.get(ATTR_PALETTE, None)
|
||||||
|
|
||||||
@ -336,7 +335,6 @@ class LIFXManager:
|
|||||||
)
|
)
|
||||||
|
|
||||||
elif service == SERVICE_EFFECT_PULSE:
|
elif service == SERVICE_EFFECT_PULSE:
|
||||||
|
|
||||||
effect = aiolifx_effects.EffectPulse(
|
effect = aiolifx_effects.EffectPulse(
|
||||||
power_on=kwargs.get(ATTR_POWER_ON),
|
power_on=kwargs.get(ATTR_POWER_ON),
|
||||||
period=kwargs.get(ATTR_PERIOD),
|
period=kwargs.get(ATTR_PERIOD),
|
||||||
@ -347,7 +345,6 @@ class LIFXManager:
|
|||||||
await self.effects_conductor.start(effect, bulbs)
|
await self.effects_conductor.start(effect, bulbs)
|
||||||
|
|
||||||
elif service == SERVICE_EFFECT_COLORLOOP:
|
elif service == SERVICE_EFFECT_COLORLOOP:
|
||||||
|
|
||||||
brightness = None
|
brightness = None
|
||||||
saturation_max = None
|
saturation_max = None
|
||||||
saturation_min = None
|
saturation_min = None
|
||||||
@ -378,7 +375,6 @@ class LIFXManager:
|
|||||||
await self.effects_conductor.start(effect, bulbs)
|
await self.effects_conductor.start(effect, bulbs)
|
||||||
|
|
||||||
elif service == SERVICE_EFFECT_STOP:
|
elif service == SERVICE_EFFECT_STOP:
|
||||||
|
|
||||||
await self.effects_conductor.stop(bulbs)
|
await self.effects_conductor.stop(bulbs)
|
||||||
|
|
||||||
for coordinator in coordinators:
|
for coordinator in coordinators:
|
||||||
|
@ -218,7 +218,6 @@ def parse_api_response(response):
|
|||||||
for authority in AUTHORITIES:
|
for authority in AUTHORITIES:
|
||||||
for entry in response["HourlyAirQualityIndex"]["LocalAuthority"]:
|
for entry in response["HourlyAirQualityIndex"]["LocalAuthority"]:
|
||||||
if entry["@LocalAuthorityName"] == authority:
|
if entry["@LocalAuthorityName"] == authority:
|
||||||
|
|
||||||
if isinstance(entry["Site"], dict):
|
if isinstance(entry["Site"], dict):
|
||||||
entry_sites_data = [entry["Site"]]
|
entry_sites_data = [entry["Site"]]
|
||||||
else:
|
else:
|
||||||
|
@ -157,7 +157,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
return
|
return
|
||||||
|
|
||||||
if change_type == collection.CHANGE_ADDED:
|
if change_type == collection.CHANGE_ADDED:
|
||||||
|
|
||||||
existing = hass.data[DOMAIN]["dashboards"].get(url_path)
|
existing = hass.data[DOMAIN]["dashboards"].get(url_path)
|
||||||
|
|
||||||
if existing:
|
if existing:
|
||||||
|
@ -31,7 +31,6 @@ def setup_platform(
|
|||||||
devices = []
|
devices = []
|
||||||
|
|
||||||
for device in data.lupusec.get_devices(generic_type=CONST.TYPE_SWITCH):
|
for device in data.lupusec.get_devices(generic_type=CONST.TYPE_SWITCH):
|
||||||
|
|
||||||
devices.append(LupusecSwitch(data, device))
|
devices.append(LupusecSwitch(data, device))
|
||||||
|
|
||||||
add_entities(devices)
|
add_entities(devices)
|
||||||
|
@ -24,7 +24,7 @@ def setup_platform(
|
|||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
devs = []
|
devs = []
|
||||||
for (area_name, device) in hass.data[LUTRON_DEVICES]["binary_sensor"]:
|
for area_name, device in hass.data[LUTRON_DEVICES]["binary_sensor"]:
|
||||||
dev = LutronOccupancySensor(area_name, device, hass.data[LUTRON_CONTROLLER])
|
dev = LutronOccupancySensor(area_name, device, hass.data[LUTRON_CONTROLLER])
|
||||||
devs.append(dev)
|
devs.append(dev)
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ def setup_platform(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the Lutron shades."""
|
"""Set up the Lutron shades."""
|
||||||
devs = []
|
devs = []
|
||||||
for (area_name, device) in hass.data[LUTRON_DEVICES]["cover"]:
|
for area_name, device in hass.data[LUTRON_DEVICES]["cover"]:
|
||||||
dev = LutronCover(area_name, device, hass.data[LUTRON_CONTROLLER])
|
dev = LutronCover(area_name, device, hass.data[LUTRON_CONTROLLER])
|
||||||
devs.append(dev)
|
devs.append(dev)
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ def setup_platform(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the Lutron lights."""
|
"""Set up the Lutron lights."""
|
||||||
devs = []
|
devs = []
|
||||||
for (area_name, device) in hass.data[LUTRON_DEVICES]["light"]:
|
for area_name, device in hass.data[LUTRON_DEVICES]["light"]:
|
||||||
dev = LutronLight(area_name, device, hass.data[LUTRON_CONTROLLER])
|
dev = LutronLight(area_name, device, hass.data[LUTRON_CONTROLLER])
|
||||||
devs.append(dev)
|
devs.append(dev)
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ def setup_platform(
|
|||||||
devs = []
|
devs = []
|
||||||
|
|
||||||
# Add Lutron Switches
|
# Add Lutron Switches
|
||||||
for (area_name, device) in hass.data[LUTRON_DEVICES]["switch"]:
|
for area_name, device in hass.data[LUTRON_DEVICES]["switch"]:
|
||||||
dev = LutronSwitch(area_name, device, hass.data[LUTRON_CONTROLLER])
|
dev = LutronSwitch(area_name, device, hass.data[LUTRON_CONTROLLER])
|
||||||
devs.append(dev)
|
devs.append(dev)
|
||||||
|
|
||||||
|
@ -256,7 +256,6 @@ def _async_setup_keypads(
|
|||||||
leap_to_keypad_button_names: dict[int, dict[int, str]] = {}
|
leap_to_keypad_button_names: dict[int, dict[int, str]] = {}
|
||||||
|
|
||||||
for bridge_button in bridge_buttons.values():
|
for bridge_button in bridge_buttons.values():
|
||||||
|
|
||||||
parent_device = cast(str, bridge_button["parent_device"])
|
parent_device = cast(str, bridge_button["parent_device"])
|
||||||
bridge_keypad = bridge_devices[parent_device]
|
bridge_keypad = bridge_devices[parent_device]
|
||||||
keypad_lutron_device_id = cast(int, bridge_keypad["device_id"])
|
keypad_lutron_device_id = cast(int, bridge_keypad["device_id"])
|
||||||
|
@ -29,7 +29,6 @@ async def async_setup_entry(
|
|||||||
entities: list[LutronCasetaButton] = []
|
entities: list[LutronCasetaButton] = []
|
||||||
|
|
||||||
for device in button_devices.values():
|
for device in button_devices.values():
|
||||||
|
|
||||||
parent_keypad = keypads[device["parent_device"]]
|
parent_keypad = keypads[device["parent_device"]]
|
||||||
parent_device_info = parent_keypad["device_info"]
|
parent_device_info = parent_keypad["device_info"]
|
||||||
|
|
||||||
|
@ -93,7 +93,6 @@ async def async_setup_platform(
|
|||||||
async_add_entities([new_stb])
|
async_add_entities([new_stb])
|
||||||
|
|
||||||
if not config[CONF_OPTIMISTIC]:
|
if not config[CONF_OPTIMISTIC]:
|
||||||
|
|
||||||
already_installed = hass.data.get(DISCOVERY_MEDIAROOM)
|
already_installed = hass.data.get(DISCOVERY_MEDIAROOM)
|
||||||
if not already_installed:
|
if not already_installed:
|
||||||
hass.data[DISCOVERY_MEDIAROOM] = await install_mediaroom_protocol(
|
hass.data[DISCOVERY_MEDIAROOM] = await install_mediaroom_protocol(
|
||||||
|
@ -80,12 +80,10 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
for discovery_info in async_discovered_service_info(
|
for discovery_info in async_discovered_service_info(
|
||||||
self.hass, connectable=True
|
self.hass, connectable=True
|
||||||
):
|
):
|
||||||
|
|
||||||
if discovery_info.manufacturer_id == MANUFACTURER_ID and any(
|
if discovery_info.manufacturer_id == MANUFACTURER_ID and any(
|
||||||
manufacturer_data.startswith(MANUFACTURER_DATA_START)
|
manufacturer_data.startswith(MANUFACTURER_DATA_START)
|
||||||
for manufacturer_data in discovery_info.manufacturer_data.values()
|
for manufacturer_data in discovery_info.manufacturer_data.values()
|
||||||
):
|
):
|
||||||
|
|
||||||
address = discovery_info.address
|
address = discovery_info.address
|
||||||
if (
|
if (
|
||||||
address not in current_addresses
|
address not in current_addresses
|
||||||
|
@ -94,7 +94,7 @@ class MetWeather(CoordinatorEntity[MetDataUpdateCoordinator], WeatherEntity):
|
|||||||
self._hourly = hourly
|
self._hourly = hourly
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def track_home(self) -> (Any | bool):
|
def track_home(self) -> Any | bool:
|
||||||
"""Return if we are tracking home."""
|
"""Return if we are tracking home."""
|
||||||
return self._config.get(CONF_TRACK_HOME, False)
|
return self._config.get(CONF_TRACK_HOME, False)
|
||||||
|
|
||||||
|
@ -172,7 +172,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
if hass.data[DOMAIN][entry.entry_id][COORDINATOR_ALERT]:
|
if hass.data[DOMAIN][entry.entry_id][COORDINATOR_ALERT]:
|
||||||
|
|
||||||
department = hass.data[DOMAIN][entry.entry_id][
|
department = hass.data[DOMAIN][entry.entry_id][
|
||||||
COORDINATOR_FORECAST
|
COORDINATOR_FORECAST
|
||||||
].data.position.get("dept")
|
].data.position.get("dept")
|
||||||
|
@ -35,12 +35,10 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
# Restore clients that is not a part of active clients list.
|
# Restore clients that is not a part of active clients list.
|
||||||
for entity in registry.entities.values():
|
for entity in registry.entities.values():
|
||||||
|
|
||||||
if (
|
if (
|
||||||
entity.config_entry_id == config_entry.entry_id
|
entity.config_entry_id == config_entry.entry_id
|
||||||
and entity.domain == DEVICE_TRACKER
|
and entity.domain == DEVICE_TRACKER
|
||||||
):
|
):
|
||||||
|
|
||||||
if (
|
if (
|
||||||
entity.unique_id in coordinator.api.devices
|
entity.unique_id in coordinator.api.devices
|
||||||
or entity.unique_id not in coordinator.api.all_devices
|
or entity.unique_id not in coordinator.api.all_devices
|
||||||
|
@ -22,7 +22,7 @@ async def async_check_srv_record(
|
|||||||
srv_records = await aiodns.DNSResolver().query(
|
srv_records = await aiodns.DNSResolver().query(
|
||||||
host=f"{SRV_RECORD_PREFIX}.{host}", qtype="SRV"
|
host=f"{SRV_RECORD_PREFIX}.{host}", qtype="SRV"
|
||||||
)
|
)
|
||||||
except (aiodns.error.DNSError):
|
except aiodns.error.DNSError:
|
||||||
# 'host' is not a SRV record.
|
# 'host' is not a SRV record.
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
@ -249,7 +249,10 @@ CLIMATE_SCHEMA = vol.All(
|
|||||||
|
|
||||||
COVERS_SCHEMA = BASE_COMPONENT_SCHEMA.extend(
|
COVERS_SCHEMA = BASE_COMPONENT_SCHEMA.extend(
|
||||||
{
|
{
|
||||||
vol.Optional(CONF_INPUT_TYPE, default=CALL_TYPE_REGISTER_HOLDING,): vol.In(
|
vol.Optional(
|
||||||
|
CONF_INPUT_TYPE,
|
||||||
|
default=CALL_TYPE_REGISTER_HOLDING,
|
||||||
|
): vol.In(
|
||||||
[
|
[
|
||||||
CALL_TYPE_REGISTER_HOLDING,
|
CALL_TYPE_REGISTER_HOLDING,
|
||||||
CALL_TYPE_COIL,
|
CALL_TYPE_COIL,
|
||||||
|
@ -315,7 +315,6 @@ class MoldIndicator(SensorEntity):
|
|||||||
def _calc_moldindicator(self):
|
def _calc_moldindicator(self):
|
||||||
"""Calculate the humidity at the (cold) calibration point."""
|
"""Calculate the humidity at the (cold) calibration point."""
|
||||||
if None in (self._dewpoint, self._calib_factor) or self._calib_factor == 0:
|
if None in (self._dewpoint, self._calib_factor) or self._calib_factor == 0:
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Invalid inputs - dewpoint: %s, calibration-factor: %s",
|
"Invalid inputs - dewpoint: %s, calibration-factor: %s",
|
||||||
self._dewpoint,
|
self._dewpoint,
|
||||||
|
@ -200,7 +200,6 @@ class MqttBinarySensor(MqttEntity, BinarySensorEntity, RestoreEntity):
|
|||||||
"""Handle a new received MQTT state message."""
|
"""Handle a new received MQTT state message."""
|
||||||
# auto-expire enabled?
|
# auto-expire enabled?
|
||||||
if self._expire_after:
|
if self._expire_after:
|
||||||
|
|
||||||
# When expire_after is set, and we receive a message, assume device is
|
# When expire_after is set, and we receive a message, assume device is
|
||||||
# not expired since it has to be to receive the message
|
# not expired since it has to be to receive the message
|
||||||
self._expired = False
|
self._expired = False
|
||||||
|
@ -666,7 +666,6 @@ class MQTT:
|
|||||||
subscriptions = self._matching_subscriptions(msg.topic)
|
subscriptions = self._matching_subscriptions(msg.topic)
|
||||||
|
|
||||||
for subscription in subscriptions:
|
for subscription in subscriptions:
|
||||||
|
|
||||||
payload: SubscribePayloadType = msg.payload
|
payload: SubscribePayloadType = msg.payload
|
||||||
if subscription.encoding is not None:
|
if subscription.encoding is not None:
|
||||||
try:
|
try:
|
||||||
|
@ -279,7 +279,7 @@ async def async_start( # noqa: C901
|
|||||||
mqtt_data.last_discovery = time.time()
|
mqtt_data.last_discovery = time.time()
|
||||||
mqtt_integrations = await async_get_mqtt(hass)
|
mqtt_integrations = await async_get_mqtt(hass)
|
||||||
|
|
||||||
for (integration, topics) in mqtt_integrations.items():
|
for integration, topics in mqtt_integrations.items():
|
||||||
|
|
||||||
async def async_integration_message_received(
|
async def async_integration_message_received(
|
||||||
integration: str, msg: ReceiveMessage
|
integration: str, msg: ReceiveMessage
|
||||||
|
@ -64,7 +64,11 @@ class EntitySubscription:
|
|||||||
if other is None:
|
if other is None:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return (self.topic, self.qos, self.encoding,) != (
|
return (
|
||||||
|
self.topic,
|
||||||
|
self.qos,
|
||||||
|
self.encoding,
|
||||||
|
) != (
|
||||||
other.topic,
|
other.topic,
|
||||||
other.qos,
|
other.qos,
|
||||||
other.encoding,
|
other.encoding,
|
||||||
|
@ -135,7 +135,6 @@ class NAMFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
_LOGGER.exception("Unexpected exception")
|
_LOGGER.exception("Unexpected exception")
|
||||||
errors["base"] = "unknown"
|
errors["base"] = "unknown"
|
||||||
else:
|
else:
|
||||||
|
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=self.host,
|
title=self.host,
|
||||||
data={**user_input, CONF_HOST: self.host},
|
data={**user_input, CONF_HOST: self.host},
|
||||||
|
@ -428,7 +428,6 @@ class NestFlowHandler(
|
|||||||
_LOGGER.error("Error creating subscription: %s", err)
|
_LOGGER.error("Error creating subscription: %s", err)
|
||||||
errors[CONF_CLOUD_PROJECT_ID] = "subscriber_error"
|
errors[CONF_CLOUD_PROJECT_ID] = "subscriber_error"
|
||||||
if not errors:
|
if not errors:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
device_manager = await subscriber.async_get_device_manager()
|
device_manager = await subscriber.async_get_device_manager()
|
||||||
except ApiException as err:
|
except ApiException as err:
|
||||||
|
@ -26,7 +26,6 @@ class NFAndroidTVFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
errors = {}
|
errors = {}
|
||||||
|
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
|
||||||
self._async_abort_entries_match(
|
self._async_abort_entries_match(
|
||||||
{CONF_HOST: user_input[CONF_HOST], CONF_NAME: user_input[CONF_NAME]}
|
{CONF_HOST: user_input[CONF_HOST], CONF_NAME: user_input[CONF_NAME]}
|
||||||
)
|
)
|
||||||
|
@ -265,7 +265,6 @@ class Coordinator(ContextCoordinator[dict[int, Coil], int]):
|
|||||||
self.task = None
|
self.task = None
|
||||||
|
|
||||||
async def _async_update_data_internal(self) -> dict[int, Coil]:
|
async def _async_update_data_internal(self) -> dict[int, Coil]:
|
||||||
|
|
||||||
result: dict[int, Coil] = {}
|
result: dict[int, Coil] = {}
|
||||||
|
|
||||||
def _get_coils() -> Iterable[Coil]:
|
def _get_coils() -> Iterable[Coil]:
|
||||||
|
@ -99,7 +99,6 @@ class NINADataUpdateCoordinator(
|
|||||||
all_filtered_warnings: dict[str, list[Any]] = {}
|
all_filtered_warnings: dict[str, list[Any]] = {}
|
||||||
|
|
||||||
for region_id, raw_warnings in warnings.items():
|
for region_id, raw_warnings in warnings.items():
|
||||||
|
|
||||||
filtered_warnings: list[Any] = []
|
filtered_warnings: list[Any] = []
|
||||||
processed_details: list[tuple[str, str]] = []
|
processed_details: list[tuple[str, str]] = []
|
||||||
|
|
||||||
|
@ -126,7 +126,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
user_input[CONF_REGIONS] += group_input
|
user_input[CONF_REGIONS] += group_input
|
||||||
|
|
||||||
if user_input[CONF_REGIONS]:
|
if user_input[CONF_REGIONS]:
|
||||||
|
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title="NINA",
|
title="NINA",
|
||||||
data=prepare_user_input(user_input, self._all_region_codes_sorted),
|
data=prepare_user_input(user_input, self._all_region_codes_sorted),
|
||||||
@ -203,7 +202,6 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
user_input[CONF_REGIONS] += group_input
|
user_input[CONF_REGIONS] += group_input
|
||||||
|
|
||||||
if user_input[CONF_REGIONS]:
|
if user_input[CONF_REGIONS]:
|
||||||
|
|
||||||
user_input = prepare_user_input(
|
user_input = prepare_user_input(
|
||||||
user_input, self._all_region_codes_sorted
|
user_input, self._all_region_codes_sorted
|
||||||
)
|
)
|
||||||
|
@ -52,7 +52,6 @@ def setup_platform(
|
|||||||
ports = platform[CONF_PORTS]
|
ports = platform[CONF_PORTS]
|
||||||
for port, port_name in ports.items():
|
for port, port_name in ports.items():
|
||||||
try:
|
try:
|
||||||
|
|
||||||
api.setup_input(device_id, port)
|
api.setup_input(device_id, port)
|
||||||
api.edge_detect(device_id, port, partial(read_gpio, device_id))
|
api.edge_detect(device_id, port, partial(read_gpio, device_id))
|
||||||
|
|
||||||
|
@ -108,7 +108,6 @@ class OnvifFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
If no device is found allow user to manually input configuration.
|
If no device is found allow user to manually input configuration.
|
||||||
"""
|
"""
|
||||||
if user_input:
|
if user_input:
|
||||||
|
|
||||||
if user_input[CONF_HOST] == CONF_MANUAL_INPUT:
|
if user_input[CONF_HOST] == CONF_MANUAL_INPUT:
|
||||||
return await self.async_step_configure()
|
return await self.async_step_configure()
|
||||||
|
|
||||||
|
@ -94,7 +94,6 @@ class OpenMeteoWeatherEntity(
|
|||||||
forecasts: list[Forecast] = []
|
forecasts: list[Forecast] = []
|
||||||
daily = self.coordinator.data.daily
|
daily = self.coordinator.data.daily
|
||||||
for index, time in enumerate(self.coordinator.data.daily.time):
|
for index, time in enumerate(self.coordinator.data.daily.time):
|
||||||
|
|
||||||
forecast = Forecast(
|
forecast = Forecast(
|
||||||
datetime=time.isoformat(),
|
datetime=time.isoformat(),
|
||||||
)
|
)
|
||||||
|
@ -189,7 +189,7 @@ class OpenCVImageProcessor(ImageProcessingEntity):
|
|||||||
)
|
)
|
||||||
regions = []
|
regions = []
|
||||||
# pylint: disable=invalid-name
|
# pylint: disable=invalid-name
|
||||||
for (x, y, w, h) in detections:
|
for x, y, w, h in detections:
|
||||||
regions.append((int(x), int(y), int(w), int(h)))
|
regions.append((int(x), int(y), int(w), int(h)))
|
||||||
total_matches += 1
|
total_matches += 1
|
||||||
|
|
||||||
|
@ -79,10 +79,12 @@ async def async_setup_platform(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def catch_request_errors() -> Callable[
|
def catch_request_errors() -> (
|
||||||
[Callable[Concatenate[_OpenhomeDeviceT, _P], Awaitable[_R]]],
|
Callable[
|
||||||
Callable[Concatenate[_OpenhomeDeviceT, _P], Coroutine[Any, Any, _R | None]],
|
[Callable[Concatenate[_OpenhomeDeviceT, _P], Awaitable[_R]]],
|
||||||
]:
|
Callable[Concatenate[_OpenhomeDeviceT, _P], Coroutine[Any, Any, _R | None]],
|
||||||
|
]
|
||||||
|
):
|
||||||
"""Catch asyncio.TimeoutError, aiohttp.ClientError, UpnpError errors."""
|
"""Catch asyncio.TimeoutError, aiohttp.ClientError, UpnpError errors."""
|
||||||
|
|
||||||
def call_wrapper(
|
def call_wrapper(
|
||||||
@ -265,7 +267,7 @@ class OpenhomeDevice(MediaPlayerEntity):
|
|||||||
await self._device.invoke_pin(pin)
|
await self._device.invoke_pin(pin)
|
||||||
else:
|
else:
|
||||||
_LOGGER.error("Pins service not supported")
|
_LOGGER.error("Pins service not supported")
|
||||||
except (UpnpError):
|
except UpnpError:
|
||||||
_LOGGER.error("Error invoking pin %s", pin)
|
_LOGGER.error("Error invoking pin %s", pin)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -251,7 +251,6 @@ class WeatherUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
def _get_condition(self, weather_code, timestamp=None):
|
def _get_condition(self, weather_code, timestamp=None):
|
||||||
"""Get weather condition from weather data."""
|
"""Get weather condition from weather data."""
|
||||||
if weather_code == WEATHER_CODE_SUNNY_OR_CLEAR_NIGHT:
|
if weather_code == WEATHER_CODE_SUNNY_OR_CLEAR_NIGHT:
|
||||||
|
|
||||||
if timestamp:
|
if timestamp:
|
||||||
timestamp = dt.utc_from_timestamp(timestamp)
|
timestamp = dt.utc_from_timestamp(timestamp)
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
self._pair_state: Any = None
|
self._pair_state: Any = None
|
||||||
|
|
||||||
async def _async_create_current(self) -> FlowResult:
|
async def _async_create_current(self) -> FlowResult:
|
||||||
|
|
||||||
system = self._current[CONF_SYSTEM]
|
system = self._current[CONF_SYSTEM]
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=f"{system['name']} ({system['serialnumber']})",
|
title=f"{system['name']} ({system['serialnumber']})",
|
||||||
|
@ -437,7 +437,6 @@ class PhilipsTVMediaPlayer(
|
|||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _update_from_coordinator(self):
|
def _update_from_coordinator(self):
|
||||||
|
|
||||||
if self._tv.on:
|
if self._tv.on:
|
||||||
if self._tv.powerstate in ("Standby", "StandbyKeep"):
|
if self._tv.powerstate in ("Standby", "StandbyKeep"):
|
||||||
self._attr_state = MediaPlayerState.OFF
|
self._attr_state = MediaPlayerState.OFF
|
||||||
|
@ -178,7 +178,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
def plex_websocket_callback(msgtype, data, error):
|
def plex_websocket_callback(msgtype, data, error):
|
||||||
"""Handle callbacks from plexwebsocket library."""
|
"""Handle callbacks from plexwebsocket library."""
|
||||||
if msgtype == SIGNAL_CONNECTION_STATE:
|
if msgtype == SIGNAL_CONNECTION_STATE:
|
||||||
|
|
||||||
if data == STATE_CONNECTED:
|
if data == STATE_CONNECTED:
|
||||||
_LOGGER.debug("Websocket to %s successful", entry.data[CONF_SERVER])
|
_LOGGER.debug("Websocket to %s successful", entry.data[CONF_SERVER])
|
||||||
hass.async_create_task(plex_server.async_update_platforms())
|
hass.async_create_task(plex_server.async_update_platforms())
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user