mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
commit
eb3355b05d
@ -24,7 +24,7 @@ from .const import (
|
|||||||
CONF_USER_POOL_ID, DOMAIN, MODE_DEV, MODE_PROD)
|
CONF_USER_POOL_ID, DOMAIN, MODE_DEV, MODE_PROD)
|
||||||
from .prefs import CloudPreferences
|
from .prefs import CloudPreferences
|
||||||
|
|
||||||
REQUIREMENTS = ['hass-nabucasa==0.10']
|
REQUIREMENTS = ['hass-nabucasa==0.11']
|
||||||
DEPENDENCIES = ['http']
|
DEPENDENCIES = ['http']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""Support for Home Assistant Cloud binary sensors."""
|
"""Support for Home Assistant Cloud binary sensors."""
|
||||||
|
import asyncio
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||||
from homeassistant.core import callback
|
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
|
||||||
from .const import DISPATCHER_REMOTE_UPDATE, DOMAIN
|
from .const import DISPATCHER_REMOTE_UPDATE, DOMAIN
|
||||||
@ -8,6 +9,9 @@ from .const import DISPATCHER_REMOTE_UPDATE, DOMAIN
|
|||||||
DEPENDENCIES = ['cloud']
|
DEPENDENCIES = ['cloud']
|
||||||
|
|
||||||
|
|
||||||
|
WAIT_UNTIL_CHANGE = 3
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(
|
async def async_setup_platform(
|
||||||
hass, config, async_add_entities, discovery_info=None):
|
hass, config, async_add_entities, discovery_info=None):
|
||||||
"""Set up the cloud binary sensors."""
|
"""Set up the cloud binary sensors."""
|
||||||
@ -58,10 +62,10 @@ class CloudRemoteBinary(BinarySensorDevice):
|
|||||||
|
|
||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self):
|
||||||
"""Register update dispatcher."""
|
"""Register update dispatcher."""
|
||||||
@callback
|
async def async_state_update(data):
|
||||||
def async_state_update(data):
|
|
||||||
"""Update callback."""
|
"""Update callback."""
|
||||||
self.async_write_ha_state()
|
await asyncio.sleep(WAIT_UNTIL_CHANGE)
|
||||||
|
self.async_schedule_update_ha_state()
|
||||||
|
|
||||||
self._unsub_dispatcher = async_dispatcher_connect(
|
self._unsub_dispatcher = async_dispatcher_connect(
|
||||||
self.hass, DISPATCHER_REMOTE_UPDATE, async_state_update)
|
self.hass, DISPATCHER_REMOTE_UPDATE, async_state_update)
|
||||||
|
@ -145,8 +145,7 @@ async def async_setup(hass, config):
|
|||||||
hass.data[DOMAIN] = hassio = HassIO(hass.loop, websession, host)
|
hass.data[DOMAIN] = hassio = HassIO(hass.loop, websession, host)
|
||||||
|
|
||||||
if not await hassio.is_connected():
|
if not await hassio.is_connected():
|
||||||
_LOGGER.error("Not connected with Hass.io")
|
_LOGGER.warning("Not connected with Hass.io / system to busy!")
|
||||||
return False
|
|
||||||
|
|
||||||
store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY)
|
store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY)
|
||||||
data = await store.async_load()
|
data = await store.async_load()
|
||||||
|
@ -62,7 +62,7 @@ class HassIO:
|
|||||||
|
|
||||||
This method return a coroutine.
|
This method return a coroutine.
|
||||||
"""
|
"""
|
||||||
return self.send_command("/supervisor/ping", method="get")
|
return self.send_command("/supervisor/ping", method="get", timeout=15)
|
||||||
|
|
||||||
@_api_data
|
@_api_data
|
||||||
def get_homeassistant_info(self):
|
def get_homeassistant_info(self):
|
||||||
|
@ -15,7 +15,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_send
|
|||||||
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['pyotgw==0.4b1']
|
REQUIREMENTS = ['pyotgw==0.4b2']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -115,14 +115,15 @@ async def async_setup(hass, config):
|
|||||||
DATA_GW_VARS: pyotgw.vars,
|
DATA_GW_VARS: pyotgw.vars,
|
||||||
DATA_LATEST_STATUS: {}
|
DATA_LATEST_STATUS: {}
|
||||||
}
|
}
|
||||||
hass.async_create_task(connect_and_subscribe(
|
|
||||||
hass, conf[CONF_DEVICE], gateway))
|
|
||||||
hass.async_create_task(register_services(hass, gateway))
|
hass.async_create_task(register_services(hass, gateway))
|
||||||
hass.async_create_task(async_load_platform(
|
hass.async_create_task(async_load_platform(
|
||||||
hass, 'climate', DOMAIN, conf.get(CONF_CLIMATE), config))
|
hass, 'climate', DOMAIN, conf.get(CONF_CLIMATE), config))
|
||||||
if monitored_vars:
|
if monitored_vars:
|
||||||
hass.async_create_task(setup_monitored_vars(
|
hass.async_create_task(setup_monitored_vars(
|
||||||
hass, config, monitored_vars))
|
hass, config, monitored_vars))
|
||||||
|
# Schedule directly on the loop to avoid blocking HA startup.
|
||||||
|
hass.loop.create_task(
|
||||||
|
connect_and_subscribe(hass, conf[CONF_DEVICE], gateway))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ class OpenThermGateway(ClimateDevice):
|
|||||||
self.floor_temp = config.get(CONF_FLOOR_TEMP)
|
self.floor_temp = config.get(CONF_FLOOR_TEMP)
|
||||||
self.temp_precision = config.get(CONF_PRECISION)
|
self.temp_precision = config.get(CONF_PRECISION)
|
||||||
self._current_operation = STATE_IDLE
|
self._current_operation = STATE_IDLE
|
||||||
self._current_temperature = 0.0
|
self._current_temperature = None
|
||||||
self._target_temperature = 0.0
|
self._target_temperature = None
|
||||||
self._away_mode_a = None
|
self._away_mode_a = None
|
||||||
self._away_mode_b = None
|
self._away_mode_b = None
|
||||||
self._away_state_a = False
|
self._away_state_a = False
|
||||||
@ -124,6 +124,8 @@ class OpenThermGateway(ClimateDevice):
|
|||||||
@property
|
@property
|
||||||
def current_temperature(self):
|
def current_temperature(self):
|
||||||
"""Return the current temperature."""
|
"""Return the current temperature."""
|
||||||
|
if self._current_temperature is None:
|
||||||
|
return
|
||||||
if self.floor_temp is True:
|
if self.floor_temp is True:
|
||||||
if self.temp_precision == PRECISION_HALVES:
|
if self.temp_precision == PRECISION_HALVES:
|
||||||
return int(2 * self._current_temperature) / 2
|
return int(2 * self._current_temperature) / 2
|
||||||
|
@ -79,7 +79,11 @@ class PlayStation4FlowHandler(config_entries.ConfigFlow):
|
|||||||
|
|
||||||
# If entry exists check that devices found aren't configured.
|
# If entry exists check that devices found aren't configured.
|
||||||
if self.hass.config_entries.async_entries(DOMAIN):
|
if self.hass.config_entries.async_entries(DOMAIN):
|
||||||
|
creds = {}
|
||||||
for entry in self.hass.config_entries.async_entries(DOMAIN):
|
for entry in self.hass.config_entries.async_entries(DOMAIN):
|
||||||
|
# Retrieve creds from entry
|
||||||
|
creds['data'] = entry.data[CONF_TOKEN]
|
||||||
|
# Retrieve device data from entry
|
||||||
conf_devices = entry.data['devices']
|
conf_devices = entry.data['devices']
|
||||||
for c_device in conf_devices:
|
for c_device in conf_devices:
|
||||||
if c_device['host'] in device_list:
|
if c_device['host'] in device_list:
|
||||||
@ -88,6 +92,11 @@ class PlayStation4FlowHandler(config_entries.ConfigFlow):
|
|||||||
# If list is empty then all devices are configured.
|
# If list is empty then all devices are configured.
|
||||||
if not device_list:
|
if not device_list:
|
||||||
return self.async_abort(reason='devices_configured')
|
return self.async_abort(reason='devices_configured')
|
||||||
|
# Add existing creds for linking. Should be only 1.
|
||||||
|
if not creds:
|
||||||
|
# Abort if creds is missing.
|
||||||
|
return self.async_abort(reason='credential_error')
|
||||||
|
self.creds = creds['data']
|
||||||
|
|
||||||
# Login to PS4 with user data.
|
# Login to PS4 with user data.
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
|
@ -44,6 +44,11 @@ def request_stream(hass, stream_source, *, fmt='hls',
|
|||||||
if options is None:
|
if options is None:
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
|
# For RTSP streams, prefer TCP
|
||||||
|
if isinstance(stream_source, str) \
|
||||||
|
and stream_source[:7] == 'rtsp://' and not options:
|
||||||
|
options['rtsp_flags'] = 'prefer_tcp'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
streams = hass.data[DOMAIN][ATTR_STREAMS]
|
streams = hass.data[DOMAIN][ATTR_STREAMS]
|
||||||
stream = streams.get(stream_source)
|
stream = streams.get(stream_source)
|
||||||
|
@ -128,6 +128,7 @@ class StreamOutput:
|
|||||||
@callback
|
@callback
|
||||||
def _timeout(self, _now=None):
|
def _timeout(self, _now=None):
|
||||||
"""Handle stream timeout."""
|
"""Handle stream timeout."""
|
||||||
|
self._unsub = None
|
||||||
if self._stream.keepalive:
|
if self._stream.keepalive:
|
||||||
self.idle = True
|
self.idle = True
|
||||||
self._stream.check_idle()
|
self._stream.check_idle()
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"""Constants used by Home Assistant components."""
|
"""Constants used by Home Assistant components."""
|
||||||
MAJOR_VERSION = 0
|
MAJOR_VERSION = 0
|
||||||
MINOR_VERSION = 90
|
MINOR_VERSION = 90
|
||||||
PATCH_VERSION = '1'
|
PATCH_VERSION = '2'
|
||||||
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
|
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
|
||||||
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
|
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
|
||||||
REQUIRED_PYTHON_VER = (3, 5, 3)
|
REQUIRED_PYTHON_VER = (3, 5, 3)
|
||||||
|
@ -524,7 +524,7 @@ habitipy==0.2.0
|
|||||||
hangups==0.4.6
|
hangups==0.4.6
|
||||||
|
|
||||||
# homeassistant.components.cloud
|
# homeassistant.components.cloud
|
||||||
hass-nabucasa==0.10
|
hass-nabucasa==0.11
|
||||||
|
|
||||||
# homeassistant.components.mqtt.server
|
# homeassistant.components.mqtt.server
|
||||||
hbmqtt==0.9.4
|
hbmqtt==0.9.4
|
||||||
@ -1205,7 +1205,7 @@ pyoppleio==1.0.5
|
|||||||
pyota==2.0.5
|
pyota==2.0.5
|
||||||
|
|
||||||
# homeassistant.components.opentherm_gw
|
# homeassistant.components.opentherm_gw
|
||||||
pyotgw==0.4b1
|
pyotgw==0.4b2
|
||||||
|
|
||||||
# homeassistant.auth.mfa_modules.notify
|
# homeassistant.auth.mfa_modules.notify
|
||||||
# homeassistant.auth.mfa_modules.totp
|
# homeassistant.auth.mfa_modules.totp
|
||||||
|
@ -114,7 +114,7 @@ ha-ffmpeg==1.11
|
|||||||
hangups==0.4.6
|
hangups==0.4.6
|
||||||
|
|
||||||
# homeassistant.components.cloud
|
# homeassistant.components.cloud
|
||||||
hass-nabucasa==0.10
|
hass-nabucasa==0.11
|
||||||
|
|
||||||
# homeassistant.components.mqtt.server
|
# homeassistant.components.mqtt.server
|
||||||
hbmqtt==0.9.4
|
hbmqtt==0.9.4
|
||||||
|
@ -7,6 +7,9 @@ from homeassistant.components.cloud.const import DISPATCHER_REMOTE_UPDATE
|
|||||||
|
|
||||||
async def test_remote_connection_sensor(hass):
|
async def test_remote_connection_sensor(hass):
|
||||||
"""Test the remote connection sensor."""
|
"""Test the remote connection sensor."""
|
||||||
|
from homeassistant.components.cloud import binary_sensor as bin_sensor
|
||||||
|
bin_sensor.WAIT_UNTIL_CHANGE = 0
|
||||||
|
|
||||||
assert await async_setup_component(hass, 'cloud', {'cloud': {}})
|
assert await async_setup_component(hass, 'cloud', {'cloud': {}})
|
||||||
cloud = hass.data['cloud'] = Mock()
|
cloud = hass.data['cloud'] = Mock()
|
||||||
cloud.remote.certificate = None
|
cloud.remote.certificate = None
|
||||||
|
@ -196,15 +196,16 @@ def test_fail_setup_without_environ_var(hass):
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def test_fail_setup_cannot_connect(hass):
|
def test_fail_setup_cannot_connect(hass, caplog):
|
||||||
"""Fail setup if cannot connect."""
|
"""Fail setup if cannot connect."""
|
||||||
with patch.dict(os.environ, MOCK_ENVIRON), \
|
with patch.dict(os.environ, MOCK_ENVIRON), \
|
||||||
patch('homeassistant.components.hassio.HassIO.is_connected',
|
patch('homeassistant.components.hassio.HassIO.is_connected',
|
||||||
Mock(return_value=mock_coro(None))):
|
Mock(return_value=mock_coro(None))):
|
||||||
result = yield from async_setup_component(hass, 'hassio', {})
|
result = yield from async_setup_component(hass, 'hassio', {})
|
||||||
assert not result
|
assert result
|
||||||
|
|
||||||
assert not hass.components.hassio.is_hassio()
|
assert hass.components.hassio.is_hassio()
|
||||||
|
assert "Not connected with Hass.io / system to busy!" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
|
Loading…
x
Reference in New Issue
Block a user