* Significantly speed up single entity/response service calls
Since the majority of service calls are single entity, we can
avoid creating tasks in this case. Since the multi-entity
service calls always check the result and raise, we can switch
the asyncio.wait to asyncio.gather
* Significantly speed up single entity/response service calls
Since the majority of service calls are single entity, we can
avoid creating tasks in this case. Since the multi-entity
service calls always check the result and raise, we can switch
the asyncio.wait to asyncio.gather
* revert
* cannot be inside pytest.raises
* one more
* Update homeassistant/helpers/service.py
* Ensure async_get_system_info does not fail if supervisor is unavailable
fixes#96470
* fix i/o in the event loop
* fix tests
* handle some more failure cases
* more I/O here
* coverage
* coverage
* Update homeassistant/helpers/system_info.py
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* remove supervisor detection fallback
* Update tests/helpers/test_system_info.py
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Differentiate between device info types
* Update allowed fields
* Update homeassistant/helpers/entity_platform.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Split up message in 2 lines
* Use dict for device info types
* Extract device info function and test error checking
* Simplify parsing device info
* move checks around
* Simplify more
* Move error checking around
* Fix order
* fallback config entry title to domain
* Remove fallback for name to config entry domain
* Ensure mocked configuration URLs are strings
* one more test case
* Apply suggestions from code review
Co-authored-by: Erik Montnemery <erik@montnemery.com>
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Mark scripts as response optional, make it always return a response if return_response is set
* Update test_init.py
* Revert "Update test_init.py"
This reverts commit 8e113e54db.
* Split + add test
* Tune keep alives for polling integrations
aiohttp closes the connection after 15s by default,
and httpx closes the connection after 5s by default.
We have a lot of integrations that poll every 10-60s
which create and tear down connections over and over.
Set the keep alive time to 65s to maximize connection
reuse and avoid tls negotiation overhead
* Apply suggestions from code review
* adjust
* Update log message when referenced entity not found
* Update homeassistant/helpers/service.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update test
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Allow returning a script variable from a script
* Don't allow returning a template result
* Raise if response variable is undefined
* Add test
* Update homeassistant/helpers/script.py
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Format code
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Add image platform to the template integration
* Set a default name
* Fix typo
* Add tests
* Improve test coverage
* Derive content-type from fetched image
* Add service response data for listing calendar events
Add the capability of response data for for the entity component.
* Rename input arguments and add service description
* Improve list events to be more user friendly
Allow the end date to be determined based on a relative time duration. Make the start time optional and set to "now". Add additional test coverage. Update demo calendar to actually perform date range checks.
* Wrap docstrings properly.
* Increase test coverage
* Update to use new API calls
* Readability improvements
* Wrap docstrings
* Require at least one of end or duration
* Check for multiple entity matches earlier in the request
* Update documentation strings
* Improve service response data APIs
Make the API naming more consistent, and require registration that a
service supports response data so that we can better integrate with
the UI and avoid user confusion with better error messages.
* Improve test coverage
* Add an enum for registering response values
* Assign enum values
* Convert SupportsResponse to StrEnum
* Update service call test docstrings
* Add tiny missing full stop in comment
---------
Co-authored-by: Franck Nijhof <frenck@frenck.nl>