Bump Home Assistant Cloud 0.12 (#23159)

* Home Assistant Cloud 0.12

* Fix raising error

* Fix requirements

* Fix lint
This commit is contained in:
Pascal Vizeli 2019-04-17 15:57:26 +02:00 committed by Paulus Schoutsen
parent 0b7e62f737
commit 073f947ca4
7 changed files with 26 additions and 7 deletions

View File

@ -189,7 +189,12 @@ async def async_setup(hass, config):
hass.helpers.service.async_register_admin_service(
DOMAIN, SERVICE_REMOTE_DISCONNECT, _service_handler)
async def _on_connect():
"""Discover RemoteUI binary sensor."""
hass.async_create_task(hass.helpers.discovery.async_load_platform(
'binary_sensor', DOMAIN, {}, config))
cloud.iot.register_on_connect(_on_connect)
await http_api.async_setup(hass)
hass.async_create_task(hass.helpers.discovery.async_load_platform(
'binary_sensor', DOMAIN, {}, config))
return True

View File

@ -150,8 +150,11 @@ class CloudClient(Interface):
)
# Fix AgentUserId
cloud = self._hass.data[DOMAIN]
answer['payload']['agentUserId'] = cloud.claims['cognito:username']
try:
cloud = self._hass.data[DOMAIN]
answer['payload']['agentUserId'] = cloud.claims['cognito:username']
except (TypeError, KeyError):
return ga.turned_off_response(payload)
return answer

View File

@ -105,6 +105,8 @@ async def async_setup(hass):
(400, "User does not exist."),
auth.UserNotConfirmed:
(400, 'Email not confirmed.'),
auth.UserExists:
(400, 'An account with the given email already exists.'),
auth.Unauthenticated:
(401, 'Authentication failed.'),
auth.PasswordChangeRequired:

View File

@ -3,7 +3,7 @@
"name": "Cloud",
"documentation": "https://www.home-assistant.io/components/cloud",
"requirements": [
"hass-nabucasa==0.11"
"hass-nabucasa==0.12"
],
"dependencies": [
"http",

View File

@ -518,7 +518,7 @@ habitipy==0.2.0
hangups==0.4.6
# homeassistant.components.cloud
hass-nabucasa==0.11
hass-nabucasa==0.12
# homeassistant.components.mqtt
hbmqtt==0.9.4

View File

@ -124,7 +124,7 @@ ha-ffmpeg==2.0
hangups==0.4.6
# homeassistant.components.cloud
hass-nabucasa==0.11
hass-nabucasa==0.12
# homeassistant.components.mqtt
hbmqtt==0.9.4

View File

@ -11,6 +11,15 @@ async def test_remote_connection_sensor(hass):
bin_sensor.WAIT_UNTIL_CHANGE = 0
assert await async_setup_component(hass, 'cloud', {'cloud': {}})
await hass.async_block_till_done()
assert hass.states.get('binary_sensor.remote_ui') is None
# Fake connection/discovery
org_cloud = hass.data['cloud']
await org_cloud.iot._on_connect[-1]()
# Mock test env
cloud = hass.data['cloud'] = Mock()
cloud.remote.certificate = None
await hass.async_block_till_done()