mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Merge of nested IF-IF cases - A-C (#48365)
This commit is contained in:
parent
8d5ce53098
commit
db355f9b23
@ -102,8 +102,8 @@ class AgentCamera(MjpegCamera):
|
|||||||
_LOGGER.debug("%s reacquired", self._name)
|
_LOGGER.debug("%s reacquired", self._name)
|
||||||
self._removed = False
|
self._removed = False
|
||||||
except AgentError:
|
except AgentError:
|
||||||
if self.device.client.is_available: # server still available - camera error
|
# server still available - camera error
|
||||||
if not self._removed:
|
if self.device.client.is_available and not self._removed:
|
||||||
_LOGGER.error("%s lost", self._name)
|
_LOGGER.error("%s lost", self._name)
|
||||||
self._removed = True
|
self._removed = True
|
||||||
|
|
||||||
|
@ -349,12 +349,18 @@ def _device_already_added(current_entries, user_input, protocol):
|
|||||||
entry_path = entry.data.get(CONF_DEVICE_PATH)
|
entry_path = entry.data.get(CONF_DEVICE_PATH)
|
||||||
entry_baud = entry.data.get(CONF_DEVICE_BAUD)
|
entry_baud = entry.data.get(CONF_DEVICE_BAUD)
|
||||||
|
|
||||||
if protocol == PROTOCOL_SOCKET:
|
if (
|
||||||
if user_host == entry_host and user_port == entry_port:
|
protocol == PROTOCOL_SOCKET
|
||||||
|
and user_host == entry_host
|
||||||
|
and user_port == entry_port
|
||||||
|
):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if protocol == PROTOCOL_SERIAL:
|
if (
|
||||||
if user_baud == entry_baud and user_path == entry_path:
|
protocol == PROTOCOL_SERIAL
|
||||||
|
and user_baud == entry_baud
|
||||||
|
and user_path == entry_path
|
||||||
|
):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
@ -653,9 +653,8 @@ def temperature_from_object(hass, temp_obj, interval=False):
|
|||||||
|
|
||||||
if temp_obj["scale"] == "FAHRENHEIT":
|
if temp_obj["scale"] == "FAHRENHEIT":
|
||||||
from_unit = TEMP_FAHRENHEIT
|
from_unit = TEMP_FAHRENHEIT
|
||||||
elif temp_obj["scale"] == "KELVIN":
|
elif temp_obj["scale"] == "KELVIN" and not interval:
|
||||||
# convert to Celsius if absolute temperature
|
# convert to Celsius if absolute temperature
|
||||||
if not interval:
|
|
||||||
temp -= 273.15
|
temp -= 273.15
|
||||||
|
|
||||||
return convert_temperature(temp, from_unit, to_unit, interval)
|
return convert_temperature(temp, from_unit, to_unit, interval)
|
||||||
|
@ -42,9 +42,8 @@ def get_service(hass, config, discovery_info=None):
|
|||||||
_LOGGER.error("Invalid Apprise config url provided")
|
_LOGGER.error("Invalid Apprise config url provided")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if config.get(CONF_URL):
|
|
||||||
# Ordered list of URLs
|
# Ordered list of URLs
|
||||||
if not a_obj.add(config[CONF_URL]):
|
if config.get(CONF_URL) and not a_obj.add(config[CONF_URL]):
|
||||||
_LOGGER.error("Invalid Apprise URL(s) supplied")
|
_LOGGER.error("Invalid Apprise URL(s) supplied")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -341,8 +341,7 @@ class AsusWrtRouter:
|
|||||||
|
|
||||||
async def close(self) -> None:
|
async def close(self) -> None:
|
||||||
"""Close the connection."""
|
"""Close the connection."""
|
||||||
if self._api is not None:
|
if self._api is not None and self._protocol == PROTOCOL_TELNET:
|
||||||
if self._protocol == PROTOCOL_TELNET:
|
|
||||||
self._api.connection.disconnect()
|
self._api.connection.disconnect()
|
||||||
self._api = None
|
self._api = None
|
||||||
|
|
||||||
|
@ -706,15 +706,15 @@ class CastDevice(MediaPlayerEntity):
|
|||||||
support = SUPPORT_CAST
|
support = SUPPORT_CAST
|
||||||
media_status = self._media_status()[0]
|
media_status = self._media_status()[0]
|
||||||
|
|
||||||
if self.cast_status:
|
if (
|
||||||
if self.cast_status.volume_control_type != VOLUME_CONTROL_TYPE_FIXED:
|
self.cast_status
|
||||||
|
and self.cast_status.volume_control_type != VOLUME_CONTROL_TYPE_FIXED
|
||||||
|
):
|
||||||
support |= SUPPORT_VOLUME_MUTE | SUPPORT_VOLUME_SET
|
support |= SUPPORT_VOLUME_MUTE | SUPPORT_VOLUME_SET
|
||||||
|
|
||||||
if media_status:
|
if media_status:
|
||||||
if media_status.supports_queue_next:
|
if media_status.supports_queue_next:
|
||||||
support |= SUPPORT_PREVIOUS_TRACK
|
support |= SUPPORT_PREVIOUS_TRACK | SUPPORT_NEXT_TRACK
|
||||||
if media_status.supports_queue_next:
|
|
||||||
support |= SUPPORT_NEXT_TRACK
|
|
||||||
if media_status.supports_seek:
|
if media_status.supports_seek:
|
||||||
support |= SUPPORT_SEEK
|
support |= SUPPORT_SEEK
|
||||||
|
|
||||||
|
@ -274,10 +274,9 @@ class ClimaCellWeatherEntity(ClimaCellEntity, WeatherEntity):
|
|||||||
),
|
),
|
||||||
temp_low,
|
temp_low,
|
||||||
)
|
)
|
||||||
elif self.forecast_type == NOWCAST:
|
elif self.forecast_type == NOWCAST and precipitation:
|
||||||
# Precipitation is forecasted in CONF_TIMESTEP increments but in a
|
# Precipitation is forecasted in CONF_TIMESTEP increments but in a
|
||||||
# per hour rate, so value needs to be converted to an amount.
|
# per hour rate, so value needs to be converted to an amount.
|
||||||
if precipitation:
|
|
||||||
precipitation = (
|
precipitation = (
|
||||||
precipitation / 60 * self._config_entry.options[CONF_TIMESTEP]
|
precipitation / 60 * self._config_entry.options[CONF_TIMESTEP]
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user