* LLM Assist API to ignore timer intents if device doesn't support it
* Refactor to use API instances
* Extract ToolContext class
* Limit exposed intents based on exposed entities
These functions have been stripped down to always return
the same path so there was no longer a need to have a
function for this. This is left-over cleanup from
previous refactoring.
* Add types to event tracker data
* fixes
* do not test event internals in other tests
* fixes
* Update homeassistant/helpers/event.py
* cleanup
* cleanup
* Migrate issue registry to use singleton helper
The other registries were already migrated, but since this
one had a read only flag, it required a slightly different
solution since it uses the same hass.data key
* refactor
* Use defaultdict for registry indices
defaultdict is faster and does not have to create an empty
dict that gets throw away when the key is already present
* Use defaultdict for registry indices
defaultdict is faster and does not have to create an empty
dict that gets throw away when the key is already present
* Detect incorrect exception in forwarded platforms
If an integration raises ConfigEntryError/ConfigEntryAuthFailed/ConfigEntryAuthFailed
in a forwarded platform it would affect the state of the config entry and cause it to
process unloads and setup retries in while the other platforms continued to setup
* Detect incorrect exception in forwarded platforms
If an integration raises ConfigEntryError/ConfigEntryAuthFailed/ConfigEntryAuthFailed
in a forwarded platform it would affect the state of the config entry and cause it to
process unloads and setup retries in while the other platforms continued to setup
* Update homeassistant/config_entries.py
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* adjust
* fix
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* initial commit
* Undo prompt chenges
* Move format_tool out of the class
* Only catch HomeAssistantError and vol.Invalid
* Add config flow option
* Fix type
* Add translation
* Allow changing API access from options flow
* Allow model picking
* Remove allowing HASS Access in main flow
* Move model to the top in options flow
* Make prompt conditional based on API access
* convert only once to dict
* Reduce debug logging
* Update title
* re-order models
* Address comments
* Move things
* Update labels
* Add tool call tests
* coverage
* Use LLM APIs
* Fixes
* Address comments
* Reinstate the title to not break entity name
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Add llm helper
* break out Tool.specification as class members
* Format state output
* Fix intent tests
* Removed auto initialization of intents - let conversation platforms do that
* Handle DynamicServiceIntentHandler.extra_slots
* Add optional description to IntentTool init
* Add device_id and conversation_id parameters
* intent tests
* Add LLM tools tests
* coverage
* add agent_id parameter
* Apply suggestions from code review
* Apply suggestions from code review
* Apply suggestions from code review
* Apply suggestions from code review
* Apply suggestions from code review
* Fix tests
* Fix intent schema
* Allow a Python function to be registered as am LLM tool
* Add IntentHandler.effective_slot_schema
* Ensure IntentHandler.slot_schema to be vol.Schema
* Raise meaningful error on tool not found
* Move this change to a separate PR
* Update todo integration intent
* Remove Tool constructor
* Move IntentTool to intent helper
* Convert custom serializer into class method
* Remove tool_input from FunctionTool auto arguments to avoid recursion
* Remove conversion into Open API format
* Apply suggestions from code review
* Fix tests
* Use HassKey for helpers (see #117012)
* Add support for functions with typed lists, dicts, and sets as type hints
* Remove FunctionTool
* Added API to get registered intents
* Move IntentTool to the llm library
* Return only handlers in intents.async.get
* Removed llm tool registration from intent library
* Removed tool registration
* Add bind_hass back for now
* removed area and floor resolving
* fix test
* Apply suggestions from code review
* Improve coverage
* Fix intent_type type
* Temporary disable HassClimateGetTemperature intent
* Remove bind_hass
* Fix usage of slot schema
* Fix test
* Revert some test changes
* Don't mutate tool_input
---------
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* First pass at timers
* Move to separate file
* Refactor to using events
* Add pause/unpause/status
* Add ordinal
* Add test for timed Assist command
* Fix name matching
* Fix IntentHandleError
* Fix again
* Refactor to callbacks
* is_paused -> is_active
* Rename "set timer" to "start timer"
* Move tasks to timer manager
* More fixes
* Remove assist command
* Remove cancel by ordinal
* More tests
* Remove async on callbacks
* Export async_register_timer_handler
* Allow templates for enabling automation triggers
* Test exception for non-limited template
* Use `cv.template` instead of `cv.template_complex`
* skip trigger with invalid enable template
instead of returning and thus not evaluating other triggers
* Import and cache supported feature enum flags only when needed
* Add comment aboud being loaded from executor.
---------
Co-authored-by: J. Nick Koston <nick@koston.org>
Use a dictcomp to reconstruct DeviceInfo
a dictcomp is faster than many sets on the dict by at least
25%
We call this for nearly every device in the registry at
startup
* Small speed up to setting up integration and config entries
When profiling tests, I noticed many calls to get_running_loop. In the places
where we are already in a coro, pass the existing loop so it does not have to
be looked up. I did not do this for places were we are not in a coro since there
is risk that an integration could be doing a non-thread-safe call and its better
that the code raises when trying to fetch the running loop vs the performance
improvement for these cases.
* fix merge
* missed some
* Addition of add filter
This change adds an `add` filter, the addition equivalent of the existing `multiply` filter.
* Test for add filter
* Update test_template.py
* Update tests/helpers/test_template.py
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Turn on thread safety checks in async_dispatcher_send
We keep seeing issues where async_dispatcher_send is called from
a thread which means we call the callback function on the other
side in the thread as well which usually leads to a crash
* Turn on thread safety checks in async_dispatcher_send
We keep seeing issues where async_dispatcher_send is called from
a thread which means we call the callback function on the other
side in the thread as well which usually leads to a crash
* adjust
* Refactor entity_platform polling to avoid double time fetch
Replace async_track_time_interval with loop.call_later
to avoid the useless time fetch every time the listener
fired since we always throw it away
* fix test