Merge pull request #40243 from home-assistant/rc

This commit is contained in:
Paulus Schoutsen 2020-09-18 16:51:17 +02:00 committed by GitHub
commit bf741c1b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 83 additions and 20 deletions

View File

@ -29,8 +29,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
def get_service(hass, config, discovery_info=None):
"""Get the Apprise notification service."""
# Create our object
a_obj = apprise.Apprise()
# Create our Apprise Asset Object
asset = apprise.AppriseAsset(async_mode=False)
# Create our Apprise Instance (reference our asset)
a_obj = apprise.Apprise(asset=asset)
if config.get(CONF_FILE):
# Sourced from a Configuration File

View File

@ -1,12 +1,15 @@
"""Support for fetching data from Broadlink devices."""
from abc import ABC, abstractmethod
from datetime import timedelta
from functools import partial
import logging
import broadlink as blk
from broadlink.exceptions import (
AuthorizationError,
BroadlinkException,
CommandNotSupportedError,
DeviceOfflineError,
StorageError,
)
@ -18,6 +21,9 @@ _LOGGER = logging.getLogger(__name__)
def get_update_manager(device):
"""Return an update manager for a given Broadlink device."""
if device.api.model.startswith("RM mini"):
return BroadlinkRMMini3UpdateManager(device)
update_managers = {
"A1": BroadlinkA1UpdateManager,
"MP1": BroadlinkMP1UpdateManager,
@ -95,6 +101,22 @@ class BroadlinkMP1UpdateManager(BroadlinkUpdateManager):
return await self.device.async_request(self.device.api.check_power)
class BroadlinkRMMini3UpdateManager(BroadlinkUpdateManager):
"""Manages updates for Broadlink RM mini 3 devices."""
async def async_fetch_data(self):
"""Fetch data from the device."""
hello = partial(
blk.discover,
discover_ip_address=self.device.api.host[0],
timeout=self.device.api.timeout,
)
devices = await self.device.hass.async_add_executor_job(hello)
if not devices:
raise DeviceOfflineError("The device is offline")
return {}
class BroadlinkRMUpdateManager(BroadlinkUpdateManager):
"""Manages updates for Broadlink RM2 and RM4 devices."""

View File

@ -3,6 +3,6 @@
"name": "CoolMasterNet",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/coolmaster",
"requirements": ["pycoolmasternet-async==0.1.1"],
"requirements": ["pycoolmasternet-async==0.1.2"],
"codeowners": ["@OnFreund"]
}

View File

@ -714,7 +714,7 @@ class KodiEntity(MediaPlayerEntity):
_LOGGER.debug("Run API method %s, kwargs=%s", method, kwargs)
result_ok = False
try:
result = self._kodi.call_method(method, **kwargs)
result = await self._kodi.call_method(method, **kwargs)
result_ok = True
except jsonrpc_base.jsonrpc.ProtocolError as exc:
result = exc.args[2]["error"]

View File

@ -100,7 +100,6 @@ def setup(hass, config):
_LOGGER.error("Nextcloud setup failed - Check configuration")
hass.data[DOMAIN] = get_data_points(ncm.data)
hass.data[DOMAIN]["instance"] = conf[CONF_URL]
def nextcloud_update(event_time):
"""Update data from nextcloud api."""
@ -111,6 +110,7 @@ def setup(hass, config):
return False
hass.data[DOMAIN] = get_data_points(ncm.data)
hass.data[DOMAIN]["instance"] = conf[CONF_URL]
# Update sensors on time interval
track_time_interval(hass, nextcloud_update, conf[CONF_SCAN_INTERVAL])

View File

@ -4,7 +4,7 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/risco",
"requirements": [
"pyrisco==0.3.0"
"pyrisco==0.3.1"
],
"codeowners": [
"@OnFreund"

View File

@ -2,6 +2,6 @@
"domain": "velux",
"name": "Velux",
"documentation": "https://www.home-assistant.io/integrations/velux",
"requirements": ["pyvlx==0.2.16"],
"requirements": ["pyvlx==0.2.17"],
"codeowners": ["@Julius2342"]
}

View File

@ -94,7 +94,7 @@ async def async_unload_entry(
and entry.data[CONF_DEVICE_CLASS] == DEVICE_CLASS_TV
for entry in hass.config_entries.async_entries(DOMAIN)
):
hass.data[DOMAIN].pop(CONF_APPS)
hass.data[DOMAIN].pop(CONF_APPS, None)
if not hass.data[DOMAIN]:
hass.data.pop(DOMAIN)

View File

@ -1,7 +1,7 @@
"""Constants used by Home Assistant components."""
MAJOR_VERSION = 0
MINOR_VERSION = 115
PATCH_VERSION = "0"
PATCH_VERSION = "1"
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__ = f"{__short_version__}.{PATCH_VERSION}"
REQUIRED_PYTHON_VER = (3, 7, 1)

View File

