This commit is contained in:
Paulus Schoutsen 2023-02-04 22:01:23 -05:00 committed by GitHub
commit 1c88195d32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
363 changed files with 829 additions and 534 deletions

View File

@ -20,7 +20,7 @@ repos:
- --remove-all-unused-imports
stages: [manual]
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black
args:

View File

@ -406,7 +406,6 @@ def async_enable_logging(
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)
):
err_handler: (
logging.handlers.RotatingFileHandler
| logging.handlers.TimedRotatingFileHandler

View File

@ -24,7 +24,6 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
# convert title and unique_id to string
if config_entry.version == 1:
if isinstance(config_entry.unique_id, int):
hass.config_entries.async_update_entry(
config_entry,
unique_id=str(config_entry.unique_id),

View File

@ -88,7 +88,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
errors["base"] = "cannot_connect"
else:
self.hass.config_entries.async_update_entry(
self.entry,
data={

View File

@ -270,7 +270,6 @@ class Alert(Entity):
await self._send_notification_message(message)
async def _send_notification_message(self, message: Any) -> None:
if not self._notifiers:
return

View File

@ -103,7 +103,6 @@ class Auth:
return dt.utcnow() < preemptive_expire_time
async def _async_request_new_token(self, lwa_params):
try:
session = aiohttp_client.async_get_clientsession(self.hass)
async with async_timeout.timeout(10):

View File

@ -193,7 +193,6 @@ def resolve_slot_synonyms(key, request):
and "resolutionsPerAuthority" in request["resolutions"]
and len(request["resolutions"]["resolutionsPerAuthority"]) >= 1
):
# Extract all of the possible values from each authority with a
# successful match
possible_values = []

View File

@ -274,7 +274,6 @@ class AsusWrtRouter:
entity_reg, self._entry.entry_id
)
for entry in track_entries:
if entry.domain != TRACKER_DOMAIN:
continue
device_mac = format_mac(entry.unique_id)

View File

@ -78,6 +78,7 @@ SENSOR_DESCRIPTIONS: tuple[SensorValueEntityDescription, ...] = (
entity_registry_enabled_default=False,
state_class=SensorStateClass.TOTAL_INCREASING,
icon="mdi:phone-plus",
value=lambda x: x.get("calls"),
),
SensorValueEntityDescription(
key="sms",
@ -101,6 +102,7 @@ SENSOR_DESCRIPTIONS: tuple[SensorValueEntityDescription, ...] = (
entity_registry_enabled_default=False,
state_class=SensorStateClass.TOTAL_INCREASING,
icon="mdi:phone",
value=lambda x: x.get("calls"),
),
SensorValueEntityDescription(
key="other",
@ -108,6 +110,7 @@ SENSOR_DESCRIPTIONS: tuple[SensorValueEntityDescription, ...] = (
entity_registry_enabled_default=False,
state_class=SensorStateClass.TOTAL_INCREASING,
icon="mdi:phone",
value=lambda x: x.get("calls"),
),
# Generic sensors
SensorValueEntityDescription(

View File

@ -112,7 +112,6 @@ class AxisBinarySensor(AxisEventEntity, BinarySensorEntity):
self._attr_name = self.device.api.vapix.ports[event.id].name
elif event.group == EventGroup.MOTION:
for event_topic, event_data in (
(EventTopic.FENCE_GUARD, self.device.api.vapix.fence_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.MOTION_DETECTION_4, self.device.api.vapix.vmd4),
):
if (
event.topic_base == event_topic
and event_data

View File

@ -399,7 +399,6 @@ class BayesianBinarySensor(BinarySensorEntity):
observations_by_entity: dict[str, list[Observation]] = {}
for observation in self._observations:
if (key := observation.entity_id) is None:
continue
observations_by_entity.setdefault(key, []).append(observation)

View File

@ -396,7 +396,6 @@ class BluesoundPlayer(MediaPlayerEntity):
_LOGGER.debug("Calling URL: %s", url)
try:
async with async_timeout.timeout(125):
response = await self._polling_session.get(
url, headers={CONNECTION: KEEP_ALIVE}

View File

@ -12,7 +12,6 @@ from home_assistant_bluetooth import BluetoothServiceInfoBleak
from homeassistant.util.dt import monotonic_time_coarse
if TYPE_CHECKING:
from .manager import BluetoothManager

View File

@ -95,7 +95,6 @@ async def async_setup_entry(
session: SHCSession = hass.data[DOMAIN][config_entry.entry_id][DATA_SESSION]
for switch in session.device_helper.smart_plugs:
entities.append(
SHCSwitch(
device=switch,
@ -113,7 +112,6 @@ async def async_setup_entry(
)
for switch in session.device_helper.light_switches:
entities.append(
SHCSwitch(
device=switch,
@ -124,7 +122,6 @@ async def async_setup_entry(
)
for switch in session.device_helper.smart_plugs_compact:
entities.append(
SHCSwitch(
device=switch,
@ -135,7 +132,6 @@ async def async_setup_entry(
)
for switch in session.device_helper.camera_eyes:
entities.append(
SHCSwitch(
device=switch,
@ -146,7 +142,6 @@ async def async_setup_entry(
)
for switch in session.device_helper.camera_360:
entities.append(
SHCSwitch(
device=switch,

View File

@ -171,7 +171,7 @@ class BraviaTVCoordinator(DataUpdateCoordinator[None]):
async def async_update_volume(self) -> None:
"""Update volume information."""
volume_info = await self.client.get_volume_info()
if volume_level := volume_info.get("volume"):
if (volume_level := volume_info.get("volume")) is not None:
self.volume_level = volume_level / 100
self.volume_muted = volume_info.get("mute", False)
self.volume_target = volume_info.get("target")

View File

@ -231,7 +231,10 @@ SENSOR_DESCRIPTIONS = {
state_class=SensorStateClass.MEASUREMENT,
),
# UV index (-)
(BTHomeSensorDeviceClass.UV_INDEX, None,): SensorEntityDescription(
(
BTHomeSensorDeviceClass.UV_INDEX,
None,
): SensorEntityDescription(
key=f"{BTHomeSensorDeviceClass.UV_INDEX}",
state_class=SensorStateClass.MEASUREMENT,
),
@ -256,7 +259,10 @@ SENSOR_DESCRIPTIONS = {
state_class=SensorStateClass.MEASUREMENT,
),
# Volume (L)
(BTHomeSensorDeviceClass.VOLUME, Units.VOLUME_LITERS,): SensorEntityDescription(
(
BTHomeSensorDeviceClass.VOLUME,
Units.VOLUME_LITERS,
): SensorEntityDescription(
key=f"{BTHomeSensorDeviceClass.VOLUME}_{Units.VOLUME_LITERS}",
device_class=SensorDeviceClass.VOLUME,
native_unit_of_measurement=UnitOfVolume.LITERS,

View File

@ -735,7 +735,6 @@ class BrSensor(SensorEntity):
or sensor_type.endswith("_4d")
or sensor_type.endswith("_5d")
):
# update forecasting sensors:
fcday = 0
if sensor_type.endswith("_2d"):

View File

@ -96,7 +96,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle the initial step."""
errors = {}
if user_input is not None:
hub = Control4Validator(
user_input[CONF_HOST],
user_input[CONF_USERNAME],

View File

@ -188,6 +188,7 @@ class DarkSkyWeather(WeatherEntity):
@property
def forecast(self):
"""Return the forecast array."""
# Per conversation with Joshua Reyes of Dark Sky, to get the total
# forecasted precipitation, you have to multiple the intensity by
# the hours for the forecast interval

View File

@ -271,7 +271,6 @@ class DeconzBinarySensor(DeconzDevice[SensorResources], BinarySensorEntity):
attr[ATTR_TEMPERATURE] = self._device.internal_temperature
if isinstance(self._device, Presence):
if self._device.dark is not None:
attr[ATTR_DARK] = self._device.dark

View File

@ -87,7 +87,6 @@ class DeconzFlowHandler(ConfigFlow, domain=DOMAIN):
If no bridge is found allow user to manually input configuration.
"""
if user_input is not None:
if CONF_MANUAL_INPUT == user_input[CONF_HOST]:
return await self.async_step_manual_input()

View File

@ -372,7 +372,6 @@ class DeconzSensor(DeconzDevice[SensorResources], SensorEntity):
attr[ATTR_DAYLIGHT] = self._device.daylight
elif isinstance(self._device, LightLevel):
if self._device.dark is not None:
attr[ATTR_DARK] = self._device.dark

View File

@ -186,10 +186,8 @@ async def async_remove_orphaned_entries_service(gateway: DeconzGateway) -> None:
devices_to_be_removed.remove(event.device_id)
for entry in entity_entries:
# Don't remove available entities
if entry.unique_id in gateway.entities[entry.domain]:
# Don't remove devices with available entities
if entry.device_id in devices_to_be_removed:
devices_to_be_removed.remove(entry.device_id)

View File

@ -121,6 +121,6 @@ class DeLijnPublicTransportSensor(SensorEntity):
self._attr_extra_state_attributes["next_passages"] = self.line.passages
self._attr_available = True
except (KeyError) as error:
except KeyError as error:
_LOGGER.error("Invalid data received from De Lijn: %s", error)
self._attr_available = False

View File

@ -245,7 +245,7 @@ class DerivativeSensor(RestoreEntity, SensorEntity):
derivative = new_derivative
else:
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)
derivative = derivative + (value * Decimal(weight))

View File

@ -214,7 +214,6 @@ async def activate_automation( # noqa: C901
elif start_point and start_point < now < get_astral_event_next(
hass, SUN_EVENT_SUNSET
):
# Check for every light if it would be on if someone was home
# when the fading in started and turn it on if so
for index, light_id in enumerate(light_ids):

View File

@ -93,7 +93,6 @@ class DnsIPConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
errors = {}
if user_input:
hostname = user_input[CONF_HOSTNAME]
name = DEFAULT_NAME if hostname == DEFAULT_HOSTNAME else hostname
resolver = user_input.get(CONF_RESOLVER, DEFAULT_RESOLVER)

View File

@ -255,7 +255,6 @@ class Doods(ImageProcessingEntity):
)
for label, values in matches.items():
# Draw custom label regions/areas
if label in self._label_areas and self._label_areas[label] != [0, 0, 1, 1]:
box_label = f"{label.capitalize()} Detection Area"

View File

@ -66,7 +66,6 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
server_address = (conf.get(CONF_HOST), conf.get(CONF_PORT))
try:
ebusdpy.init(server_address)
hass.data[DOMAIN] = EbusdData(server_address, circuit)

View File

@ -160,7 +160,6 @@ class EcovacsVacuum(VacuumEntity):
def set_fan_speed(self, fan_speed: str, **kwargs: Any) -> None:
"""Set fan speed."""
if self.is_on:
self.device.run(sucks.Clean(mode=self.device.clean_status, speed=fan_speed))
def send_command(

View File

@ -87,7 +87,7 @@ class SmartPlugSwitch(SwitchEntity):
self._state = self._pca.get_state(self._device_id)
self._available = True
except (OSError) as ex:
except OSError as ex:
if self._available:
_LOGGER.warning("Could not read state for %s: %s", self.name, ex)
self._available = False

View File

@ -106,7 +106,6 @@ def setup_platform(
sensors = []
for elem in data.data:
if exclude_feeds is not None and int(elem["id"]) in exclude_feeds:
continue

View File

@ -379,7 +379,7 @@ class HueOneLightChangeView(HomeAssistantView):
else:
parsed[STATE_ON] = entity.state != STATE_OFF
for (key, attr) in (
for key, attr in (
(HUE_API_STATE_BRI, STATE_BRIGHTNESS),
(HUE_API_STATE_HUE, STATE_HUE),
(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_HUE, HUE_API_STATE_HUE),
(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
# 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_HUE, HUE_API_STATE_HUE_MIN, HUE_API_STATE_HUE_MAX),
(STATE_SATURATION, HUE_API_STATE_SAT_MIN, HUE_API_STATE_SAT_MAX),

View File

@ -33,7 +33,7 @@ SENSORS = (
key="seven_days_production",
name="Last Seven Days Energy Production",
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
state_class=SensorStateClass.TOTAL_INCREASING,
state_class=SensorStateClass.TOTAL,
device_class=SensorDeviceClass.ENERGY,
),
SensorEntityDescription(
@ -61,7 +61,7 @@ SENSORS = (
key="seven_days_consumption",
name="Last Seven Days Energy Consumption",
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
state_class=SensorStateClass.TOTAL_INCREASING,
state_class=SensorStateClass.TOTAL,
device_class=SensorDeviceClass.ENERGY,
),
SensorEntityDescription(

View File

@ -21,7 +21,6 @@ _LOGGER = logging.getLogger(__name__)
async def _async_has_devices(hass: HomeAssistant) -> bool:
controller_ready = asyncio.Event()
@callback

View File

@ -66,7 +66,6 @@ async def async_setup_entry(
camera_entities = []
for camera, value in coordinator.data.items():
camera_rtsp_entry = [
item
for item in hass.config_entries.async_entries(DOMAIN)
@ -81,7 +80,6 @@ async def async_setup_entry(
)
if camera_rtsp_entry:
ffmpeg_arguments = camera_rtsp_entry[0].options[CONF_FFMPEG_ARGUMENTS]
camera_username = camera_rtsp_entry[0].data[CONF_USERNAME]
camera_password = camera_rtsp_entry[0].data[CONF_PASSWORD]
@ -96,7 +94,6 @@ async def async_setup_entry(
)
else:
discovery_flow.async_create_flow(
hass,
DOMAIN,

View File

@ -182,7 +182,6 @@ class EzvizConfigFlow(ConfigFlow, domain=DOMAIN):
errors = {}
if user_input is not None:
if user_input[CONF_URL] == CONF_CUSTOMIZE:
self.context["data"] = {
CONF_USERNAME: user_input[CONF_USERNAME],

View File

@ -25,7 +25,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle the initial step."""
errors = {}
if user_input is not None:
await self.async_set_unique_id(user_input[CONF_ID])
self._abort_if_unique_id_configured()

View File

@ -56,7 +56,6 @@ SENSOR_TYPES = (
icon=ICON,
name="Last Updated",
device_class=SensorDeviceClass.TIMESTAMP,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
)

View File

@ -507,7 +507,6 @@ class RangeFilter(Filter, SensorEntity):
new_state_value = cast(float, new_state.state)
if self._upper_bound is not None and new_state_value > self._upper_bound:
self._stats_internal["erasures_up"] += 1
_LOGGER.debug(
@ -519,7 +518,6 @@ class RangeFilter(Filter, SensorEntity):
new_state.state = self._upper_bound
elif self._lower_bound is not None and new_state_value < self._lower_bound:
self._stats_internal["erasures_low"] += 1
_LOGGER.debug(
@ -564,7 +562,6 @@ class OutlierFilter(Filter, SensorEntity):
len(self.states) == self.states.maxlen
and abs(new_state_value - median) > self._radius
):
self._stats_internal["erasures"] += 1
_LOGGER.debug(

View File

@ -208,7 +208,6 @@ class FinTsClient:
holdings_accounts = []
for account in self.client.get_sepa_accounts():
if self.is_balance_account(account):
balance_accounts.append(account)

View File

@ -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])
unload_entries = []
for (conf, platform) in CONF_PLATFORM_MAP.items():
for conf, platform in CONF_PLATFORM_MAP.items():
if conf in config_entry.data:
unload_entries.append(
hass.config_entries.async_forward_entry_unload(config_entry, platform)

View File

@ -86,7 +86,6 @@ class FleetGoDeviceScanner:
for device in devices:
if not self._include or device.license_plate in self._include:
if device.active or device.current_address is None:
device.get_map_details()

View File

@ -74,7 +74,7 @@ class FliprDataUpdateCoordinator(DataUpdateCoordinator):
data = await self.hass.async_add_executor_job(
self.client.get_pool_measure_latest, self.flipr_id
)
except (FliprError) as error:
except FliprError as error:
raise UpdateFailed(error) from error
return data

View File

@ -43,7 +43,7 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator):
await self.send_presence_ping()
await self._update_device()
await self._update_consumption_data()
except (RequestError) as error:
except RequestError as error:
raise UpdateFailed(error) from error
@property

View File

@ -97,7 +97,6 @@ async def async_setup_entry(
]
flume_entity_list = []
for device in flume_devices:
device_id = device[KEY_DEVICE_ID]
device_timezone = device[KEY_DEVICE_LOCATION][KEY_DEVICE_LOCATION_TIMEZONE]
device_location_name = device[KEY_DEVICE_LOCATION][KEY_DEVICE_LOCATION_NAME]

View File

@ -102,7 +102,6 @@ async def _async_port_entities_list(
_LOGGER.debug("IP source for %s is %s", avm_wrapper.host, local_ip)
for i in range(port_forwards_count):
portmap = await avm_wrapper.async_get_port_mapping(
avm_wrapper.device_conn_type, i
)
@ -406,7 +405,6 @@ class FritzBoxPortSwitch(FritzBoxBaseSwitch, SwitchEntity):
self._attributes[attr] = self.port_mapping[key]
async def _async_switch_on_off_executor(self, turn_on: bool) -> bool:
if self.port_mapping is None:
return False

View File

@ -262,7 +262,6 @@ async def async_setup_entry(
if entity_id := ent_reg.async_get_entity_id(
Platform.SENSOR, DOMAIN, old_unique_id
):
ent_reg.async_update_entity(
entity_id, new_unique_id=f"{config_entry.entry_id}-{new_key}"
)

View File

@ -289,7 +289,6 @@ class AbstractConfig(ABC):
return
for user_agent_id, _ in self._store.agent_user_ids.items():
if (webhook_id := self.get_local_webhook_id(user_agent_id)) is None:
setup_successful = False
break

View File

@ -244,7 +244,6 @@ class SensorGroup(GroupEntity, SensorEntity):
_attr_available = False
_attr_should_poll = False
_attr_icon = "mdi:calculator"
def __init__(
self,
@ -352,6 +351,16 @@ class SensorGroup(GroupEntity, SensorEntity):
return self._attr_device_class
return self.calc_device_class
@property
def icon(self) -> str | None:
"""Return the icon.
Only override the icon if the device class is not set.
"""
if not self.device_class:
return "mdi:calculator"
return None
@property
def state_class(self) -> SensorStateClass | str | None:
"""Return state class."""

View File

@ -68,7 +68,6 @@
},
"sensor": {
"title": "[%key:component::group::config::step::user::title%]",
"description": "If \"ignore non-numeric\" is enabled, the group's state is calculated if at least one member has a numerical value. If \"ignore non-numeric\" is disabled, the group's state is calculated only if all group members have numerical values.",
"data": {
"ignore_non_numeric": "Ignore non-numeric",
"entities": "Members",
@ -134,7 +133,7 @@
}
},
"sensor": {
"description": "[%key:component::group::config::step::sensor::description%]",
"description": "If \"ignore non-numeric\" is enabled, the group's state is calculated if at least one member has a numerical value. If \"ignore non-numeric\" is disabled, the group's state is calculated only if all group members have numerical values.",
"data": {
"ignore_non_numeric": "[%key:component::group::config::step::sensor::data::ignore_non_numeric%]",
"entities": "[%key:component::group::config::step::sensor::data::entities%]",

View File

@ -63,7 +63,6 @@
"type": "Type",
"unit_of_measurement": "Unit of Measurement"
},
"description": "If \"ignore non-numeric\" is enabled, the group's state is calculated if at least one member has a numerical value. If \"ignore non-numeric\" is disabled, the group's state is calculated only if all group members have numerical values.",
"title": "Add Group"
},
"switch": {

View File

@ -64,7 +64,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle the initial step."""
errors = {}
if user_input is not None:
try:
validated = await validate_input(user_input)
except CannotConnect:

View File

@ -3,7 +3,7 @@
"name": "HomeKit Controller",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/homekit_controller",
"requirements": ["aiohomekit==2.4.4"],
"requirements": ["aiohomekit==2.4.6"],
"zeroconf": ["_hap._tcp.local.", "_hap._udp.local."],
"bluetooth": [{ "manufacturer_id": 76, "manufacturer_data_start": [6] }],
"dependencies": ["bluetooth_adapters", "zeroconf"],

View File

@ -316,7 +316,12 @@ class HomematicipHeatingGroup(HomematicipGenericEntity, ClimateEntity):
@property
def _first_radiator_thermostat(
self,
) -> AsyncHeatingThermostat | AsyncHeatingThermostatCompact | AsyncHeatingThermostatEvo | None:
) -> (
AsyncHeatingThermostat
| AsyncHeatingThermostatCompact
| AsyncHeatingThermostatEvo
| None
):
"""Return the first radiator thermostat from the hmip heating group."""
for device in self._device.devices:
if isinstance(

View File

@ -334,7 +334,6 @@ class HoneywellUSThermostat(ClimateEntity):
_LOGGER.error("Can not get system mode")
return
try:
# Set permanent hold
# and Set temperature
if mode in COOLING_MODES:

View File

@ -67,7 +67,6 @@ class HoneywellConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
errors["base"] = "cannot_connect"
else:
self.hass.config_entries.async_update_entry(
self.entry,
data={

View File

@ -92,7 +92,6 @@ async def handle_v2_migration(hass: core.HomeAssistant, entry: ConfigEntry) -> N
# initialize bridge connection just for the migration
async with HueBridgeV2(host, api_key) as api:
sensor_class_mapping = {
SensorDeviceClass.BATTERY.value: ResourceTypes.DEVICE_POWER,
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
for ent in async_entries_for_device(ent_reg, hass_dev_id, True):
if ent.entity_id.startswith("light"):
# migrate light
# should always return one lightid here

View File

@ -48,7 +48,6 @@ async def async_setup_entry(
for partial_station in station_information.get("partialStations", []):
for elevator in partial_station.get("elevators", []):
state = elevator.get("state") != "READY"
available = elevator.get("state") != "UNKNOWN"
label = elevator.get("label")

View File

@ -81,7 +81,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_station(self, user_input=None):
"""Handle the step where the user inputs his/her station."""
if user_input is not None:
errors = {}
check_name = await self.hub.gti.checkName(
@ -145,7 +144,6 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
"""Manage the options."""
errors = {}
if not self.departure_filters:
departure_list = {}
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:
options = {
CONF_FILTER: [
self.departure_filters[x] for x in user_input[CONF_FILTER]

View File

@ -259,7 +259,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
for device_entry in dr.async_entries_for_config_entry(
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:
break
else:

View File

@ -77,7 +77,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
target_keys[target] = api_keys[target]
try:
for target, key in target_keys.items():
res = pyfttt.send_event(key, event, value1, value2, value3)
if res.status_code != HTTPStatus.OK:

View File

@ -119,7 +119,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
)
if user_input is not None:
control_schema = vol.Schema(
{
vol.Required(

View File

@ -33,7 +33,6 @@ class IntellifireDataUpdateCoordinator(DataUpdateCoordinator[IntellifirePollData
self._api = api
async def _async_update_data(self) -> IntellifirePollData:
if not self._api.is_polling_in_background:
LOGGER.info("Starting Intellifire Background Polling Loop")
await self._api.start_background_polling()

View File

@ -95,7 +95,7 @@ async def async_setup_entry(
entities_by_address[node.address] = entity
# 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)
# Handle Insteon Thermostats
if device_type is not None and device_type.startswith(TYPE_CATEGORY_CLIMATE):

View File

@ -109,7 +109,6 @@ def _check_for_insteon_type(
device_type.startswith(t)
for t in set(NODE_FILTERS[platform][FILTER_INSTEON_TYPE])
):
# Hacky special-cases for certain devices with different platforms
# included as subnodes. Note that special-cases are not necessary
# on ISY 5.x firmware as it uses the superior NodeDefs method

View File

@ -173,6 +173,7 @@ class ControllerDevice(ClimateEntity):
async def async_added_to_hass(self) -> None:
"""Call on adding to hass."""
# Register for connect/disconnect/update events
@callback
def controller_disconnected(ctrl: Controller, ex: Exception) -> None:
@ -290,7 +291,7 @@ class ControllerDevice(ClimateEntity):
return HVACMode.OFF
if (mode := self._controller.mode) == Controller.Mode.FREE_AIR:
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:
return key
assert False, "Should be unreachable"
@ -527,7 +528,7 @@ class ZoneDevice(ClimateEntity):
def hvac_mode(self) -> HVACMode | None:
"""Return current operation ie. heat, cool, idle."""
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:
return key
return None

View File

@ -17,7 +17,6 @@ _LOGGER = logging.getLogger(__name__)
async def _async_has_devices(hass: HomeAssistant) -> bool:
controller_ready = asyncio.Event()
@callback

View File

@ -46,7 +46,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle the initial step."""
errors = {}
if user_input is not None:
await self.async_set_unique_id(user_input[CONF_ACCESS_TOKEN])
self._abort_if_unique_id_configured()

View File

@ -17,7 +17,7 @@ class DemoFixFlow(RepairsFlow):
) -> data_entry_flow.FlowResult:
"""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(
self, user_input: dict[str, str] | None = None

View File

@ -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
if config_entry.version == 1:
config_entry.version = 2
device_number = config_entry.data["device_number"]

View File

@ -296,7 +296,6 @@ class LIFXManager:
)
elif service == SERVICE_EFFECT_MORPH:
theme_name = kwargs.get(ATTR_THEME, "exciting")
palette = kwargs.get(ATTR_PALETTE, None)
@ -336,7 +335,6 @@ class LIFXManager:
)
elif service == SERVICE_EFFECT_PULSE:
effect = aiolifx_effects.EffectPulse(
power_on=kwargs.get(ATTR_POWER_ON),
period=kwargs.get(ATTR_PERIOD),
@ -347,7 +345,6 @@ class LIFXManager:
await self.effects_conductor.start(effect, bulbs)
elif service == SERVICE_EFFECT_COLORLOOP:
brightness = None
saturation_max = None
saturation_min = None
@ -378,7 +375,6 @@ class LIFXManager:
await self.effects_conductor.start(effect, bulbs)
elif service == SERVICE_EFFECT_STOP:
await self.effects_conductor.stop(bulbs)
for coordinator in coordinators:

View File

@ -218,7 +218,6 @@ def parse_api_response(response):
for authority in AUTHORITIES:
for entry in response["HourlyAirQualityIndex"]["LocalAuthority"]:
if entry["@LocalAuthorityName"] == authority:
if isinstance(entry["Site"], dict):
entry_sites_data = [entry["Site"]]
else:

View File

@ -157,7 +157,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
return
if change_type == collection.CHANGE_ADDED:
existing = hass.data[DOMAIN]["dashboards"].get(url_path)
if existing:

View File

@ -31,7 +31,6 @@ def setup_platform(
devices = []
for device in data.lupusec.get_devices(generic_type=CONST.TYPE_SWITCH):
devices.append(LupusecSwitch(data, device))
add_entities(devices)

View File

@ -24,7 +24,7 @@ def setup_platform(
if discovery_info is None:
return
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])
devs.append(dev)

View File

@ -26,7 +26,7 @@ def setup_platform(
) -> None:
"""Set up the Lutron shades."""
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])
devs.append(dev)

View File

@ -19,7 +19,7 @@ def setup_platform(
) -> None:
"""Set up the Lutron lights."""
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])
devs.append(dev)

View File

@ -21,7 +21,7 @@ def setup_platform(
devs = []
# 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])
devs.append(dev)

View File

@ -256,7 +256,6 @@ def _async_setup_keypads(
leap_to_keypad_button_names: dict[int, dict[int, str]] = {}
for bridge_button in bridge_buttons.values():
parent_device = cast(str, bridge_button["parent_device"])
bridge_keypad = bridge_devices[parent_device]
keypad_lutron_device_id = cast(int, bridge_keypad["device_id"])

View File

@ -29,7 +29,6 @@ async def async_setup_entry(
entities: list[LutronCasetaButton] = []
for device in button_devices.values():
parent_keypad = keypads[device["parent_device"]]
parent_device_info = parent_keypad["device_info"]

View File

@ -2,7 +2,7 @@
"domain": "lutron_caseta",
"name": "Lutron Cas\u00e9ta",
"documentation": "https://www.home-assistant.io/integrations/lutron_caseta",
"requirements": ["pylutron-caseta==0.18.0"],
"requirements": ["pylutron-caseta==0.18.1"],
"config_flow": true,
"zeroconf": [
{

View File

@ -93,7 +93,6 @@ async def async_setup_platform(
async_add_entities([new_stb])
if not config[CONF_OPTIMISTIC]:
already_installed = hass.data.get(DISCOVERY_MEDIAROOM)
if not already_installed:
hass.data[DISCOVERY_MEDIAROOM] = await install_mediaroom_protocol(

View File

@ -80,12 +80,10 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
for discovery_info in async_discovered_service_info(
self.hass, connectable=True
):
if discovery_info.manufacturer_id == MANUFACTURER_ID and any(
manufacturer_data.startswith(MANUFACTURER_DATA_START)
for manufacturer_data in discovery_info.manufacturer_data.values()
):
address = discovery_info.address
if (
address not in current_addresses

View File

@ -94,7 +94,7 @@ class MetWeather(CoordinatorEntity[MetDataUpdateCoordinator], WeatherEntity):
self._hourly = hourly
@property
def track_home(self) -> (Any | bool):
def track_home(self) -> Any | bool:
"""Return if we are tracking home."""
return self._config.get(CONF_TRACK_HOME, False)

View File

@ -172,7 +172,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
if hass.data[DOMAIN][entry.entry_id][COORDINATOR_ALERT]:
department = hass.data[DOMAIN][entry.entry_id][
COORDINATOR_FORECAST
].data.position.get("dept")

View File

@ -35,12 +35,10 @@ async def async_setup_entry(
# Restore clients that is not a part of active clients list.
for entity in registry.entities.values():
if (
entity.config_entry_id == config_entry.entry_id
and entity.domain == DEVICE_TRACKER
):
if (
entity.unique_id in coordinator.api.devices
or entity.unique_id not in coordinator.api.all_devices

View File

@ -22,7 +22,7 @@ async def async_check_srv_record(
srv_records = await aiodns.DNSResolver().query(
host=f"{SRV_RECORD_PREFIX}.{host}", qtype="SRV"
)
except (aiodns.error.DNSError):
except aiodns.error.DNSError:
# 'host' is not a SRV record.
pass
else:

View File

@ -249,7 +249,10 @@ CLIMATE_SCHEMA = vol.All(
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_COIL,

View File

@ -315,7 +315,6 @@ class MoldIndicator(SensorEntity):
def _calc_moldindicator(self):
"""Calculate the humidity at the (cold) calibration point."""
if None in (self._dewpoint, self._calib_factor) or self._calib_factor == 0:
_LOGGER.debug(
"Invalid inputs - dewpoint: %s, calibration-factor: %s",
self._dewpoint,

View File

@ -76,10 +76,12 @@ SENSOR_DESCRIPTIONS = {
"accelerometer_x": SensorEntityDescription(
key="accelerometer_x",
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
"accelerometer_y": SensorEntityDescription(
key="accelerometer_y",
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
}

View File

@ -0,0 +1,7 @@
{
"config": {
"abort": {
"already_configured": "Za\u0159\u00edzen\u00ed je ji\u017e konfigurovan\u00e9"
}
}
}

View File

@ -0,0 +1,21 @@
{
"config": {
"abort": {
"already_configured": "\u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u0442\u043e \u0432\u0435\u0447\u0435 \u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0430\u043d\u043e",
"no_devices_found": "\u041d\u044f\u043c\u0430 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 \u043c\u0440\u0435\u0436\u0430\u0442\u0430",
"not_supported": "\u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u0442\u043e \u043d\u0435 \u0441\u0435 \u043f\u043e\u0434\u0434\u044a\u0440\u0436\u0430"
},
"flow_title": "{name}",
"step": {
"bluetooth_confirm": {
"description": "\u0418\u0441\u043a\u0430\u0442\u0435 \u043b\u0438 \u0434\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0430\u0442\u0435 {name}?"
},
"user": {
"data": {
"address": "\u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e"
},
"description": "\u0418\u0437\u0431\u0435\u0440\u0435\u0442\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0435\u0442\u043e \u0434\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0430\u0442\u0435"
}
}
}
}

View File

@ -0,0 +1,22 @@
{
"config": {
"abort": {
"already_configured": "El dispositiu ja est\u00e0 configurat",
"already_in_progress": "El flux de configuraci\u00f3 ja est\u00e0 en curs",
"no_devices_found": "No s'han trobat dispositius a la xarxa",
"not_supported": "Dispositiu no compatible"
},
"flow_title": "{name}",
"step": {
"bluetooth_confirm": {
"description": "Vols configurar {name}?"
},
"user": {
"data": {
"address": "Dispositiu"
},
"description": "Tria un dispositiu a configurar"
}
}
}
}

View File

@ -0,0 +1,22 @@
{
"config": {
"abort": {
"already_configured": "Ger\u00e4t ist bereits konfiguriert",
"already_in_progress": "Der Konfigurationsablauf wird bereits ausgef\u00fchrt",
"no_devices_found": "Keine Ger\u00e4te im Netzwerk gefunden",
"not_supported": "Ger\u00e4t nicht unterst\u00fctzt"
},
"flow_title": "{name}",
"step": {
"bluetooth_confirm": {
"description": "M\u00f6chtest du {name} einrichten?"
},
"user": {
"data": {
"address": "Ger\u00e4t"
},
"description": "W\u00e4hle ein Ger\u00e4t zum Einrichten aus"
}
}
}
}

View File

@ -0,0 +1,7 @@
{
"config": {
"abort": {
"not_supported": "\u0397 \u03c3\u03c5\u03c3\u03ba\u03b5\u03c5\u03ae \u03b4\u03b5\u03bd \u03c5\u03c0\u03bf\u03c3\u03c4\u03b7\u03c1\u03af\u03b6\u03b5\u03c4\u03b1\u03b9"
}
}
}

View File

@ -0,0 +1,22 @@
{
"config": {
"abort": {
"already_configured": "Device is already configured",
"already_in_progress": "Configuration flow is already in progress",
"no_devices_found": "No devices found on the network",
"not_supported": "Device not supported"
},
"flow_title": "{name}",
"step": {
"bluetooth_confirm": {
"description": "Do you want to set up {name}?"
},
"user": {
"data": {
"address": "Device"
},
"description": "Choose a device to set up"
}
}
}
}

View File

@ -0,0 +1,22 @@
{
"config": {
"abort": {
"already_configured": "El dispositivo ya est\u00e1 configurado",
"already_in_progress": "El flujo de configuraci\u00f3n ya est\u00e1 en curso",
"no_devices_found": "No se encontraron dispositivos en la red",
"not_supported": "Dispositivo no compatible"
},
"flow_title": "{name}",
"step": {
"bluetooth_confirm": {
"description": "\u00bfQuieres configurar {name}?"
},
"user": {
"data": {
"address": "Dispositivo"
},
"description": "Elige un dispositivo para configurar"
}
}
}
}

View File

@ -0,0 +1,22 @@
{
"config": {
"abort": {
"already_configured": "Seade on juba h\u00e4\u00e4lestatud",
"already_in_progress": "Seadistamine on juba k\u00e4imas",
"no_devices_found": "V\u00f5rgust ei leitud \u00fchtegi seadet",
"not_supported": "Seadet ei toetata"
},
"flow_title": "{name}",
"step": {
"bluetooth_confirm": {
"description": "Kas seadistada {name} ?"
},
"user": {
"data": {
"address": "Seade"
},
"description": "Vali h\u00e4\u00e4lestatav seade"
}
}
}
}

View File

@ -0,0 +1,21 @@
{
"config": {
"abort": {
"already_configured": "L'appareil est d\u00e9j\u00e0 configur\u00e9",
"no_devices_found": "Aucun appareil trouv\u00e9 sur le r\u00e9seau",
"not_supported": "Appareil non pris en charge"
},
"flow_title": "{name}",
"step": {
"bluetooth_confirm": {
"description": "Voulez-vous configurer {name}\u00a0?"
},
"user": {
"data": {
"address": "Appareil"
},
"description": "S\u00e9lectionnez l'appareil \u00e0 configurer"
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More