This commit is contained in:
Paulus Schoutsen 2022-10-09 15:46:11 -04:00 committed by GitHub
commit 0bca322856
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 95 additions and 133 deletions

View File

@ -3,7 +3,7 @@
"name": "Daikin AC",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/daikin",
"requirements": ["pydaikin==2.7.0"],
"requirements": ["pydaikin==2.7.2"],
"codeowners": ["@fredrike"],
"zeroconf": ["_dkapi._tcp.local."],
"quality_scale": "platinum",

View File

@ -7,7 +7,6 @@ import voluptuous as vol
from homeassistant.const import CONF_DOMAIN
from homeassistant.core import Context, HomeAssistant
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.typing import ConfigType
from . import DeviceAutomationType, async_get_device_automation_platform
@ -52,15 +51,14 @@ async def async_validate_action_config(
) -> ConfigType:
"""Validate config."""
try:
config = cv.DEVICE_ACTION_SCHEMA(config)
platform = await async_get_device_automation_platform(
hass, config[CONF_DOMAIN], DeviceAutomationType.ACTION
)
if hasattr(platform, "async_validate_action_config"):
return await platform.async_validate_action_config(hass, config)
return cast(ConfigType, platform.ACTION_SCHEMA(config))
except (vol.Invalid, InvalidDeviceAutomationConfig) as err:
raise vol.Invalid("invalid action configuration: " + str(err)) from err
except InvalidDeviceAutomationConfig as err:
raise vol.Invalid(str(err) or "Invalid action configuration") from err
async def async_call_action_from_config(

View File

@ -58,8 +58,8 @@ async def async_validate_condition_config(
if hasattr(platform, "async_validate_condition_config"):
return await platform.async_validate_condition_config(hass, config)
return cast(ConfigType, platform.CONDITION_SCHEMA(config))
except (vol.Invalid, InvalidDeviceAutomationConfig) as err:
raise vol.Invalid("invalid condition configuration: " + str(err)) from err
except InvalidDeviceAutomationConfig as err:
raise vol.Invalid(str(err) or "Invalid condition configuration") from err
async def async_condition_from_config(

View File

@ -58,15 +58,14 @@ async def async_validate_trigger_config(
) -> ConfigType:
"""Validate config."""
try:
config = TRIGGER_SCHEMA(config)
platform = await async_get_device_automation_platform(
hass, config[CONF_DOMAIN], DeviceAutomationType.TRIGGER
)
if not hasattr(platform, "async_validate_trigger_config"):
return cast(ConfigType, platform.TRIGGER_SCHEMA(config))
return await platform.async_validate_trigger_config(hass, config)
except (vol.Invalid, InvalidDeviceAutomationConfig) as err:
raise InvalidDeviceAutomationConfig("invalid trigger configuration") from err
except InvalidDeviceAutomationConfig as err:
raise vol.Invalid(str(err) or "Invalid trigger configuration") from err
async def async_attach_trigger(

View File

@ -1,6 +1,7 @@
"""Bluetooth support for esphome."""
from __future__ import annotations
from collections.abc import Callable
import logging
from aioesphomeapi import APIClient
@ -11,14 +12,8 @@ from homeassistant.components.bluetooth import (
async_register_scanner,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import (
CALLBACK_TYPE,
HomeAssistant,
async_get_hass,
callback as hass_callback,
)
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback as hass_callback
from ..domain_data import DomainData
from ..entry_data import RuntimeEntryData
from .client import ESPHomeClient
from .scanner import ESPHomeScanner
@ -27,18 +22,23 @@ _LOGGER = logging.getLogger(__name__)
@hass_callback
def async_can_connect(source: str) -> bool:
"""Check if a given source can make another connection."""
domain_data = DomainData.get(async_get_hass())
entry = domain_data.get_by_unique_id(source)
entry_data = domain_data.get_entry_data(entry)
_LOGGER.debug(
"Checking if %s can connect, available=%s, ble_connections_free=%s",
source,
entry_data.available,
entry_data.ble_connections_free,
)
return bool(entry_data.available and entry_data.ble_connections_free)
def _async_can_connect_factory(
entry_data: RuntimeEntryData, source: str
) -> Callable[[], bool]:
"""Create a can_connect function for a specific RuntimeEntryData instance."""
@hass_callback
def _async_can_connect() -> bool:
"""Check if a given source can make another connection."""
_LOGGER.debug(
"Checking if %s can connect, available=%s, ble_connections_free=%s",
source,
entry_data.available,
entry_data.ble_connections_free,
)
return bool(entry_data.available and entry_data.ble_connections_free)
return _async_can_connect
async def async_connect_scanner(
@ -63,7 +63,7 @@ async def async_connect_scanner(
connector = HaBluetoothConnector(
client=ESPHomeClient,
source=source,
can_connect=lambda: async_can_connect(source),
can_connect=_async_can_connect_factory(entry_data, source),
)
scanner = ESPHomeScanner(hass, source, new_info_callback, connector, connectable)
unload_callbacks = [

View File

@ -16,7 +16,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.util import Throttle
from homeassistant.util.dt import get_time_zone, utcnow
from .const import ATTRIBUTION, CONF_STATION, DOMAIN, MANUFACTURER
from .const import ATTRIBUTION, CONF_REAL_TIME, CONF_STATION, DOMAIN, MANUFACTURER
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=1)
MAX_LIST = 20
@ -90,7 +90,7 @@ class HVVDepartureSensor(SensorEntity):
},
"maxList": MAX_LIST,
"maxTimeOffset": MAX_TIME_OFFSET,
"useRealtime": self.config_entry.options.get("realtime", False),
"useRealtime": self.config_entry.options.get(CONF_REAL_TIME, False),
}
if "filter" in self.config_entry.options:

View File

@ -5,17 +5,14 @@
"config_flow": true,
"bluetooth": [
{
"service_uuid": "00001831-0000-1000-8000-00805f9b34fb"
},
{
"service_data_uuid": "00001831-0000-1000-8000-00805f9b34fb"
"service_uuid": "0000abcd-0000-1000-8000-00805f9b34fb"
},
{
"local_name": "mib*"
}
],
"codeowners": ["@spycle"],
"requirements": ["PyMicroBot==0.0.6"],
"requirements": ["PyMicroBot==0.0.8"],
"iot_class": "assumed_state",
"dependencies": ["bluetooth"],
"loggers": ["keymitt_ble"]

View File

@ -39,13 +39,13 @@ TUBE_LINES = [
"Circle",
"District",
"DLR",
"Elizabeth line",
"Hammersmith & City",
"Jubilee",
"London Overground",
"Metropolitan",
"Northern",
"Piccadilly",
"TfL Rail",
"Victoria",
"Waterloo & City",
]

View File

@ -139,6 +139,14 @@ async def async_start( # noqa: C901
key = DEVICE_ABBREVIATIONS.get(key, key)
device[key] = device.pop(abbreviated_key)
if CONF_AVAILABILITY in payload:
for availability_conf in cv.ensure_list(payload[CONF_AVAILABILITY]):
if isinstance(availability_conf, dict):
for key in list(availability_conf):
abbreviated_key = key
key = ABBREVIATIONS.get(key, key)
availability_conf[key] = availability_conf.pop(abbreviated_key)
if TOPIC_BASE in payload:
base = payload.pop(TOPIC_BASE)
for key, value in payload.items():

View File

@ -2,7 +2,7 @@
"domain": "netatmo",
"name": "Netatmo",
"documentation": "https://www.home-assistant.io/integrations/netatmo",
"requirements": ["pyatmo==7.1.0"],
"requirements": ["pyatmo==7.1.1"],
"after_dependencies": ["cloud", "media_source"],
"dependencies": ["application_credentials", "webhook"],
"codeowners": ["@cgtobi"],

View File

@ -29,7 +29,7 @@ from .const import (
STEP_USER_DATA_SCHEMA = vol.Schema(
{
vol.Required(CONF_MODEL): vol.In([e.name for e in Model]),
vol.Required(CONF_MODEL): vol.In(list(Model.__members__)),
vol.Required(CONF_IP_ADDRESS): str,
vol.Required(CONF_LISTENING_PORT): cv.port,
vol.Required(CONF_REMOTE_READ_PORT): cv.port,

View File

@ -3,7 +3,7 @@
"name": "Overkiz",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/overkiz",
"requirements": ["pyoverkiz==1.5.3"],
"requirements": ["pyoverkiz==1.5.5"],
"zeroconf": [
{
"type": "_kizbox._tcp.local.",

View File

@ -80,6 +80,7 @@ async def async_validate_action_config(
hass: HomeAssistant, config: ConfigType
) -> ConfigType:
"""Validate config."""
config = ACTION_SCHEMA(config)
commands, _ = _get_commands(hass, config[CONF_DEVICE_ID], config[CONF_TYPE])
sub_type = config[CONF_SUBTYPE]

View File

@ -489,7 +489,10 @@ class SonosSpeaker:
return
if crossfade := event.variables.get("current_crossfade_mode"):
self.cross_fade = bool(int(crossfade))
crossfade = bool(int(crossfade))
if self.cross_fade != crossfade:
self.cross_fade = crossfade
self.async_write_entity_states()
# Missing transport_state indicates a transient error
if (new_status := event.variables.get("transport_state")) is None:

View File

@ -3,7 +3,7 @@
"name": "UniFi Network",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/unifi",
"requirements": ["aiounifi==37"],
"requirements": ["aiounifi==38"],
"codeowners": ["@Kane610"],
"quality_scale": "platinum",
"ssdp": [

View File

@ -4,15 +4,15 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/zha",
"requirements": [
"bellows==0.34.1",
"bellows==0.34.2",
"pyserial==3.5",
"pyserial-asyncio==0.6",
"zha-quirks==0.0.82",
"zigpy-deconz==0.19.0",
"zigpy==0.51.2",
"zigpy-xbee==0.16.0",
"zigpy-zigate==0.10.0",
"zigpy-znp==0.9.0"
"zigpy==0.51.3",
"zigpy-xbee==0.16.1",
"zigpy-zigate==0.10.1",
"zigpy-znp==0.9.1"
],
"usb": [
{

View File

@ -8,7 +8,7 @@ from .backports.enum import StrEnum
APPLICATION_NAME: Final = "HomeAssistant"
MAJOR_VERSION: Final = 2022
MINOR_VERSION: Final = 10
PATCH_VERSION: Final = "1"
PATCH_VERSION: Final = "2"
__short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__: Final = f"{__short_version__}.{PATCH_VERSION}"
REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 9, 0)

View File

@ -173,11 +173,7 @@ BLUETOOTH: list[dict[str, bool | str | int | list[int]]] = [
},
{
"domain": "keymitt_ble",
"service_uuid": "00001831-0000-1000-8000-00805f9b34fb",
},
{
"domain": "keymitt_ble",
"service_data_uuid": "00001831-0000-1000-8000-00805f9b34fb",
"service_uuid": "0000abcd-0000-1000-8000-00805f9b34fb",
},
{
"domain": "keymitt_ble",

View File

@ -38,7 +38,7 @@ pyyaml==6.0
requests==2.28.1
scapy==2.4.5
sqlalchemy==1.4.41
typing-extensions>=3.10.0.2,<5.0
typing-extensions>=4.4.0,<5.0
voluptuous-serialize==2.5.0
voluptuous==0.13.1
yarl==1.8.1

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "homeassistant"
version = "2022.10.1"
version = "2022.10.2"
license = {text = "Apache-2.0"}
description = "Open-source home automation platform running on Python 3."
readme = "README.rst"
@ -48,7 +48,7 @@ dependencies = [
"python-slugify==4.0.1",
"pyyaml==6.0",
"requests==2.28.1",
"typing-extensions>=3.10.0.2,<5.0",
"typing-extensions>=4.4.0,<5.0",
"voluptuous==0.13.1",
"voluptuous-serialize==2.5.0",
"yarl==1.8.1",

View File

@ -22,7 +22,7 @@ pip>=21.0,<22.3
python-slugify==4.0.1
pyyaml==6.0
requests==2.28.1
typing-extensions>=3.10.0.2,<5.0
typing-extensions>=4.4.0,<5.0
voluptuous==0.13.1
voluptuous-serialize==2.5.0
yarl==1.8.1

View File

@ -23,7 +23,7 @@ PyFlick==0.0.2
PyMVGLive==1.1.4
# homeassistant.components.keymitt_ble
PyMicroBot==0.0.6
PyMicroBot==0.0.8
# homeassistant.components.mobile_app
# homeassistant.components.owntracks
@ -276,7 +276,7 @@ aiosyncthing==0.5.1
aiotractive==0.5.4
# homeassistant.components.unifi
aiounifi==37
aiounifi==38
# homeassistant.components.vlc_telnet
aiovlc==0.1.0
@ -401,7 +401,7 @@ beautifulsoup4==4.11.1
# beewi_smartclim==0.0.10
# homeassistant.components.zha
bellows==0.34.1
bellows==0.34.2
# homeassistant.components.bmw_connected_drive
bimmer_connected==0.10.4
@ -1436,7 +1436,7 @@ pyalmond==0.0.2
pyatag==0.3.5.3
# homeassistant.components.netatmo
pyatmo==7.1.0
pyatmo==7.1.1
# homeassistant.components.atome
pyatome==0.1.1
@ -1499,7 +1499,7 @@ pycsspeechtts==1.0.4
# pycups==1.9.73
# homeassistant.components.daikin
pydaikin==2.7.0
pydaikin==2.7.2
# homeassistant.components.danfoss_air
pydanfossair==0.1.0
@ -1783,7 +1783,7 @@ pyotgw==2.0.3
pyotp==2.7.0
# homeassistant.components.overkiz
pyoverkiz==1.5.3
pyoverkiz==1.5.5
# homeassistant.components.openweathermap
pyowm==3.2.0
@ -2604,16 +2604,16 @@ ziggo-mediabox-xl==1.1.0
zigpy-deconz==0.19.0
# homeassistant.components.zha
zigpy-xbee==0.16.0
zigpy-xbee==0.16.1
# homeassistant.components.zha
zigpy-zigate==0.10.0
zigpy-zigate==0.10.1
# homeassistant.components.zha
zigpy-znp==0.9.0
zigpy-znp==0.9.1
# homeassistant.components.zha
zigpy==0.51.2
zigpy==0.51.3
# homeassistant.components.zoneminder
zm-py==0.5.2

View File

@ -19,7 +19,7 @@ HAP-python==4.5.0
PyFlick==0.0.2
# homeassistant.components.keymitt_ble
PyMicroBot==0.0.6
PyMicroBot==0.0.8
# homeassistant.components.mobile_app
# homeassistant.components.owntracks
@ -251,7 +251,7 @@ aiosyncthing==0.5.1
aiotractive==0.5.4
# homeassistant.components.unifi
aiounifi==37
aiounifi==38
# homeassistant.components.vlc_telnet
aiovlc==0.1.0
@ -328,7 +328,7 @@ base36==0.1.1
beautifulsoup4==4.11.1
# homeassistant.components.zha
bellows==0.34.1
bellows==0.34.2
# homeassistant.components.bmw_connected_drive
bimmer_connected==0.10.4
@ -1024,7 +1024,7 @@ pyalmond==0.0.2
pyatag==0.3.5.3
# homeassistant.components.netatmo
pyatmo==7.1.0
pyatmo==7.1.1
# homeassistant.components.apple_tv
pyatv==0.10.3
@ -1057,7 +1057,7 @@ pycomfoconnect==0.4
pycoolmasternet-async==0.1.2
# homeassistant.components.daikin
pydaikin==2.7.0
pydaikin==2.7.2
# homeassistant.components.deconz
pydeconz==104
@ -1260,7 +1260,7 @@ pyotgw==2.0.3
pyotp==2.7.0
# homeassistant.components.overkiz
pyoverkiz==1.5.3
pyoverkiz==1.5.5
# homeassistant.components.openweathermap
pyowm==3.2.0
@ -1799,16 +1799,16 @@ zha-quirks==0.0.82
zigpy-deconz==0.19.0
# homeassistant.components.zha
zigpy-xbee==0.16.0
zigpy-xbee==0.16.1
# homeassistant.components.zha
zigpy-zigate==0.10.0
zigpy-zigate==0.10.1
# homeassistant.components.zha
zigpy-znp==0.9.0
zigpy-znp==0.9.1
# homeassistant.components.zha
zigpy==0.51.2
zigpy==0.51.3
# homeassistant.components.zwave_js
zwave-js-server-python==0.43.0

View File

@ -720,28 +720,7 @@ async def test_automation_with_bad_condition_action(hass, caplog):
assert "required key not provided" in caplog.text
async def test_automation_with_bad_condition_missing_domain(hass, caplog):
"""Test automation with bad device condition."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"alias": "hello",
"trigger": {"platform": "event", "event_type": "test_event1"},
"condition": {"condition": "device", "device_id": "hello.device"},
"action": {"service": "test.automation", "entity_id": "hello.world"},
}
},
)
assert (
"Invalid config for [automation]: required key not provided @ data['condition'][0]['domain']"
in caplog.text
)
async def test_automation_with_bad_condition_missing_device_id(hass, caplog):
async def test_automation_with_bad_condition(hass, caplog):
"""Test automation with bad device condition."""
assert await async_setup_component(
hass,
@ -756,10 +735,7 @@ async def test_automation_with_bad_condition_missing_device_id(hass, caplog):
},
)
assert (
"Invalid config for [automation]: required key not provided @ data['condition'][0]['device_id']"
in caplog.text
)
assert "required key not provided" in caplog.text
@pytest.fixture
@ -900,25 +876,8 @@ async def test_automation_with_bad_sub_condition(hass, caplog):
assert "required key not provided" in caplog.text
async def test_automation_with_bad_trigger_missing_domain(hass, caplog):
"""Test automation with device trigger this is missing domain."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"alias": "hello",
"trigger": {"platform": "device", "device_id": "hello.device"},
"action": {"service": "test.automation", "entity_id": "hello.world"},
}
},
)
assert "required key not provided @ data['domain']" in caplog.text
async def test_automation_with_bad_trigger_missing_device_id(hass, caplog):
"""Test automation with device trigger that is missing device_id."""
async def test_automation_with_bad_trigger(hass, caplog):
"""Test automation with bad device trigger."""
assert await async_setup_component(
hass,
automation.DOMAIN,
@ -931,7 +890,7 @@ async def test_automation_with_bad_trigger_missing_device_id(hass, caplog):
},
)
assert "required key not provided @ data['device_id']" in caplog.text
assert "required key not provided" in caplog.text
async def test_websocket_device_not_found(hass, hass_ws_client):

View File

@ -32,7 +32,7 @@ def patch_async_setup_entry(return_value=True):
SERVICE_INFO = BluetoothServiceInfoBleak(
name="mibp",
service_uuids=["00001831-0000-1000-8000-00805f9b34fb"],
service_uuids=["0000abcd-0000-1000-8000-00805f9b34fb"],
address="aa:bb:cc:dd:ee:ff",
manufacturer_data={},
service_data={},
@ -41,7 +41,7 @@ SERVICE_INFO = BluetoothServiceInfoBleak(
advertisement=AdvertisementData(
local_name="mibp",
manufacturer_data={},
service_uuids=["00001831-0000-1000-8000-00805f9b34fb"],
service_uuids=["0000abcd-0000-1000-8000-00805f9b34fb"],
),
device=BLEDevice("aa:bb:cc:dd:ee:ff", "mibp"),
time=0,

View File

@ -945,9 +945,9 @@ async def test_discovery_expansion(hass, mqtt_mock_entry_no_yaml_config, caplog)
' "payload_not_available": "not_available"'
" },"
" {"
' "topic":"avail_item2/~",'
' "payload_available": "available",'
' "payload_not_available": "not_available"'
' "t":"avail_item2/~",'
' "pl_avail": "available",'
' "pl_not_avail": "not_available"'
" }"
" ],"
' "dev":{'
@ -999,9 +999,9 @@ async def test_discovery_expansion_2(hass, mqtt_mock_entry_no_yaml_config, caplo
' "stat_t": "test_topic/~",'
' "cmd_t": "~/test_topic",'
' "availability": {'
' "topic":"~/avail_item1",'
' "payload_available": "available",'
' "payload_not_available": "not_available"'
' "t":"~/avail_item1",'
' "pl_avail": "available",'
' "pl_not_avail": "not_available"'
" },"
' "dev":{'
' "ids":["5706DF"],'

View File

@ -128,7 +128,8 @@ async def test_get_triggers_for_invalid_device_id(hass, caplog):
await hass.async_block_till_done()
assert (
"Invalid config for [automation]: invalid trigger configuration" in caplog.text
"Invalid config for [automation]: Device invalid_device_id is not a valid webostv device"
in caplog.text
)