8000 2021.10.6 by balloob · Pull Request #57944 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

2021.10.6 #57944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def update(self):
if has_check_control_messages:
cbs_list = []
for message in check_control_messages:
cbs_list.append(message.description_short)
cbs_list.append(message["ccmDescriptionShort"])
result["check_control_messages"] = cbs_list
else:
result["check_control_messages"] = "OK"
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/bond/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Bond",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/bond",
"requirements": ["bond-api==0.1.13"],
"requirements": ["bond-api==0.1.14"],
"zeroconf": ["_bond._tcp.local."],
"codeowners": ["@prystupa", "@joshs85"],
"quality_scale": "platinum",
Expand Down
13 changes: 2 additions & 11 deletions homeassistant/components/harmony/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"""The Logitech Harmony Hub integration."""
import asyncio
import logging

from homeassistant.components.remote import ATTR_ACTIVITY, ATTR_DELAY_SECS
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_NAME, EVENT_HOMEASSISTANT_STOP
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import entity_registry
from homeassistant.helpers.dispatcher import async_dispatcher_send

Expand Down Expand Up @@ -34,13 +32,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
address = entry.data[CONF_HOST]
name = entry.data[CONF_NAME]
data = HarmonyData(hass, address, name, entry.unique_id)
try:
connected_ok = await data.connect()
except (asyncio.TimeoutError, ValueError, AttributeError) as err:
raise ConfigEntryNotReady from err

if not connected_ok:
raise ConfigEntryNotReady
await data.connect()

await _migrate_old_unique_ids(hass, entry.entry_id, data)

Expand All @@ -51,8 +43,7 @@ async def _async_on_stop(event):

cancel_stop = hass.bus.async_listen(EVENT_HOMEASSISTANT_STOP, _async_on_stop)

hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = {
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = {
HARMONY_DATA: data,
CANCEL_LISTENER: cancel_listener,
CANCEL_STOP: cancel_stop,
Expand Down
27 changes: 17 additions & 10 deletions homeassistant/components/harmony/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
"""Config flow for Logitech Harmony Hub integration."""
import asyncio
import logging
from urllib.parse import urlparse

from aioharmony.hubconnector_websocket import HubConnector
import aiohttp
import voluptuous as vol

from homeassistant import config_entries, exceptions
Expand Down ED48 Expand Up @@ -94,16 +97,20 @@ async def async_step_ssdp(self, discovery_info):
CONF_NAME: friendly_name,
}

harmony = await get_harmony_client_if_available(parsed_url.hostname)

if harmony:
unique_id = find_unique_id_for_remote(harmony)
await self.async_set_unique_id(unique_id)
self._abort_if_unique_id_configured(
updates={CONF_HOST: self.harmony_config[CONF_HOST]}
)
self.harmony_config[UNIQUE_ID] = unique_id

connector = HubConnector(parsed_url.hostname, asyncio.Queue())
try:
remote_id = await connector.get_remote_id()
except aiohttp.ClientError:
return self.async_abort(reason="cannot_connect")
finally:
await connector.async_close_session()

unique_id = str(remote_id)
await self.async_set_unique_id(str(unique_id))
self._abort_if_unique_id_configured(
updates={CONF_HOST: self.harmony_config[CONF_HOST]}
)
self.harmony_config[UNIQUE_ID] = unique_id
return await self.async_step_link()

async def async_step_link(self, user_input=None):
Expand Down
29 changes: 20 additions & 9 deletions homeassistant/components/harmony/data.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
"""Harmony data object which contains the Harmony Client."""
from __future__ import annotations

import asyncio
from collections.abc import Iterable
import logging

from aioharmony.const import ClientCallbackType, SendCommandDevice
import aioharmony.exceptions as aioexc
from aioharmony.harmonyapi import HarmonyAPI as HarmonyClient

from homeassistant.exceptions import ConfigEntryNotReady

from .const import ACTIVITY_POWER_OFF
from .subscriber import HarmonySubscriberMixin

Expand Down Expand Up @@ -109,16 +112,24 @@ async def connect(self) -> bool:
ip_address=self._address, callbacks=ClientCallbackType(**callbacks)
)

connected = False
try:
if not await self._client.connect():
_LOGGER.warning("%s: Unable to connect to HUB", self._name)
await self._client.close()
return False
except aioexc.TimeOut:
_LOGGER.warning("%s: Connection timed-out", self._name)
return False

