Git Product home page Git Product logo

hass-nabucasa's People

Contributors

balloob avatar bdraco avatar cogneato avatar dependabot-preview[bot] avatar dependabot[bot] avatar emontnemery avatar fabaff avatar frenck avatar gadgetchnnel avatar iantrich avatar imicknl avatar karwosts avatar klaasnicolaas avatar ludeeus avatar martinhjelmare avatar pvizeli avatar repsionu avatar scop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hass-nabucasa's Issues

Quitting hass while ACME is refreshing cert raises error

2020-02-16 23:13:07 INFO (MainThread) [homeassistant.core] Timer:starting
2020-02-16 23:13:09 INFO (SyncWorker_21) [hass_nabucasa.acme] Load exists ACME registration
2020-02-16 23:13:10 INFO (SyncWorker_37) [hass_nabucasa.acme] Initialize challenge for a new ACME certificate
2020-02-16 23:13:12 INFO (MainThread) [hass_nabucasa.acme] Wait 60sec for publishing DNS to ACME provider
^C2020-02-16 23:13:23 ERROR (MainThread) [homeassistant.core] Error doing job: unhandled exception during asyncio.run() shutdown
Traceback (most recent call last):
  File "/Users/paulus/dev/nabu/hass-nabucasa/hass_nabucasa/acme.py", line 367, in issue_certificate
    await asyncio.sleep(60)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/tasks.py", line 595, in sleep
    return await future
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/paulus/dev/nabu/hass-nabucasa/hass_nabucasa/remote.py", line 153, in load_backend
    await self._acme.issue_certificate()
  File "/Users/paulus/dev/nabu/hass-nabucasa/hass_nabucasa/acme.py", line 372, in issue_certificate
    self.cloud, challenge.validation
  File "/Users/paulus/dev/nabu/hass-nabucasa/hass_nabucasa/cloud_api.py", line 16, in check_token
    await cloud.auth.async_check_token()
  File "/Users/paulus/dev/nabu/hass-nabucasa/hass_nabucasa/auth.py", line 145, in async_check_token
    await self.cloud.run_executor(self._check_token)
  File "/Users/paulus/dev/nabu/hass-nabucasa/hass_nabucasa/__init__.py", line 166, in run_executor
    return self.client.loop.run_in_executor(None, callback, *args)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 747, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py", line 163, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown

Handle error registering instance

Noticed this in my logs. 0.114.

