* Report unavailable entites to google.
Entities should only removed when removed from HA. Removing a temporarily unavailable entity from google causes it to need to re-configured once it become available again.
* Fix test for unavailable entities
* 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.
* 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>
* Add report state config
* Add initial steps for local report state
* Use owner of system as user_id
* First working prototype
* Only report state if requested
* Add some good logging and adjust constant name
* Move jwt generation out to non member
* Move cache out to caller
* Remove todo about cache
* Move getting token out of class
* Add timeout on calls
* Validate config dependency
* Support using service key to do sync call when api_key is not set
* Make sure timezone is fixed for datetime dummy
* Use exact expire_in time
* Support renewing token on 401
* Test retry on 401
* No need to declare dummy key twice
* Correct some docs on functions
* Add test for token expiry
* add alarm_control_panel to google_assistant
* add cancel arming option
* raise error if requested state is same as current
* rework executing command logic
* Add tests
* fixed tests
* fixed level synonyms
* Emulate color temperature for non-ct lights in light groups
* fix tests
* Address review comments
* Fix black formatting
* Fix for pylint
* Address comments
* Fix black formatting
* Address comments
* 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
* Add action.devices.traits.Volume
* Drop media player from brightness trait
* Factor out commands into separate functions
* Drop support for explicit mute
* Expose door cover/binary_sensor as door type
More logical to ask "What doors are open" than "What sensors are open"
* Add test for binary_sensor device_classes
* Cosmetic flake8
* Add test for device class for cover
* 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
* Corrections and test
* Raise error if does not support setting position
* Raising error for stateless and assumed state covers
* Fix pylint
* Tests
* Update test_trait.py
* Fix google assistant request sync service call
* More descriptive services.yaml
* Update services.yaml
* Update __init__.py
* Update request sync service call timeout
Change from 5s to 15s to allow Google to respond. 5s was too short. The service would sync but the service call would time out and throw the error.
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.
* BUGFIX: add support for extra fan speeds.
* Drop extra fan speeds.
Remove catch all, drop missing fan speeds.
* fix self.speed_synonyms call. Remove un-needed keys() call
* Add support for Mode trait in Google Assistant.
* Simplify supported logic.
* Fix SUPPORTED_MODE_SETTINGS to correct rip failures.
* more stray commas
* update tests.
* Enable Google Assistant OnOffTrait for climate devices that support them
This commit enables the OnOffTrait for climate devices that have the SUPPORT_ON_OFF feature. I have tested this locally with a Sensibo device which supports ON_OFF and a nest device that does not.
* Update trait.py
* Add tests for onoff_climate
* Add OnOff trait to climate.heatpump
* Add on status to heatpump in google_assistant tests
* 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.
* Don't treat typing as an "in-between" module for import order
That was a < 3.5 era thing.
* Tighten scope of some pylint unused-import disables
To avoid isort moving a top level one around, undesirably broadening its
scope.
* Remove unit_of_measurement from climate base class.
* Updated google_assistant component and tests to use core temp units.
* Fixes
* Convert Alexa component to use core temp units for climate entities.
* Fix tests.
* Converted prometheus component.
* Remove unit_of_measurement from homekit thermostat tests.
* Small fix.
* Fix Min/Max Kelvin color temp attribute for Google
Max Kelvin is actually Min Mireds and vice-versa. K = 1000000 / mireds
* Update test_smart_home.py
* Update test_trait.py
* Accept and report both xy and RGB color for lights
* Fix demo light supported_features
* Add new XY color util functions
* Always make color changes available as xy and RGB
* Always expose color as RGB and XY
* Consolidate color supported_features
* Test fixes
* Additional test fix
* Use hue/sat as the hass core color interface
* Tests updates
* Assume MQTT RGB devices need full RGB brightness
* Convert new platforms
* More migration
* Use float for HS API
* Fix backwards conversion for KNX lights
* Adjust limitless min saturation for new scale
* 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
* google_assistant: Refactor query_device
The previous code had issues where domains could break out and end up
with weird brightness values and we weren't enforcing the `on` and
`oneline` keys in the response.
* google_assistant: Add media_player to query test
* Allow exposing sensors as temperature or humidity as 'climate' to Google Assistant
* Fixed hound
* Fixed hound
* Handled correctly unit of measurement to fix humidity
* Fixed temperature conversion for Google climate components
* Fixed temperature conversion for Google climate components
* Fixed indentation
* Fixed hound
* Fixed tests
* Fixed conversion and unit tests
* Fix sync for custom unit temperature
* Implemented requested changes
* Fix hound
* Fix linting errors
* Added success tests for sensors as climate
* Fix lint errors
* Change 'on' to 'heat' as fallback thermostat mode
'on' isn't recognised as a mode by Google Assistant, rather is used as a method to return a thermostat to a previous mode. In the case where a thermostat doesn't support the standard google modes (e.g. A homematic radiator thermostat) this means the set_temperature doesn't get returned to the user on a request.
* Update test_google_assistant.py
* Changed device type of media player and cover to switch
Covers and media players should not be of device type 'light'. Example: If user requests all lights to switch to off, covers are closed and media players are affected too.
* Fix test
If the `google_assistant` key exists in the config but has no
`entity_config` key under it you'll get an error.
```
File "/Users/pkates/src/home-assistant/homeassistant/components/google_assistant/http.py", line 51, in is_exposed
entity_config.get(entity.entity_id, {}).get(CONF_EXPOSE)
AttributeError: 'NoneType' object has no attribute 'get'
```
* Lazy loading of service descriptions
* Fix tests
* Load YAML in executor
* Return a copy of available services to allow mutations
* Remove lint
* Add zha/services.yaml
* Only cache descriptions for known services
* Remove lint
* Remove description loading during service registration
* Remove description parameter from async_register
* Test async_get_all_descriptions
* Remove lint
* Fix typos from multi-edit
* Remove unused arguments
* Remove unused import os
* Remove unused import os, part 2
* Remove unneeded coroutine decorator
* Only use executor for loading files
* Cleanups suggested in review
* Increase test coverage
* Fix races in existing tests
* Fixed aliases warning message
* Fixed test cases
* Changing handling for google_assistant groups to treat them as lights - amending to include user info.
* Enable brightness, RGB, etc for groups in Google Assistant
* Revert color/hue/temp settings
* Change servce from light to homeassistant
* Fixed config_units
* Convert from light to switch
* Change group to switch
* Update tests to switch instead of light for group
* add support for color temperature and color; also add some extra deviceInfo attributes
* change so that default behaviour doesn't turn off device if the action isn't handled
* add tests
* fix lint
* more lint
* use attributes were applicable
* removed debug logging
* fix unassigned if only None returned
* report more data in QUERY
* better tests for color and temperature
* fixes after dev merge
* remove deviceInfo as not part of a device state (PR #10399)
* fix after merge
* Initial commit for request_sync functionality
* Fixes for Tox results
* Fixed all tox issues and tested locally with GA
* Review comments - api_key, conditional read descriptions
* Add test for service
* http: Add headers key to json[_message]
* Add google_assistant component
This component provides API endpoints for the Actions on Google Smart
Home API to interact with Google Assistant.
* google_assistant: Re-add fan support
* google_assistant: Fix Scene handling
- The way I originally wrote the MAPPING_COMPONENT and the way it's actual
used changed so the comment was updated to match that.
- Use const's in more places
- Handle the ActivateScene command correctly
* google_assistant: Fix flakey compare test
Was failing on 3.4.2 and 3.5, this is more correct anyway.
* google_assistant: Use volume attr for media_player