return True
connected = await self._client.connect()
except (asyncio.TimeoutError, aioexc.TimeOut) as err:
await self._client.close()
raise ConfigEntryNotReady(
f"{self._name}: Connection timed-out to {self._address}:8088"
) from err
except (ValueError, AttributeError) as err:
await self._client.close()
raise ConfigEntryNotReady(
f"{self._name}: Error {err} while connected HUB at: {self._address}:8088"
) from err
if not connected:
await self._client.close()
raise ConfigEntryNotReady(
f"{self._name}: Unable to connect to HUB at: {self._address}:8088"
)

async def shutdown(self):
"""Close connection on shutdown."""
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/harmony/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"domain": "harmony",
"name": "Logitech Harmony Hub",
"documentation": "https://www.home-assistant.io/integrations/harmony",
"requirements": ["aioharmony==0.2.7"],
"requirements": ["aioharmony==0.2.8"],
"codeowners": [
"@ehendrix23",
"@bramkragten",
Expand Down
23 changes: 12 additions & 11 deletions homeassistant/components/plugwise/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_ILLUMINANCE,
DEVICE_CLASS_POWER,
DEVICE_CLASS_PRESSURE,
Expand Down Expand Up @@ -68,32 +69,32 @@
"electricity_consumed_interval": [
"Consumed Power Interval",
ENERGY_WATT_HOUR,
DEVICE_CLASS_POWER,
DEVICE_CLASS_ENERGY,
],
"electricity_consumed_peak_interval": [
"Consumed Power Interval",
ENERGY_WATT_HOUR,
DEVICE_CLASS_POWER,
DEVICE_CLASS_ENERGY,
],
"electricity_consumed_off_peak_interval": [
"Consumed Power Interval (off peak)",
ENERGY_WATT_HOUR,
DEVICE_CLASS_POWER,
DEVICE_CLASS_ENERGY,
],
"electricity_produced_interval": [
"Produced Power Interval",
ENERGY_WATT_HOUR,
DEVICE_CLASS_POWER,
DEVICE_CLASS_ENERGY,
],
"electricity_produced_peak_interval": [
"Produced Power Interval",
ENERGY_WATT_HOUR,
DEVICE_CLASS_POWER,
DEVICE_CLASS_ENERGY,
],
"electricity_produced_off_peak_interval": [
"Produced Power Interval (off peak)",
ENERGY_WATT_HOUR,
DEVICE_CLASS_POWER,
DEVICE_CLASS_ENERGY,
],
"electricity_consumed_off_peak_point": [
"Current Consumed Power (off peak)",
Expand All @@ -108,12 +109,12 @@
"electricity_consumed_off_peak_cumulative": [
"Cumulative Consumed Power (off peak)",
ENERGY_KILO_WATT_HOUR,
DEVICE_CLASS_POWER,
DEVICE_CLASS_ENERGY,
],
"electricity_consumed_peak_cumulative": [
"Cumulative Consumed Power",
ENERGY_KILO_WATT_HOUR,
DEVICE_CLASS_POWER,
DEVICE_CLASS_ENERGY,
],
"electricity_produced_off_peak_point": [
"Current Produced Power (off peak)",
Expand All @@ -128,12 +129,12 @@
"electricity_produced_off_peak_cumulative": [
"Cumulative Produced Power (off peak)",
ENERGY_KILO_WATT_HOUR,
DEVICE_CLASS_POWER,
DEVICE_CLASS_ENERGY,
],
"electricity_produced_peak_cumulative": [
"Cumulative Produced Power",
ENERGY_KILO_WATT_HOUR,
DEVICE_CLASS_POWER,
DEVICE_CLASS_ENERGY,
],
"gas_consumed_interval": [
"Current Consumed Gas Interval",
Expand All @@ -145,7 +146,7 @@
"net_electricity_cumulative": [
"Cumulative net Power",
ENERGY_KILO_WATT_HOUR,
DEVICE_CLASS_POWER,
DEVICE_CLASS_ENERGY,
],
}

Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/tile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ def async_migrate_callback(entity_entry: RegistryEntry) -> dict | None:

await async_migrate_entries(hass, entry.entry_id, async_migrate_callback)

websession = aiohttp_client.async_get_clientsession(hass)
# Tile's API uses cookies to identify a consumer; in order to allow for multiple
# instances of this config entry, we use a new session each time:
websession = aiohttp_client.async_create_clientsession(hass)

try:
client = await async_login(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tile/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Tile",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/tile",
"requirements": ["pytile==5.2.3"],
"requirements": ["pytile==5.2.4"],
"codeowners": ["@bachya"],
"iot_class": "cloud_polling"
}
28 changes: 21 additions & 7 deletions homeassistant/components/yeelight/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from homeassistant import config_entries, exceptions
from homeassistant.components.dhcp import IP_ADDRESS
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import CONF_DEVICE, CONF_HOST, CONF_ID, CONF_NAME
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
Expand Down Expand Up @@ -66,18 +67,30 @@ async def async_step_zeroconf(self, discovery_info):
await self.async_set_unique_id(
"{0:#0{1}x}".format(int(discovery_info["name"][-26:-18]), 18)
)
self._abort_if_unique_id_configured(
updates={CONF_HOST: self._discovered_ip}, reload_on_update=False
)
return await self._async_handle_discovery()
return await self._async_handle_discovery_with_unique_id()

async def async_step_ssdp(self, discovery_info):
"""Handle discovery from ssdp."""
self._discovered_ip = urlparse(discovery_info["location"]).hostname
await self.async_set_unique_id(discovery_info["id"])
self._abort_if_unique_id_configured(
updates={CONF_HOST: self._discovered_ip}, reload_on_update=False
)
return await self._async_handle_discovery_with_unique_id()

async def _async_handle_discovery_with_unique_id(self):
"""Handle any discovery with a unique id."""
for entry in self._async_current_entries():
if entry.unique_id != self.unique_id:
continue
reload = entry.state == ConfigEntryState.SETUP_RETRY
if entry.data[CONF_HOST] != self._discovered_ip:
self.hass.config_entries.async_update_entry(
entry, data={**entry.data, CONF_HOST: self._discovered_ip}
)
reload = True
if reload:
self.hass.async_create_task(
self.hass.config_entries.async_reload(entry.entry_id)
)
return self.async_abort(reason="already_configured")
return await self._async_handle_discovery()

async def _async_handle_discovery(self):
Expand All @@ -86,6 +99,7 @@ async def _async_handle_discovery(self):
for progress in self._async_in_progress():
if progress.get("context", {}).get(CONF_HOST) == self._discovered_ip:
return self.async_abort(reason="already_in_progress")
self._async_abort_entries_match({CONF_HOST: self._discovered_ip})

try:
self._discovered_model = await self._async_try_connect(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

MAJOR_VERSION: Final = 2021
MINOR_VERSION: Final = 10
PATCH_VERSION: Final = "5"
PATCH_VERSION: Final = "6"
__short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__: Final = f"{__short_version__}.{PATCH_VERSION}"
REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 8, 0)
Expand Down
6 changes: 3 additions & 3 deletions requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ aiogithubapi==21.8.0
aioguardian==1.0.8

# homeassistant.components.harmony
aioharmony==0.2.7
aioharmony==0.2.8

# homeassistant.components.homekit_controller
aiohomekit==0.6.3
Expand Down Expand Up @@ -415,7 +415,7 @@ blockchain==1.4.4
# bme680==1.0.5

# homeassistant.components.bond
bond-api==0.1.13
bond-api==0.1.14

# homeassistant.components.bosch_shc
boschshcpy==0.2.19
Expand Down Expand Up @@ -1964,7 +1964,7 @@ python_opendata_transport==0.2.1
pythonegardia==1.0.40

# homeassistant.components.tile
pytile==5.2.3
pytile==5.2.4

# homeassistant.components.touchline
pytouchline==0.7
Expand Down
6 changes: 3 additions & 3 deletions requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ aioflo==0.4.1
aioguardian==1.0.8

# homeassistant.components.harmony
aioharmony==0.2.7
aioharmony==0.2.8

# homeassistant.components.homekit_controller
aiohomekit==0.6.3
Expand Down Expand Up @@ -254,7 +254,7 @@ blebox_uniapi==1.3.3
blinkpy==0.17.0

# homeassistant.components.bond
bond-api==0.1.13
bond-api==0.1.14

# homeassistant.components.bosch_shc
boschshcpy==0.2.19
Expand Down Expand Up @@ -1127,7 +1127,7 @@ python-twitch-client==0.6.0
python_awair==0.2.1

# homeassistant.components.tile
pytile==5.2.3
pytile==5.2.4

# homeassistant.components.traccar
pytraccar==0.9.0
Expand Down
Loading
0