* 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 url support for mqtt image platform
* Refactor url fetch code to use base platform
* Update after rebase
---------
Co-authored-by: Erik <erik@montnemery.com>
* Change to "finished speaking detection"
* Add select entity to ESPHome for finished speaking detection
* Fix entity name
* Use vad select in stt stream
---------
Co-authored-by: J. Nick Koston <nick@koston.org>
* 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 mqtt image platform
* Follow up comments
* Use separate topics
* Set last_ image to `None` on error
* Fix encoding and schema validation
* Assing None to last_image when get image fails
* Follow up comment
* Remove content_type validation
* Add validation
* Rename options according suggestions
* Remove url_topic / template feature from PR
* Always set content_type
* Support notification_id in notify.persistent_notification
* Apply suggestions from code review
Co-authored-by: Scott Giminiani <ScottG489@Gmail.com>
---------
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Scott Giminiani <ScottG489@Gmail.com>
* Require esphome service calls to be enabled
For existing devices, calling Home Assistant services continues
to be allowed.
For newly configured devices, it must now be enabled in the options
flow
* fix
* adjust
* coverage
* adjust
* fix test
* Update homeassistant/components/esphome/strings.json
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Update homeassistant/components/esphome/strings.json
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Update homeassistant/components/esphome/strings.json
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Update homeassistant/components/esphome/__init__.py
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Update homeassistant/components/esphome/__init__.py
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
* Update homeassistant/components/esphome/__init__.py
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
* Fix esphome binary sensors when state is missing
* Fix esphome binary sensors when state is missing
* Fix esphome binary sensors when state is missing
* Remove deprecated non-native number support
These were scheduled to be removed in 2022.10 but were left
in to give custom component authors a bit more time.
Its been a year since they were deprecated so its time
to remove the old code
https://developers.home-assistant.io/blog/2022/06/14/number_entity_refactoring/
* strip unneeded change from testing
* 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
* Add VAD sensitivity option to VoIP devices
* Use select entitiy for VAD sensitivity
* Add sensitivity to tests
* Add to assist pipeline tests
* Update homeassistant/components/assist_pipeline/select.py
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Update tests/components/voip/test_voip.py
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Add async_register_trigger_sentences for default agent
* Add trigger response and trigger handler
* Check callback in test
* Clean up and move response to callback
* Add trigger test
* Drop TriggerAction
* Test we pass sentence to callback
* Match triggers once, allow multiple sentences
* Don't use trigger id
* Use async callback
* No response for now
* Use asyncio.gather for callback responses
* Fix after rebase
* Use a list for trigger sentences
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Add websocket command to test intent recognition for default agent
* Return results as a list
* Only check intent name/entities in test
* Less verbose output in debug API
* Migrate Linn / Openhome integration to SSDP config flow
* moved device initialisation into __init__
* wait for user step before adding openhome entities
* add CONFIG_SCHEMA
* cover confirmation step in config flow test
* Address comments
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* 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>
* Register services at integration level
If HA is unable to connect to Fully Kiosk, the services don't get
registered. This can cause repair to create notifications saying
that the 'fully_kiosk.load_url' service is unknown.
Fixes#85444
* Validate config entry is loaded
* Refactor service invocation
Raises `HomeAssistantError` when the user provides an device id that is
not in the device registry or a device that is not a Fully Kiosk
device. If the device's config entry is not loaded, a warning is
logged.
* Update homeassistant/components/fully_kiosk/services.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Assert HomeAssistantError when integration unloaded
* Remove unused import
* Set CONFIG_SCHEMA
* Update homeassistant/components/fully_kiosk/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add test for non fkb devices targets in service calls
* Apply suggestions from code review
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Allow scripts service actions to save return values
* Simplify script service response data
* Rename result_variable to response_variable based on feedback
* Speed up entity service calls
- Avoid permissions check if the caller is an admin
- Use set intersection instead of linear search of entity platforms to find entities
* tweak
* fix light test to not use an admin user
* Add support for service calls with resopnse data.
Update the service calls to allow returning responses with data,
with an initial use case supporting basic service calls usable
within script.
* Revert enttiy platform/component changes
* Remove unnecessary comma diff
* Revert additional unnecessary changes
* Simplify service call
* Simplify and fix typing and revert whitespace
* Clarify typing intent
* Revert more entity service calls
* Revert additional entity service changes
* Set blocking=True for group notify service call
* Revert unnecessary changes
* Reverting more whitespace changes
* Revert more service changes
* Add test coverage for None return case
* Add parameter to service calls indicating return values were requested
* Update tests/test_core.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Add additional service call tests
* Update test comment
---------
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Update return signature of service calls
* Add timeout error handling in websocket api for service calls
* Update recorder tests to remove assertion on service call
* Remove timeout behavior and update callers that depend on it today
* Fix tests
* Add missing else
* await coro directly
* Fix more tests
* Update the intent task to use wait instead of timeout
* Remove script service call limits and limit constants
* Update tests that depend on service call limits
* Use wait instead of wait_for and add test
* Update homeassistant/helpers/intent.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Debounce discoveries to improve event loop stability at the started event
The first one is immediate and anything that fires within the next
second will be debounced to only happen once every second
* fix mock
* Fix imap sensor measurement class and precision
* Test measurement class is set correctly
* Remove unrelated changes
* Move EntityDescription to module level
#94138 added support for raw/bundled advertisements. We should use the
same monotonic time for all advertisements in the bundle if not time
is passed, or calculate the timestamp and pass it if its known
* Make `find_entity_id` synchronous
* Remove `tries`
* Use new `attribute_updated` event signature
* Validate attributes before creating entities
* Avoid swallowing exceptions when opening covers
* Bump ZHA dependencies
* Add a matcher for Sinope water leak sensors using a non-standard ZCL attribute
* Ensure handler matching is strict, not multi
* Add type annotations for newly-updated functions
* Remove _raw from zeroconf properties
This was added in #31059 but it appears it was never used.
To preserve backwards compatibility, properties are still decoded
but utf-8 errors are replaced instead of dropped
* Remove _raw from zeroconf properties
This was added in #31059 but it appears it was never used.
To preserve backwards compatibility, properties are still decoded
but utf-8 errors are replaced instead of dropped
* Name unnamed binary sensors by their device class
* Update type annotations
* Fix loading of entity component translations
* Add test
* Update integrations
* Set abode and rfxtrx binary_sensor name to None
* Revert changes in homekit_controller
* Remove option flow, refactor and improve the code quality after review in PR #54280
* Remove coordinator.py from coverage report
* Some minor improvements for unit tests
* Remove _LOGGER
* Use pytest.fixture and some more improvments
* Add back empty __init__
* Fix docstring
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Reduce config flow matching overhead
Much of the config flow matching is happening on the context data
after converting via a series of functions. Avoid the conversions
by passing the context matcher deeper into the stack so only
relvant entries need to be processed.
The goal is to reduce the overhead and reduce the chance
the event loop falls behind at the started event when
all the discoveries are processed
* Reduce config flow matching overhead
Much of the config flow matching is happening on the context data
after converting via a series of functions. Avoid the conversions
by passing the context matcher deeper into the stack so only
relvant entries need to be processed.
The goal is to reduce the overhead and reduce the chance
the event loop falls behind at the started event when
all the discoveries are processed
* Reduce config flow matching overhead
Much of the config flow matching is happening on the context data
after converting via a series of functions. Avoid the conversions
by passing the context matcher deeper into the stack so only
relvant entries need to be processed.
The goal is to reduce the overhead and reduce the chance
the event loop falls behind at the started event when
all the discoveries are processed
* augment cover
* Implemented Renson integration
* - renamed component to a better name
- Made cleaner code by splitting up files into different one
- Fixed issues regarding getting data from library
- Added service.yaml file
* Added Renson services
* cleanup translations
* added config_flow tests
* changed config_flow, removed all services
* use SensorEntityDescription + introduced new binarySensor
* fixed config_flow test
* renamed renson_endura_delta to renson
* refactored sensors and implemented binary_sensor
* Changed some sensors to non measurement and added entity_registery_enabled_default for config sensors
* Enabled binary_sensor
* changed import to new renamed module
* Merge files into correct files + cleaned some code
* Change use of EntityDescription
* Update codeowners
* Fixed lint issues
* Fix sensor
* Create test.yml
* Update test.yml
* add github action tests
* Format json files
* Remove deprecated code
* Update homeassistant/components/renson/binary_sensor.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Use Coordinqte in Sensor
* Migrated binary sensor to use coordinate
* Removed firmwareSensor
* Add entity_catogory to binary_sensor
* Add services
* Revert "Add services"
This reverts commit 028760d8d8.
* update requirements of Renson integration
* Add services and fan
* Fixed some issue + fixed PR comments
* Cleanup code
* Go back 2 years ago to the bare minimum for PR approval
* Refactored code and added a lot of device classes to the entities
* Fix some bugs
* Add unique Id and some device class
* Show the level value for CURRENT_LEVEL_FIELD instead of the raw data
* Remove FILTER_PRESET_FIELD for now
* Make the _attr_unique_id unique
* Changed Renson tests
* Moved Renson hass data into @dataclass
* Changed test + added files to .coveragerc
* Add device_class=SensorDeviceClass.Duration
* Fix syntax
---------
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Remove unneeded checks for Entity.platform
* Update tests
* Prevent breaking integrations without an EntityComponent
* Warn when entity has no platform
* Add Water Heater entity to MQTT
* Adding tests for Water Heater
* Remove duplicate line and unneeded var declaration
* Remove target temp range and away mode
* Move common Temperature Control conf to const
* Remove unnecessary platform schema and temp check
* Add common value template key test
* Use MqttTemperatureControl in Water Heater
* Move operation mode out of MqttTemperatureControl
* Remove unecessary attribute declaration
* Remove default min/max temp and auto init attr
* Fix mqtt water heater initial temp conversion
* Make async_set_temperature common
* Fix init temp comment
* Merge value_template_keys into get_with_templates
* Remove unnecessary operation_mode overriding
* Add async_set_temperature to water heater
* Fix docstring comments
* Remove mark_read from persistent_notification
Nothing on the frontend uses this, and the service is not documented
There is not much point in keeping this as the notifications
are no longer stored in the state machine
* adjust
* adjust
* Add discovergy integration
* Capitalize measurement type as it is in uppercase
* Some logging and typing
* Add all-time total production power and check if meter has value before adding it
* Add tests for Discovergy and changing therefor library import
* Disable phase-specific sensor per default, set user_input as default for schema and implement some other suggestions form code review
* Removing translation, fixing import and some more review implementation
* Fixing CI issues
* Check if acces token keys are in dict the correct way
* Implement suggestions after code review
* Correcting property function
* Change state class to STATE_CLASS_TOTAL_INCREASING
* Add reauth workflow for Discovergy
* Bump pydiscovergy
* Implement code review
* Remove _meter from __init__
* Bump pydiscovergy & minor changes
* Add gas meter support
* bump pydiscovergy & error handling
* Add myself to CODEOWNERS for test directory
* Resorting CODEOWNERS
* Implement diagnostics and reduce API use
* Make homeassistant imports absolute
* Exclude diagnostics.py from coverage report
* Add sensors with different keys
* Reformatting files
* Use new naming style
* Refactoring and moving to basic auth for API authentication
* Remove device name form entity name
* Add integration type to discovergy and implement new unit of measurement
* Add system health to discovergy integration
* Use right array key when using an alternative_key & using UnitOfElectricPotential.VOLT
* Add options for precision and update interval to Discovergy
* Remove precision config option and let it handle HA
* Rename precision attribute and remove translation file
* Some formatting tweaks
* Some more tests
* Move sensor names to strings.json
* Redacting title and unique_id as it contains user email address
* support live reload of intent_script
* add services.yaml
* update tesls for full code coverage
* Update based on feedback
* fix intent_script reload when no intent_script config
* Update homeassistant/helpers/intent.py
* update tests to handle no_existing better
---------
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Fix august aiohttp session being closed out from under it
fixes#93941
* Fix august aiohttp session being closed out from under it
fixes#93941
* Fix august aiohttp session being closed out from under it
fixes#93941
* Add silabs_multiprotocol platform
* Add new files
* Add ZHA tests
* Prevent ZHA from creating database during tests
* Add delay parameter to async_change_channel
* Add the updated dataset to the dataset store
* Allow MultipanProtocol.async_change_channel to return a task
* Notify user about the duration of migration
* Update tests
* Add video id to state attributes
* Make extra state attributes not optional
* Revert "Make extra state attributes not optional"
This reverts commit d2f9e936c8.
* Add zwave_js speed config for additional GE/Jasco fan controllers
Add speed info for Honeywell(GE/Jasco) 39358 In-Wall Fan Speed Control and Enbrighten(GE/Jasco) 55258 In-Wall Fan Speed Control.
* Add test for Honeywell 39358 In-Wall Fan Speed Control
* Add Dremel 3D Printer integration
* remove validators requirement
* ruff
* uno mas
* uno mas
* uno mas
* uno mas
---------
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Tom Harris <tomharris@harrisnj.net>
* Add error handling for all service calls
* Switch siren to use internal function
* Remove failing checks
* Revert change to poll service, add comments, and add additional error handling
* Add error handling for ping and refresh + review comment + add tests
* Add test for statistics entity refresh
* Add time component to Melnor Bluetooth integration
* Apply suggestions from code review
---------
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Swallow error 40000 for songpal power on/off
* Move ERROR_REQUEST_RETRY to consts
* Add tests for the swallow exception behavior
* Update tests/components/songpal/test_media_player.py
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Language codes for Hebrew
There is 2 optional code for Hebrew:
he-IL is the new code
iw-IL is the old code , the google cloud STT for example is using the old code (iw)
* Update language.py
* Update test_language.py
* Update test_language.py
* Update test_language.py
* Simplify duplicate language check
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Initialize _attr_native_value when running
* Fix return type on update_sensor_state()
move init at startup if _attr_native_value is None
* allow update _attr_native_value when running and none
* Migrate restore_state helper to use registry loading pattern
As more entities have started using restore_state over time, it
has become a startup bottleneck as each entity being added is
creating a task to load restore state data that is already loaded
since it is a singleton
We now use the same pattern as the registry helpers
* fix refactoring error -- guess I am tired
* fixes
* fix tests
* fix more
* fix more
* fix zha tests
* fix zha tests
* comments
* fix error
* add missing coverage
* s/DATA_RESTORE_STATE_TASK/DATA_RESTORE_STATE/g
* Add speech detection to esphome voice assistant
* Timeout after silence
Ensure events are sent before finish is called
* use va_version 3 instead of ESPHome version
* Convert repeated fixtures to factory
* Add some v3 tests
* Add conversation_id
* Bump aioesphomeapi to 13.8.0
* Fix missed buffering of detected chunk
* Alter log message
* Updates
* Spelling
* Fix return type
* Refactor zwave_js.cover and improve test coverage
* Remove extra fixtures
* cleanup old stuff
* Get coverage to 100
* Add support for Window Covering CC
* fix bug
* typo
* remove redundant stuff
* slight change to improve readability
* Add device class
* Update to match specs
* rfxtrx: add missed case for device tuple fallback
Previously the code was prepared for a backward compatible
migration of tuples, where both styles of identifiers might exist
in device registry at the same time.
This place was sadly missed
* No need to raise special, we can assert instead
* Add some basic tests
* Do not trigger reload when unloading MQTT entry
* More cleanup
* cleanup async_reload_manual_mqtt_items
* Add test
* Improve test
* Remove unuse mocks from test
* Add discovery item in test
* Fix refactoring error with updating in sequence
see #93649
* coverage
* make sure entities are being updated in parallel
* make sure entities are being updated in sequence
* Defer creating tasks we know are going to wait on the entity platform semaphore
When looking at whats going on with aiomonitor-ng, I noticed
we end up creating a lot of tasks that block waiting for the
executor because of the entity platform parallel_updates semaphore.
When we know the tasks are going to block we now await them
in sequence to avoid feeding the loop a herd of tasks that
will block on the semaphore
* change during iteration fix
* change during iteration fix
* cleanup
* cleanup
* fix vizio test
* Switch some frequently called call_laters to call_at
call_at is a bit faster than call_later since call_later
is a wrapper around call_at.
We call at lot of these at startup so it helps a bit when
we are resource constrained
* update test
* update test
* Complete migration of persistent notifications
Persistent notifications are no longer stored in
the state machine and no longer fire events
* Complete migration of persistent notifications
Persistent notifications are no longer stored in
the state machine and no longer fire events
* fixes
* fixes
* fixes
* ws test
* update tests
* update tests
* fix more tests
* fix more tests
* more fixes
* fix
* fix person
* fix person
* keep whitelist
* use singleton
* Add additional coverage to history websocket api
related issue #93258
* Add additional coverage to history websocket api
related issue #93258
* Fix results when union query ends up at the end instead of front
* Apply suggestions from code review
* resort
* zero instead
* fix exception
* fix tests
* Fix not retrying on connection reset during nexia config entry setup
fixes
```
2023-05-26 00:15:39.129 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Alexander for nexia
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 558, in _request
resp = await req.send(conn)
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 670, in send
await writer.write_headers(status_line, self.headers)
File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 130, in write_headers
self._write(buf)
File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 75, in _write
raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/nexia/__init__.py", line 47, in async_setup_entry
await nexia_home.login()
File "/usr/local/lib/python3.11/site-packages/nexia/home.py", line 385, in login
request = await self.post_url(self.API_MOBILE_ACCOUNTS_SIGN_IN_URL, payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/nexia/home.py", line 157, in post_url
response: aiohttp.ClientResponse = await self.session.post(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 572, in _request
raise ClientOSError(*exc.args) from exc
aiohttp.client_exceptions.ClientOSError: Cannot write to closing transport
```
* coverage
* Move constant values to separate file
* Move constant values to separate file
* Add config flow to lastfm
* Add tests
* Add config flow to lastfm
* Add tests
* Add tests
* Add tests
* Add extra form for main user and autofill with friends
* Add extra form for main user and autofill with friends
* Add extra form for main user and autofill with friends
* Add extra form for main user and autofill with friends
* Add OptionsFlow
* Add tests
* Fix feedback
* Fix feedback
* Fix feedback
* Fix feedback
* Fix test
* Apply suggestions from code review
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
* Update config_flow.py
* Update config_flow.py
* Update config_flow.py
* Update homeassistant/components/lastfm/config_flow.py
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
* Add tests
* Cleanup
* Update config_flow.py
* Update config_flow.py
* Update config_flow.py
* Fix test
* Fix feedback
* Codeowner lastfm
* Fix feedback
* Fix feedback
* Parametrize errors
* Parametrize errors
* Parametrize errors
* Finish tests
---------
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
pycsspeechtts uses the requests library, but Microsoft TTS previously
caught HTTPException from the standard library. This is changed to
catch requests.HTTPError and return `(None, None)` consistent with
other TTS integrations. This will properly raise HomeAssistantError
for display in the frontend.
Follow up to PR #92215 which adds tests for Microsoft TTS.
* Update Microsoft TTS supported languages
`script.microsoft_tts` scrapes Microsoft Azure documentation for
the list of supported languages and saves them to
`homeassistant.generated.microsoft_tts` for use in the component.
This adds support for more TTS languages, like fa-ir (Persian).
* Improve xpath query for Microsoft TTS languages
* Remove asserts for Microsoft TTS languages
* Add more tests for Microsoft TTS languages