* Rename BinarySensorDevice to BinarySensorEntity
* Tweak
* Move deprecation warning to __new__, add test
* Move deprecation warning back to __init__
* Move deprecation warning to __init_subclass
* Track if request is local
* Cancel early if 2FA disabled
* Allow disabling 2FA for ack
* Do not mark devices with 2FA as reachable
* Add request source to GA events
* Make async_report_state take agent_user_id
* Attempt to store synced agents
* Drop now not needed initialization
* Make sure cloud uses the all sync on changed preferences
* Some more places to use all version of sync
* Get the agent_user_id from the request context if available
* Minor cleanup
* Remove the old fixed agent_user_id for cloud
Instead pass along cloud_user where appropriate.
* async_delay_save takes a function
* Adjust test for delayed store
* Remove unused save function
* Add login check.
* Only create cloud user if cloud in use
* Pass context to alexa
* Update requirements
* Fix handing & design pattern for 0.30
* fix tests
* Fix lint & tests
* rename internal user
* Move request sync logic into GoogleConfig
* Return http status code for request_sync same as cloud
* agent_user_id is not optional for async_sync_entities now
* No need in checking parameter here
* Adjust some things for cloud tests
* Adjust some more stuff for cloud tests
* Drop uneccessary else
* Black required change
* Let async_schedule_google_sync take agent_user_id
* Assert return value on api call
* Test old api key method
* Update homeassistant/components/google_assistant/helpers.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Extract exposed devices function
* Add might_2fa info to trait
* Do not filter with should_expose in Google helper func
* Cloud: allow setting if Google entity is exposed
* Allow disabling 2FA via config
* Cloud: allow disabling 2FA
* Lint
* More changes
* Fix typing
* Skip entity if no device type found
* Add test for potentially skipped binary sensors
* Reorg code, add tests to ensure all exposed things have types
* Lint
* Fix tests
* Lint
* Alexa: implement auth and proactive ChangeReport messages
* refactor after rebase from dev to use the new AlexaDirective and Response classes
* move to aiohttp; cleanup
* better function name
* move endpoint to config
* allow passing token function
* remove uneeded state get
* use iterable directly
Co-Authored-By: abmantis <abmantis@users.noreply.github.com>
* missing delete from previous commit
* checks for when user has no auth config
* update cloud component
* PR suggestions
* string lint
* Revert "string lint"
This reverts commit a05a1f134c9ebc7a6e67c093009744f142256365.
* linters are now happier
* more happy linters
* use internal date parser; improve json response handling
* remove unused import
* use await instead of async_add_job
* protect access token update method
* add test_report_state
* line too long
* add docstring
* Update test_smart_home.py
* test accept grant api
* init prefs if None
* add tests for auth and token requests
* replace global with hass.data
* doc lint
The `Config` object specific to the `google_assistant` component
had a default value for `allow_unlock`. We were not overriding this
default when constructing the Config object during `google_assistant`
component setup, whereas we do when setting up the `cloud` component.
To fix, we thread the `allow_unlock` parameter down through http setup,
and ensure that it's set correctly. Moreover, we also change the
ordering of the `Config` parameters, and remove the default. Future
refactoring should not miss it, as it is now a required parameter.
* Add cloud webhook support
* Simplify payload
* Add cloud http api tests
* Fix tests
* Lint
* Handle cloud webhooks
* Fix things
* Fix name
* Rename it to cloudhook
* Final rename
* Final final rename?
* Fix docstring
* More tests
* Lint
* Add types
* Fix things
* Add support for locks in google assistant component
This is supported by the smarthome API, but there is no documentation
for it. This work is based on an article I found with screenshots of
documentation that was erroneously uploaded:
https://www.androidpolice.com/2018/01/17/google-assistant-home-can-now-natively-control-smart-locks-august-vivint-first-supported/
Google Assistant now supports unlocking certain locks - Nest and August
come to mind - via this API, and this commit allows Home Assistant to
do so as well.
Notably, I've added a config option `allow_unlock` that controls
whether we actually honor requests to unlock a lock via the google
assistant. It defaults to false.
Additionally, we add the functionNotSupported error, which makes a
little more sense when we're unable to execute the desired state
transition.
https://developers.google.com/actions/reference/smarthome/errors-exceptions#exception_list
* Fix linter warnings
* Ensure that certain groups are never exposed to cloud entities
For example, the group.all_locks entity - we should probably never
expose this to third party cloud integrations. It's risky.
This is not configurable, but can be extended by adding to the
cloud.const.NEVER_EXPOSED_ENTITIES array.
It's implemented in a modestly hacky fashion, because we determine
whether or not a entity should be excluded/included in several ways.
Notably, we define this array in the top level const.py, to avoid
circular import problems between the cloud/alexa components.
* Refactor Alexa API to use objects for requests
This introduces _AlexaDirective to stand in for the previous model of passing
basic dict and list data structures to and from handlers. This gives a more
expressive platform for functionality common to most or all handlers.
I had two use cases in mind:
1) Most responses should include current properties. In the case of locks and
thermostats, the response must include the properties or Alexa will give the
user a vague error like "Hmm, $device is not responding." Locks currently work,
but thermostats do not. I wanted a way to automatically include properties in
all responses. This is implemented in a subsequent commit.
2) The previous model had a 1:1 mapping between Alexa endpoints and Home
Assistant entities. This works most of the time, but sometimes it's not so
great. For example, my Z-wave thermostat shows as three devices in Alexa: one
for the temperature sensor, one for the heat, and one for the AC. I'd like to
merge these into one device from Alexa's perspective. I believe this will be
facilitated with the `endpoint` attribute on `_AlexaDirective`.
* Include properties in all Alexa responses
The added _AlexaResponse class provides a richer vocabulary for handlers.
Among that vocabulary is .merge_context_properties(), which is invoked
automatically for any request directed at an endpoint. This adds all supported
properties to the response as recommended by the Alexa API docs, and in some
cases (locks, thermostats at least) the user will get an error "Hmm, $device is
not responding" if properties are not provided in the response.
* Fix setting temperature with Alexa thermostats
Fixes https://github.com/home-assistant/home-assistant/issues/16577
* Refactor Google Assistant
* Fix cloud test
* Fix supported features media player demo
* Fix query
* Fix execute
* Fix demo media player tests
* Add tests for traits
* Lint
* Lint
* Add integration tests
* Add more tests
* update logging
* Catch out of range temp errrors
* Fix cloud error
* Lint
* Upgrade pylint to 1.8.1
* Fix no-else-return
* Fix bad-whitespace
* Fix too-many-nested-blocks
* Fix raising-format-tuple
See https://github.com/PyCQA/pylint/blob/master/doc/whatsnew/1.8.rst
* Fix len-as-condition
* Fix logging-not-lazy
Not sure about that TEMP_CELSIUS though, but internally it's probably just like if you concatenated any other (variable) string
* Fix stop-iteration-return
* Fix useless-super-delegation
* Fix trailing-comma-tuple
Both of these seem to simply be bugs:
* Nest: The value of self._humidity never seems to be used anywhere
* Dovado: The called API method seems to expect a "normal" number
* Fix redefined-argument-from-local
* Fix consider-using-enumerate
* Fix wrong-import-order
* Fix arguments-differ
* Fix missed no-else-return
* Fix no-member and related
* Fix signatures-differ
* Revert "Upgrade pylint to 1.8.1"
This reverts commit af78aa00f125a7d34add97b9d50c14db48412211.
* Fix arguments-differ
* except for device_tracker
* Cleanup
* Fix test using positional argument
* Fix line too long
I forgot to run flake8 - shame on me... 🙃
* Fix bad-option-value for 1.6.5
* Fix arguments-differ for device_tracker
* Upgrade pylint to 1.8.2
* 👕 Fix missed no-member
* Implement entity and domain exclude/include for Alexa
* Switch to using generate_filter
* Use proper domain for turn on/off calls except for groups where we must use the generic homeassistant.turn_on/off
* travis fixes
* Untangle
* Lint
* Cloud: connect to cloud
* Fix tests in py34
* Update warrant to 0.5.0
* Differentiate errors between unknown handler vs exception
* Lint
* Respond to cloud message to logout
* Refresh token exception handling
* Swap out bare exception for RuntimeError
* Add more tests
* Fix tests py34