* Remove async_remove_listener
This avoids the ambuigity as to what happens if same callback is added multiple times.
* Keep track of a context for each listener
This allow a update coordinator to adapt what data to request on update from the backing service based on which entities are enabled.
* Clone list before calling callbacks
The callbacks can end up unregistering and modifying the dict while iterating.
* Only yield actual values
* Add a test for update context
* Factor out iteration of _listeners to helper
* Verify context is passed to coordinator
* Switch to Any as type instead of object
* Remove function which use was dropped earliers
The use was removed in 8bee25c938
* Add return code to integration application credentials in config flow
* Update google tests to use new return code
* Update spotify test for no auth configured
* Add translation for oauth2_missing_credentials
* Add new return code to yolink
* Update homeassistant/strings.json
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Initial developer credentials scaffolding
- Support websocket list/add/delete
- Add developer credentials protocol from yaml config
- Handle OAuth credential registration and de-registration
- Tests for websocket and integration based registration
* Fix pydoc text
* Remove translations and update owners
* Update homeassistant/components/developer_credentials/__init__.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/developer_credentials/__init__.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Remove _async_get_developer_credential
* Rename to application credentials platform
* Fix race condition and add import support
* Increase code coverage (92%)
* Increase test coverage 93%
* Increase test coverage (94%)
* Increase test coverage (97%)
* Increase test covearge (98%)
* Increase test coverage (99%)
* Increase test coverage (100%)
* Remove http router frozen comment
* Remove auth domain override on import
* Remove debug statement
* Don't import the same client id multiple times
* Add auth dependency for local oauth implementation
* Revert older oauth2 changes from merge
* Update homeassistant/components/application_credentials/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Move config credential import to its own fixture
* Override the mock_application_credentials_integration fixture instead per test
* Update application credentials
* Add dictionary typing
* Use f-strings as per feedback
* Add additional structure needed for an MVP application credential
Add additional structure needed for an MVP, including a target
component Xbox
* Add websocket to list supported integrations for frontend selector
* Application credentials config
* Import xbox credentials
* Remove unnecessary async calls
* Update script/hassfest/application_credentials.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update script/hassfest/application_credentials.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update script/hassfest/application_credentials.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update script/hassfest/application_credentials.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Import credentials with a fixed auth domain
Resolve an issue with compatibility of exisiting config entries when importing
client credentials
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* feat: make this variable available in template entities
This makes the variable `this` available in template entities.
It will simplify the use of self-referencing template entities.
Because, without this, we have to repeat the entity id every time.
If we can solve this without explicitly spelling the entity id,
code can be re-used much better.
As a side-effect, this will allow to use `variables`-like patterns,
where attributes can be used as variables to calculate subsequent attributes or state.
Example:
```yaml
template:
sensor:
- name: test
state: "{{ this.attributes.test }}"
# not: "{{ state_attr('sensor.test', 'test' }}"
attributes:
test: "{{ now() }}"
```
* expose entity_id instead of this
* add test
* Refactor to expose this variable
* Tweak repr dunder
Co-authored-by: Erik <erik@montnemery.com>
* Add entity registry helper to migrate entity to new platform
* Add additional assertion
* Add more properties to migration logic
* Change logic after thinking about erik's comments
* Require new_config_entry_id if entry.config_entry_id is not None
* Create private async_update_entity function that all update functions use
* Don't have special handling for entity ID missing in async_update_entity_platform
* fix docstring
* rebase off current
* rearrange
* Overload selector function
* Update/fix all selector references
* better typing?
* remove extra option
* move things around
* Switch to Sequence type to avoid ignoring mypy error
* Get rid of ...'s
* Improve typing to reduce number of ignores
* Remove all typing ignores
* Make config optional for selectors that don't need a config
* add missing unit prefixes
* Rename TypedDicts
* Update homeassistant/helpers/selector.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* review feedback
* remove peta from integration integration
* Fix min_max
* Revert change to selector function
* Fix logic
* Add typing for selector classes
* Update selector.py
* Fix indent
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Add support for new select selector properties
* fix mode option
* Apply suggestions from code review
* Correct validation for empty options, update tests
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Fix notify discovery setup
* add test
* unsubscribe at reset
* Add guard
* move dispatcher to reload module
* only unsubscribe if platform was setup
* initialize dispatcher once and tests
* test get_service too
* add tests
* fix test
* use get_service for test invalid platform
* Test built-in reload method
* set to None after clearing dispatcher - tests
* Pathing services file
* Update tests/components/notify/test_init.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* dispatcher is not set twice if integration loaded
* empty discovery payload
* Removed not needed services.yaml mock
* Update tests/components/notify/test_init.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* flake8
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>