@ -525,6 +525,11 @@ class _TrackTemplateResultInfo:
self._last_info = self._info.copy()
self._create_listeners()
_LOGGER.debug(
"Template group %s listens for %s",
self._track_templates,
self.listeners,
)
@property
def listeners(self) -> Dict:
@ -683,6 +688,10 @@ class _TrackTemplateResultInfo:
):
continue
_LOGGER.debug(
"Template update %s triggered by event: %s", template.template, event
)
self._info[template] = template.async_render_to_info(
track_template_.variables
)
@ -708,6 +717,11 @@ class _TrackTemplateResultInfo:
if info_changed:
self._update_listeners()
_LOGGER.debug(
"Template group %s listens for %s",
self._track_templates,
self.listeners,
)
self._last_info = self._info.copy()
if not updates:

View File

@ -1277,7 +1277,7 @@ pycocotools==2.0.1
pycomfoconnect==0.3
# homeassistant.components.coolmaster
pycoolmasternet-async==0.1.1
pycoolmasternet-async==0.1.2
# homeassistant.components.avri
pycountry==19.8.18
@ -1595,7 +1595,7 @@ pyrecswitch==1.0.2
pyrepetier==3.0.5
# homeassistant.components.risco
pyrisco==0.3.0
pyrisco==0.3.1
# homeassistant.components.sabnzbd
pysabnzbd==1.1.0
@ -1837,7 +1837,7 @@ pyvesync==1.1.0
pyvizio==0.1.56
# homeassistant.components.velux
pyvlx==0.2.16
pyvlx==0.2.17
# homeassistant.components.volumio
pyvolumio==0.1.2

View File

@ -616,7 +616,7 @@ pybotvac==0.0.17
pychromecast==7.2.1
# homeassistant.components.coolmaster
pycoolmasternet-async==0.1.1
pycoolmasternet-async==0.1.2
# homeassistant.components.avri
pycountry==19.8.18
@ -769,7 +769,7 @@ pyps4-2ndscreen==1.1.1
pyqwikswitch==0.93
# homeassistant.components.risco
pyrisco==0.3.0
pyrisco==0.3.1
# homeassistant.components.acer_projector
# homeassistant.components.zha

View File

@ -85,6 +85,9 @@ class BroadlinkDevice:
with patch(
"homeassistant.components.broadlink.device.blk.gendevice",
return_value=mock_api,
), patch(
"homeassistant.components.broadlink.updater.blk.discover",
return_value=[mock_api],
):
await hass.config_entries.async_setup(mock_entry.entry_id)
await hass.async_block_till_done()

View File

@ -179,7 +179,7 @@ async def test_device_setup_update_authorization_error(hass):
async def test_device_setup_update_authentication_error(hass):
"""Test we handle an authentication error in the update step."""
device = get_device("Living Room")
device = get_device("Garage")
mock_api = device.get_mock_api()
mock_api.check_sensors.side_effect = blke.AuthorizationError()
mock_api.auth.side_effect = (None, blke.AuthenticationError())
@ -207,7 +207,7 @@ async def test_device_setup_update_authentication_error(hass):
async def test_device_setup_update_broadlink_exception(hass):
"""Test we handle a Broadlink exception in the update step."""
device = get_device("Living Room")
device = get_device("Garage")
mock_api = device.get_mock_api()
mock_api.check_sensors.side_effect = blke.BroadlinkException()
mock_entry = device.get_mock_entry()

View File

@ -6,7 +6,7 @@ from homeassistant.components.vizio.const import DOMAIN
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.setup import async_setup_component
from .const import MOCK_USER_VALID_TV_CONFIG, UNIQUE_ID
from .const import MOCK_SPEAKER_CONFIG, MOCK_USER_VALID_TV_CONFIG, UNIQUE_ID
from tests.common import MockConfigEntry
@ -24,12 +24,12 @@ async def test_setup_component(
assert len(hass.states.async_entity_ids(MP_DOMAIN)) == 1
async def test_load_and_unload(
async def test_tv_load_and_unload(
hass: HomeAssistantType,
vizio_connect: pytest.fixture,
vizio_update: pytest.fixture,
) -> None:
"""Test loading and unloading entry."""
"""Test loading and unloading TV entry."""
config_entry = MockConfigEntry(
domain=DOMAIN, data=MOCK_USER_VALID_TV_CONFIG, unique_id=UNIQUE_ID
)
@ -43,3 +43,24 @@ async def test_load_and_unload(
await hass.async_block_till_done()
assert len(hass.states.async_entity_ids(MP_DOMAIN)) == 0
assert DOMAIN not in hass.data
async def test_speaker_load_and_unload(
hass: HomeAssistantType,
vizio_connect: pytest.fixture,
vizio_update: pytest.fixture,
) -> None:
"""Test loading and unloading speaker entry."""
config_entry = MockConfigEntry(
domain=DOMAIN, data=MOCK_SPEAKER_CONFIG, unique_id=UNIQUE_ID
)
config_entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
assert len(hass.states.async_entity_ids(MP_DOMAIN)) == 1
assert DOMAIN in hass.data
assert await config_entry.async_unload(hass)
await hass.async_block_till_done()
assert len(hass.states.async_entity_ids(MP_DOMAIN)) == 0
assert DOMAIN not in hass.data

View File

@ -541,7 +541,7 @@ async def test_track_template_error(hass, caplog):
hass.states.async_set("switch.not_exist", "off")
await hass.async_block_till_done()
assert "lunch" not in caplog.text
assert "no filter named 'lunch'" not in caplog.text
assert "TemplateAssertionError" not in caplog.text