It's an aiohttp.ClientError so we should handle it and not log it.

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 964, in _create_direct_connection
    hosts = await asyncio.shield(self._resolve_host(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 829, in _resolve_host
    addrs = await \
  File "/usr/local/lib/python3.8/site-packages/aiohttp/resolver.py", line 29, in resolve
    infos = await self._loop.getaddrinfo(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 825, in getaddrinfo
    return await self.run_in_executor(
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.8/socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/hass_nabucasa/remote.py", line 129, in load_backend
    resp = await cloud_api.async_remote_register(self.cloud)
  File "/usr/local/lib/python3.8/site-packages/hass_nabucasa/cloud_api.py", line 17, in check_token
    return await func(cloud, *args)
  File "/usr/local/lib/python3.8/site-packages/hass_nabucasa/cloud_api.py", line 28, in log_response
    resp = await func(*args)
  File "/usr/local/lib/python3.8/site-packages/hass_nabucasa/cloud_api.py", line 50, in async_remote_register
    return await cloud.websession.post(url, headers={AUTHORIZATION: cloud.id_token})
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 480, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 523, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 858, in _create_connection
    _, proto = await self._create_direct_connection(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 971, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host remote-sni-api.nabucasa.com:443 ssl:default [Try again]

TTS language availability criteria

On what criteria are the languages selected for cloud_say service?
Can we do something for more languages added (like et-EE) in our case?
Best, JR

Race condition snitun

Quiting HA setup while starting up.

Traceback (most recent call last):
  File "/Users/paulus/dev/hass/home-assistant/lib/python3.7/site-packages/hass_nabucasa/remote.py", line 255, in connect
    await self._snitun.connect(
AttributeError: 'NoneType' object has no attribute 'connect'
Traceback (most recent call last):
  File "/Users/paulus/dev/hass/home-assistant/lib/python3.7/site-packages/hass_nabucasa/remote.py", line 292, in _reconnect_snitun
    if self._snitun.is_connected:
AttributeError: 'NoneType' object has no attribute 'is_connected'

Feature: X-Forwarder-For like behavior for remote

Currently when authentication failures occur with homeassistant, it provides an IP address of 127.0.0.1, it would be great if the remote ip connected via the snitun would be used when recording the authentication.

Handle socket error gracefully

From home-assistant/core#29217:

2019-11-29 00:58:56 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 830, in _resolve_host
    self._resolver.resolve(host, port, family=self._family)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/resolver.py", line 30, in resolve
    host, port, type=socket.SOCK_STREAM, family=family)
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 784, in getaddrinfo
    None, getaddr_func, host, port, family, type, proto, flags)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again
2019-11-29 00:58:57 WARNING (MainThread) [hass_nabucasa.iot] Unable to connect: Cannot connect to host cloud.nabucasa.com:443 ssl:None [Try again]

This should not print a stacktrace. Instead a warning would be enough.

binary_sensor.remote_ui not available on 105.x

starting after updating to 105 hassio, I noticed the binary_sensor.remote_ui being unavailable all the time, never getting a state.

Schermafbeelding 2020-02-09 om 23 17 14

this is in the log:

2020-02-09 18:38:10 ERROR (MainThread) [hass_nabucasa.remote] Can't update remote details from Home Assistant cloud

I am seen as an active user, and have this in the cloud connection:

Schermafbeelding 2020-02-09 om 23 20 07

anything to go on? please have a look, thanks!

Vendorize warrant

Warrant has been unmaintained for over 2 years.

  • It relies in python-jose-pycryptodome, an unmaintained fork. python-jose has been updated to support various backends now, including pycryptodome.
  • The setup of warrant no longer runs under modern versions of pip

I don't want to be responsible for maintaining a public fork and deal with PRs. I suggest we vendorize it.

Better error handling / webhooks

Wed Aug 21 2019 17:37:10 GMT+0200 (Mitteleuropäische Sommerzeit)
Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 37, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 69, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 228, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 124, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 162, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 47, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 90, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 96, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 139, in _async_handle_step
    result = await getattr(flow, method)(user_input)  # type: Dict
  File "/usr/src/homeassistant/homeassistant/components/owntracks/config_flow.py", line 34, in async_step_user
    webhook_id, webhook_url, cloudhook = await self._get_webhook_id()
  File "/usr/src/homeassistant/homeassistant/components/owntracks/config_flow.py", line 83, in _get_webhook_id
    webhook_id
  File "/usr/src/homeassistant/homeassistant/components/cloud/__init__.py", line 131, in async_create_cloudhook
    hook = await hass.data[DOMAIN].cloudhooks.async_create(webhook_id, True)
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/cloudhooks.py", line 45, in async_create
    cloudhook_id = data["cloudhook_id"]
KeyError: 'cloudhook_id'

[hass_nabucasa.iot] Unexpected error: causes HA loading to hang

I've opened this issue on home-assistant/core, but I think it might be caused by hass_nabucasa, so I'm opening here as well.

Problem

After restarting Home Assistant, it hangs on "Home Assistant is starting, not everything will be available until it is finished." permanently. The Nabu Casa Remote UI is unavailable, and the "Cloud" menu option in the Configuration menu is not visible (i.e. http://homeassistant.local:8123/config/cloud/ does not load).

With some debugging, I found that I can bypass the issue by removing cloud: from my configuration.yaml. Home Assistant then starts normally and everything works (without remote UI access, obviously), but adding cloud: back causes this issue once again.

This issue started happening suddenly on Oct. 10th, with no known changes between when it was working and when it started failing.

There are others having this same problem on the community forum. Link to that commentary here.

Environment

Running 0.116.2 on HassOS 4.13 in VirtualBox on a Mac Mini. Also had the issue on 0.115 before I upgraded hoping it might fix the issue.

Logs

The error I'm seeing in the Core logs is:

2020-10-10 17:29:54 ERROR (MainThread) [hass_nabucasa.iot] Unexpected error
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/hass_nabucasa/iot_base.py", line 108, in connect
    await self._handle_connection()
  File "/usr/local/lib/python3.8/site-packages/hass_nabucasa/iot_base.py", line 147, in _handle_connection
    await self.cloud.auth.async_check_token()
  File "/usr/local/lib/python3.8/site-packages/hass_nabucasa/auth.py", line 172, in async_check_token
    await self._async_renew_access_token()
  File "/usr/local/lib/python3.8/site-packages/hass_nabucasa/auth.py", line 199, in _async_renew_access_token
    await self.cloud.run_executor(cognito.renew_access_token)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.8/site-packages/pycognito/__init__.py", line 617, in renew_access_token
    refresh_response = self.client.initiate_auth(
  File "/usr/local/lib/python3.8/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python3.8/site-packages/botocore/client.py", line 633, in _make_api_call
    request_dict = self._convert_to_request_dict(
  File "/usr/local/lib/python3.8/site-packages/botocore/client.py", line 681, in _convert_to_request_dict
    request_dict = self._serializer.serialize_to_request(
  File "/usr/local/lib/python3.8/site-packages/botocore/validate.py", line 297, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter AuthParameters.REFRESH_TOKEN, value: None, type: <class 'NoneType'>, valid types: <class 'str'>
2020-10-10 17:30:34 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: cloud

Email field is capital sensitive for login

I tried to login a few times but it kept on saying that my password was wrong. Changed the password twice but kept on getting the same message.

On mobile, somehow the browser automatically capitalises the first letter of my mail. Apparently the field cannot handle this.

Small other detail, the site mentions username not found instead of email not found.

Lost subscription after loggin in to Hassio-cloud with a second instance

Hey guys, Im really enjoying Hassio.. Thank-you so much for all the work you have put in to this project..I'm spreading the word here in South Africa!

Hassio 0.97.2, R Pi 3B+.

Tried: Reboot, Nabu Casa account login and check details of sub.

So I have a paid sub for Nabu Casa, been working great with Ariela etc.

Today I created a second hardware instance of my R pi based Hassio setup as I want to develop with two instances to speed things up a bit (I have two R Pis running HASSIO).

The newly setup R Pi had a copy of the SD card image of the main R pi, so the same Hassio-cloud settings etc which caused me to be connecting two instances of Hassio-cloud to Nabu Casa.

The Hassio-Cloud disconnected on my main Hasio instance and is not connected by shows no subscription.

I have disabled the Nabu Casa on my new R pi to avoid this dual-instance conflict however the old instance is now down with no subscription.

What did I do to destroy my sub? can I recover it?

Many Thanks

Patrick

Login on a fresh setup

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/cloud/alexa_config.py", line 274, in _handle_entity_registry_updated
    await self._sync_helper(to_update, to_remove)
  File "/usr/src/homeassistant/homeassistant/components/cloud/alexa_config.py", line 228, in _sync_helper
    await self.async_get_access_token()
  File "/usr/src/homeassistant/homeassistant/components/cloud/alexa_config.py", line 103, in async_get_access_token
    resp = await cloud_api.async_alexa_access_token(self._cloud)
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/cloud_api.py", line 17, in check_token
    return await func(cloud, *args)
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/cloud_api.py", line 89, in async_alexa_access_token
    cloud.alexa_access_token_url, headers={AUTHORIZATION: cloud.id_token}
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 371, in _request
    url = URL(str_or_url)
  File "/usr/local/lib/python3.7/site-packages/yarl/__init__.py", line 151, in __new__
    raise TypeError("Constructor parameter should be str")
TypeError: Constructor parameter should be str

Add Google Assistant support for fan speed control

In my current setup I've linked a couple of Dyson fans in Home Assistant to Google Home in abscence of an official Dyson integration to Google.

The current HA/NC support does allow turning on and off the fans and they are recognised as fans in the Google Home app, however the fan speed may not be set.

Please could we get fan speed control through the Google Assistant, looking t the SDK it appears discrete values and percentages are supported: https://developers.google.com/assistant/smarthome/traits/fanspeed

Errors querying state upon startup

When restarting HA, the following errors appear,

2020-10-13 10:44:13 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/report_state.py", line 48, in async_entity_state_listener
    if entity_data == old_entity.query_serialize():
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/helpers.py", line 480, in query_serialize
    deep_update(attrs, trt.query_attributes())
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/trait.py", line 1570, in query_attributes
    raise SmartHomeError(
homeassistant.components.google_assistant.error.SmartHomeError: Querying state is not supported
2020-10-13 10:44:13 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/report_state.py", line 48, in
async_entity_state_listener
    if entity_data == old_entity.query_serialize():
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/helpers.py", line 480, in query_serialize
    deep_update(attrs, trt.query_attributes())
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/trait.py", line 1570, in query_attributes
    raise SmartHomeError(
homeassistant.components.google_assistant.error.SmartHomeError: Querying state is not supported

If i disable Enable State Reporting on the google integration the error do not appear
HA is still working as it should, just thought i would log issue in case anything is a miss

Many users seeing "Quota exceeded for homegraph.googleapis.com" in HA log

A number of NabuCasa users are seeing various versions of the following in their HA logs:

2020-12-19 16:17:22 WARNING (MainThread) [homeassistant.components.cloud.google_config] Error reporting state - 5: Requested entity was not found.
2020-12-19 16:18:37 WARNING (MainThread) [homeassistant.components.cloud.google_config] Error reporting state - 5: Requested entity was not found.
2020-12-19 16:24:37 WARNING (MainThread) [homeassistant.components.cloud.google_config] Error reporting state - 5: Requested entity was not found.
2020-12-19 16:25:58 WARNING (MainThread) [homeassistant.components.cloud.google_config] Error reporting state - 8: Quota exceeded for quota metric 'Quota units' and limit 'Quota units per minute' of service 'homegraph.googleapis.com' for consumer 'project_number:6270xxSNIPxxx'.
2020-12-19 16:26:02 WARNING (MainThread) [homeassistant.components.cloud.google_config] Error reporting state - 8: Quota exceeded for quota metric 'Quota units' and limit 'Quota units per minute' of service 'homegraph.googleapis.com' for consumer 'project_number:6270xxSNIPxxxx'.
2020-12-19 16:26:06 WARNING (MainThread) [homeassistant.components.cloud.google_config] Error reporting state - 8: Quota exceeded for quota metric 'Quota units' and limit 'Quota units per minute' of service 'homegraph.googleapis.com' for consumer 'project_number:6270xxSNIPxxxx'.
2020-12-19 16:27:43 WARNING (MainThread) [homeassistant.components.cloud.google_config] Error reporting state - 5: Requested entity was not found.
2020-12-19 16:28:37 WARNING (MainThread) [homeassistant.components.cloud.google_config] Error reporting state - 5: Requested entity was not found.

It has nothing to do with the 2020.12 recent release... I've been seeing this for more than a week with 0.118 as well. If I need to report this over on core against the cloud integration, just let me know.

https://community.home-assistant.io/t/homegraph-error-quota-exceeded/256856/1
https://community.home-assistant.io/t/quota-exceeded-for-quota-metric-quota-units-and-limit-quota-units-per-minute-of-service-homegraph-googleapis-com-for-consumer-project-number-627021166709/253126

Catch username exists exception during registration

We should not map this to an unknown error.

2019-03-11 23:32:26 ERROR (MainThread) [homeassistant.components.cloud.http_api] Unexpected error processing request for /api/cloud/register
Traceback (most recent call last):
  File "/Users/paulus/dev/hass/home-assistant/lib/python3.7/site-packages/hass_nabucasa/auth.py", line 95, in register
    cognito.register(email, password)
  File "/Users/paulus/dev/hass/home-assistant/lib/python3.7/site-packages/warrant/__init__.py", line 311, in register
    response = self.client.sign_up(**params)
  File "/Users/paulus/dev/hass/home-assistant/lib/python3.7/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/paulus/dev/hass/home-assistant/lib/python3.7/site-packages/botocore/client.py", line 661, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.UsernameExistsException: An error occurred (UsernameExistsException) when calling the SignUp operation: An account with the given email already exists.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/paulus/dev/hass/home-assistant/homeassistant/components/cloud/http_api.py", line 118, in error_handler
    result = await handler(view, request, *args, **kwargs)
  File "/Users/paulus/dev/hass/home-assistant/homeassistant/components/http/data_validator.py", line 46, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/Users/paulus/dev/hass/home-assistant/homeassistant/components/cloud/http_api.py", line 220, in post
    cloud.auth.register, data['email'], data['password'])
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/paulus/dev/hass/home-assistant/lib/python3.7/site-packages/hass_nabucasa/auth.py", line 98, in register
    raise _map_aws_exception(err)
hass_nabucasa.auth.UnknownError: An account with the given email already exists.

The UI is able to give the right error, but with the wrong prefix:

image

Faster start can break remote connection

With the latest version (it's planned for 109), the remote doesn't start up correctly.

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/remote.py", line 183, in _finish_load_backend
    snitun_port=443,
  File "/usr/local/lib/python3.7/site-packages/snitun/utils/aiohttp_client.py", line 36, in __init__
    self._site = SockSite(runner, self._socket, ssl_context=context)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_runner.py", line 168, in __init__
    ssl_context=ssl_context, backlog=backlog)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_runner.py", line 38, in __init__
    if runner.server is None:
AttributeError: 'NoneType' object has no attribute 'server'

Support for Yandex Smart Home

What's needed to implement an integration with Yandex Smart Home, if the related component will be merged into Home Assistant? It will be nice to see an integration with Yandex Smart Home in Nabu Casa, because the only smart speaker that supports Russian is Yandex.Station. It will allow to control the Home Assistant via smart speaker in Russian language.

Existing custom component: https://github.com/dmitry-k/yandex_smart_home
API: https://yandex.ru/dev/dialogs/alice/doc/smart-home/reference/resources.html?lang=en

Certificate expiration date is not in UTC.

019-03-15 01:00:00 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/remote.py", line 301, in _certificate_handler
    if self._acme.expire_date > utils.utcnow() + timedelta(days=14):
TypeError: can't compare offset-naive and offset-aware datetimes

pinned version mismatch "aiohttp~=3.6.1"

Hi,

hass-nabucasa-0.37.0 says aiohttp~=3.6.1(setup.py)

home-assistant-0.115.0 says:
hass-nabucasa==0.37.0 (requirements_all.txt)
and
aiohttp==3.6.2 (requirements.txt)

Generating remote UI url can fail

Reported by @arsaboo on #cloud on Discord

Log Details (ERROR)
Wed Apr 10 2019 12:32:25 GMT-0400 (Eastern Daylight Time)
Error processing webhook 8bb03cbe13224eec33292c4e7f86f4XYZ37a50e2855d3
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/webhook/__init__.py", line 85, in async_handle_webhook
    response = await webhook['handler'](hass, webhook_id, request)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/mobile_app/webhook.py", line 311, in handle_webhook
    resp[CONF_REMOTE_UI_URL] = async_remote_ui_url(hass)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/cloud/__init__.py", line 128, in async_remote_ui_url
    return "https://" + hass.data[DOMAIN].remote.instance_domain
TypeError: must be str, not NoneType

I suspect it's because it's at startup and it's not loaded yet?

Ikea blind won't work with open or close command with google home.

Not sure when this issue starts but this is whats happening used to work ok.

  1. if i control the ikea blind via HA UI up or down it works fine.

  2. if i ask google to open or close (linked through nabu casa) it will start moving then stop after about 10cm this happens every time.

  3. if i unlink the blind from google and relink it works for first go then back to the 10cm and stop.

  4. if i ask say open to 10% and its closed for example it will open or close normally issue only seems to occur when opening or closing commands used.

this comes up sometimes with a different number everytime i ask google to open or close the blind.

Limit on pytz considered harmful

Hi,

"pytz>=2019.3,<2021.0",

Is there a reason for the <2021 restriction?

pytz requires regular updates, unless the rest of my system which, once it's working, I'd like to keep in a frozen known-stable state for the foreseeable future. Thus please consider removing that.

Connected accounts

It would be really handy to connect two or more Nabu Casa accounts to allow multiple people to manage remote access to a single Home Assistant install without needing to share login credentials

Handle relayer going down

When relayer goes down, we now log

2019-12-05 16:43:23 WARNING (MainThread) [hass_nabucasa.iot] Connection closed: Received non-Text message: 8

That is probably a WsMsgType.CLOSED or something. We should guard for that.

No devices discovered on Alexa

Hi,
I guess I need your help. I am with problems with the integration of the Nubu Casa (Alexa Skill).
I am with the last version of HA without any errors, and when I click on discover devices the Alexa can't find any. My Nubu Casa account its ok and I find all the devices... Scripts...etc on the HA side, but not in Alexa.
The Home Assistance skill on alexa it's linked to my nubu account too.
I already tried put the HA and the Echo5 on DMZ and search again but make no difference 😬
Any advice? Thanks

Support custom domains for remote control

Hi guys,

It would be great if the Remote Control feature could support custom hostnames, allowing me to set a custom DNS name as a CNAME to the assigned blah.ui.nabu.casa name. This is hopefully a small change on your side, if you have somewhere to register the DNS name you can just update the virtual host routing.

Thanks!
James.

Allow mobile apps to register itself in Home Assistant

We need a central component that allows users to register mobile apps. We will use this for iOS, our upcoming Android app and it can be used by any other mobile app.

We will add mobile: to the default configuration.yaml to load this component by default.

The component will keep track of registrations. We will show the registrations on the UI for the new person component.

API endpoint POST /api/mobile/register

Register a new mobile app. Calls with user credentials so we know which user it is.

Request:

{
  "app_name": "ios",
  "app_platform": "ios", // optional
  "device_public_key": "", // optional, to encrypt data to the app
  "device_name": "Paulus Pixel 3",
}
  • app_platform points at a platform for the mobile component. This is optional and could extend the webhook commands that can be handled.

The return value of this endpoint will be:

  • local webhook url to use
  • cloud webhook url to use (if user is subscribed)
  • public encryption key to send encrypted data to HA using a libsodium helper (not part of MVP)

All registrations will be stored in the storage helper. Have a unique ID attached to it.

Person component will during startup automatically start tracking any registered mobile apps for the user.

Webhook handler type publish_location

Report location data to Home Assistant. Will be forwarded to mobile/device_tracker.py which will manage the.

{
  "type": "location",
  "latitude": "",
  "longitude": "",
  "elevation": "",
  "battery_level": "",
}

Race condition Google message

2019-03-22 13:28:38 ERROR (MainThread) [hass_nabucasa.iot] Error handling message
Traceback (most recent call last):
  File "/Users/paulus/dev/hass/home-assistant/lib/python3.7/site-packages/hass_nabucasa/iot.py", line 220, in _handle_connection
    self.cloud, msg["handler"], msg["payload"]
  File "/Users/paulus/dev/hass/home-assistant/lib/python3.7/site-packages/hass_nabucasa/iot.py", line 274, in async_handle_message
    return await handler(cloud, payload)
  File "/Users/paulus/dev/hass/home-assistant/lib/python3.7/site-packages/hass_nabucasa/iot.py", line 286, in async_handle_google_actions
    return await cloud.client.async_google_message(payload)
  File "/Users/paulus/dev/hass/home-assistant/homeassistant/components/cloud/client.py", line 154, in async_google_message
    answer['payload']['agentUserId'] = cloud.claims['cognito:username']
TypeError: 'NoneType' object is not subscriptable

Error connection every reboot RPI

  1. Verision HA 110.2

  2. RPI4

Error connecting to HA at every reboot. Whenever the raspberry is restarted, nabu casa stops working. I am forced to login to nabu casa and click on "connect" in Remote UI. After this it starts working again. The error is ERR_CONNECTION_FAILED

Unable to reach Cloud - Can't handle request-connection without backend

Hi!
I just setup Hass.io.

My Setup:

VM with the offical QCOW2 VM Image with virt-manager on my Ubuntu 20.04 Desktop.
Setup like recommended, with bridge network in virt-manager.
Everything else is working great; I setup Zigbee2MQTT and Mosquitto with all my Zigbee devices working, and all other of my integrations too.

Plugins:

Config checker / Home Panel / File Editor / Log Viewer / Mosquitto / Zigbee2MQTT / Zigbe2MQTTAssistant / Terminal & SSH -

Versions:

Supervisor: 227
Core: 0.112.0 -> I just today updated to latest core version without problem.

Problem:

I can not log into my cloud account, it always fails with the error message "unable to reach cloud".
Without it, hass.io is pretty much unusable for me.

Downloading Addons, Updating Core etc. all work without any problems whatsoever.
The Hassio VM shows up in my router with its own IP in the normal LAN. I enabled automatic port forwarding for both the VMs IP and Host IP in the router. And i also tested manually forwarding both HTTP+HTTPS ports.
I checked the DNS in Hassios CLI, and everything there is correct.
So it seems networking is not the problem here.

Logs:

I edited the config and enabled logging with notset level, but when i tried to connect to my previous cloud account, there was nothing in the log at all regarding cloud/nabu casa. Only when i manually triggered the connect to cloud service from dev tools, i got this in the log:

2020-07-01 18:27:20 ERROR (MainThread) [hass_nabucasa.remote] Can't handle request-connection without backend
2020-07-01 18:27:20 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.139630893965008] 
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1295, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 518, in admin_handler
    await result
  File "/usr/src/homeassistant/homeassistant/components/cloud/__init__.py", line 202, in _service_handler
    await cloud.remote.connect()
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/remote.py", line 274, in connect
    raise RemoteNotConnected()
hass_nabucasa.remote.RemoteNotConnected

Thanks for any help in advance!

PS: i now also enabled debug loglevel in general, restarted Hassio, and then uploaded the whole log here:
home-assistant.log

I i made something wrong here or you need any other logs, please tell me! I am pretty desperate here..

UPDATE: I opend this issue on "Core" Repo, as there has been a similar one some time ago, and seems a better fit for now!

Can't revoke certificate: urn:ietf:params:acme:error:malformed :: The request message was malformed :: No such certificate

After I changed from dev to prod, the cloud component gave me this error:

2019-05-14 06:19:28 INFO (SyncWorker_7) [hass_nabucasa.acme] Revoke certificate
2019-05-14 06:19:29 ERROR (SyncWorker_7) [hass_nabucasa.acme] Can't revoke certificate: urn:ietf:params:acme:error:malformed :: The request message was malformed :: No such certificate
2019-05-14 06:19:29 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/Users/paulus/dev/hass/home-assistant/lib/python3.7/site-packages/hass_nabucasa/remote.py", line 145, in load_backend
    await self._acme.reset_acme()
  File "/Users/paulus/dev/hass/home-assistant/lib/python3.7/site-packages/hass_nabucasa/acme.py", line 375, in reset_acme
    await self.cloud.run_executor(self._revoke_certificate)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/paulus/dev/hass/home-assistant/lib/python3.7/site-packages/hass_nabucasa/acme.py", line 315, in _revoke_certificate
    raise AcmeClientError() from None
hass_nabucasa.acme.AcmeClientError

Remove cloud folder

Happens if someone removes the cloud folder on runtime. Should be not a real user case but should also not throw an error

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/cloud/http_api.py", line 117, in error_handler
    result = await handler(view, request, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/data_validator.py", line 46, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/cloud/http_api.py", line 197, in post
    data['password'])
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/auth.py", line 138, in login
    self.cloud.write_user_info()
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/__init__.py", line 162, in write_user_info
    indent=4,
  File "/usr/local/lib/python3.7/pathlib.py", line 1218, in write_text
    with self.open(mode='w', encoding=encoding, errors=errors) as f:
  File "/usr/local/lib/python3.7/pathlib.py", line 1186, in open
    opener=self._opener)
  File "/usr/local/lib/python3.7/pathlib.py", line 1039, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/config/.cloud/production_auth.json'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.