Commit Graph

3042 Commits (drop-ignore-missing-annotations)

Author SHA1 Message Date
J. Nick Koston 2890fc7dd2
Only create a single resolver object if there are multiple aiohttp sessions (#144090) 2025-05-02 13:43:06 -05:00
J. Nick Koston 9861bd88b9
Avoid working out suggested id in entity_platform when already registered (#144079)
If the entity is already registered, avoid trying to work
out the suggested_entity_id and suggested_object_id as
async_get_or_create will discard them anyways.
2025-05-02 11:44:38 +02:00
Allen Porter b16151ac6d
Add an LLM tool for fetching todo list items (#143777)
* Add a tool for fetching todo list items

* Simplify the todo list interface by adding an "all" status

* Update prompt to improve performance on smaller models
2025-04-30 08:49:33 -04:00
Allen Porter d924f0b1d6
Improve the live context tool prompt with additional instructions (#143746)
* Improve the live context tool prompt with additional instructions

* Fix vertical whitespace
2025-04-30 08:47:54 -04:00
Erik Montnemery 16b42cc109
Add cv.renamed (#143834) 2025-04-29 07:36:37 +02:00
Erik Montnemery cec8db173b
Remove redundant entity_id collision check in entity registry (#143660)
* Remove redundant entity_id collision check in entity registry

* Update test
2025-04-28 07:50:26 +02:00
J. Nick Koston 34d17ca458
Move state length validation to StateMachine APIs (#143681)
* Move state length validation to StateMachine async_set method

We call validate_state to make sure we do not allow any states
into the state machine that have a length>255 so we do not break
the recorder. Since async_set_internal already requires callers
to pre-validate the state, we can move the check to async_set
instead of at State object creation time to avoid needing to
check it twice in the hot path (entity write state)

* move check in async_set_internal so it only happens on state change

* no need to check if same_state
2025-04-25 21:15:15 -04:00
J. Nick Koston d61e39743b
Reduce ref counting in _async_write_ha_state (#143634)
* Reduce ref counting in _async_write_ha_state

It no longer makes sense to keep a temp reference
to entity_id and hass since the function was
refactored and there are very few accesses now.

* one more place we can reduce ref counts
2025-04-25 18:25:16 +02:00
Petro31 ff2c901930
Update trigger based template entity resolution order (#140660)
* Update trigger based template entity resolution order

* add test

* fix most comments

* Move resolution to base class

* add comment

* remove uncessary if statement

* add more tests

* update availability tests

* update logic stage 1

* phase 2 changes

* fix trigger template entity tests

* fix trigger template entities

* command line tests

* sql tests

* scrape test

* update doc string

* add rest tests

* update sql sensor _update signature

* fix scrape test constructor

* move state check to trigger_entity

* fix comments

* Update homeassistant/components/template/trigger_entity.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/helpers/trigger_template_entity.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/helpers/trigger_template_entity.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* update command_line and rest

* update scrape

* update sql

* add case to command_line sensor

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2025-04-25 13:17:25 +02:00
Erik Montnemery dc8e1773f1
Remove unused defaults from entity_registry.RegistryEntry (#143655) 2025-04-25 12:41:58 +02:00
J. Nick Koston fa0bb35e6c
Avoid creating tasks to add entities when no entities are passed (#143647)
async_add_entities would return early if no entities
were passed but its a bit cleaner to not create the
task in the first place. I noticed in py-spy that
tplink was passing empty lists frequently
which made a task and than did nothing.
2025-04-25 10:16:20 +02:00
J. Nick Koston cb0523660d
Improve error logging when state is too long (#143636) 2025-04-24 18:37:32 -10:00
J. Nick Koston bb73ecc1f4
Restore service call performance by avoiding expensive runtime cast (#143378)
Improve service call performance by avoiding expensive runtime type checking

Most of the overhead here was casting
2025-04-21 09:37:10 -04:00
MichaelMKKelly 35f9cc55f1
Fix Automation/Script: sequence within a parallel ignoring enabled flag (#142977)
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2025-04-19 11:49:05 +02:00
Marc Mueller c7290908cc
Update mypy-dev 1.16.0a8 (#143166) 2025-04-17 18:13:00 +02:00
J. Nick Koston 870350b961
Add async_has_entity_registry_updated_listeners (#142772) 2025-04-14 19:45:09 +02:00
Paul Bottein 8ec436423f
Add template function: device_name (#142683) 2025-04-14 14:30:00 +02:00
Allen Porter db043b26da
Fix quality loss for LLM conversation agent question answering (#142873)
* Fix a bug parsing a streaming response with no json

* Remove debug lines

* Fix  quality loss for LLM conversation agent question answering

* Update tests
2025-04-14 10:05:34 +02:00
Allen Porter d91528648f
Update ollama to allow selecting mutiple LLM APIs (#142445)
* Update ollama to allow selecting mutiple LLM APIs

* Update homeassistant/helpers/llm.py

* Avoid gather since these don't do I/O

---------

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2025-04-13 15:37:46 -07:00
Erik Montnemery 86622cd29d
Remove unnecessary imports of http integration (#141899)
* Remove unnecessary imports of http integration

* Check reason for test failures

* Revert "Check reason for test failures"

This reverts commit 5ccf356ab0.

* Update tests
2025-03-31 11:30:20 +01:00
J. Nick Koston 018651ff1d
Improve handling of empty iterable in async_add_entities (#141889)
* Improve handling of empty iterable in async_add_entities

We had two checks here because we were doing an empty
iterable check. If its a list we can check it directly
but if its not we need to convert it to a list to know
if its empty.

* tweaks

* tasks never used
2025-03-30 21:22:47 -04:00
John Karabudak 85d2e3d006
Fix LLM to speed up prefill (#141156)
* fix: two minor LLM changes to speed up prefill

- moved the current date/time to the end of the prompt
- started sorting all entities by last_changed

* addressed PR comments

* fixed tests

* reduced scope of try/catch in LLM prompt

* addressed more PR comments

* fixed Anthropic test

* addressed another PR comment

* fixed remainder of tests
2025-03-30 13:30:40 -07:00
J. Nick Koston c8d3fa6768
Small cleanups to the device registry (#141773)
Remove some calls to internal functions that
are now available directly on the devices
and deleted_devices objects

Remove internal functions that are no
longer used
2025-03-29 21:00:13 -10:00
J. Nick Koston 4a833fb489
Fix blocking late import of httpcore from httpx (#141771)
There is a late import that blocks the event loop
in newer version
9e8ab40369/httpx/_transports/default.py (L75)
2025-03-29 20:59:40 -10:00
alorente 63df2474a9
Fix missing response for queued mode scripts (#141460) 2025-03-28 10:47:41 +00:00
Andrii Mitnovych dea00fac3f
Get area and floor by alias (#126150)
* Add possibility to get area by alias

* Add ability to get floor by alias

* Moved alias lookup to separate function, adjusted templates.

* Changed registry to return all areas/floors with given alias

* Use normalize_name from normalized_name_base_registry
2025-03-27 16:02:47 +01:00
Franck Nijhof eb1caeb770
Add template list functions: intersect, difference, symmetric_difference, union (#141420) 2025-03-26 07:51:25 +01:00
Artur Pragacz 93561543ff
Improve code quality of condition validation (#141292)
Streamline condition validation
2025-03-24 17:21:32 +01:00
Michael e96e95c32d
Add sensor platform to backup integration (#138663)
* add sensor platform to backup integration

* adjust namings, remove system integration flag

* add first simple test

* apply review comments

* fix test

* add sensor tests

* adjustements to use backup helper

* remove obsolet async_get_manager from init

* unsubscribe from events on entry unload

* add configuration_url

* fix doc string

* fix sensor tests

* mark async_unsubscribe as callback

* set integration_type service

* extend sensor test

* set integration_type on correct integration :)

* fix after online conflict resolution

* add sensor update tests

* simplify the sensor update tests

* avoid io during tests

* Add comment

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2025-03-24 12:54:16 +01:00
Artur Pragacz 798ee60ae5
Make variables action not restricted to local scopes (#141114)
Make variables action in scripts not restricted to local scopes
2025-03-23 14:07:52 +01:00
Allen Porter 4e2dfba45f
Omit state from the Assist LLM prompts (#141034)
* Omit state from the Assist LLM prompts

* Add back the stateful prompt
2025-03-22 15:41:51 -04:00
Allen Porter a83bf4f514
Add a GetHomeState tool to return the current state of the home (#140971)
* Add a GetHomeState tool to return the current state of the home

* Fix check for exposing entities

* Add "all" to get home state description
2025-03-20 19:37:54 -07:00
Franck Nijhof d3c40939f6
Reorder template extensions (#140985) 2025-03-20 11:34:02 +01:00
Franck Nijhof c6d3928ed1
Add template function: combine (#140948)
* Add template function: combine

* Add test to take away concern raised
2025-03-20 10:29:40 +01:00
Erik Montnemery 6b9c1e17e0
Fix docstring in selector helper (#140929) 2025-03-19 16:37:07 +01:00
Stephan van Rooij 76aef5be9f
Add PKCE implementation in oauth2 helper (#139509)
* Update config_entry_oauth2_flow.py

* Specify type on request_data

* Added LocalOAuth2ImplementationWithPkce

* LocalOAuth2ImplementationWithPkce works more like specs

* fix: Adding tests for pkce flow and feedback applied

* fix last test for pkce

* Clean test_abort_if_oauth_with_pkce_rejected

* Improve assertion of code verifier and code challenge

* Break long docstrings

* Shorten docstring

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2025-03-17 14:16:52 +01:00
Jan-Philipp Benecke 7b9ea63f17
Split out yaml loading into own package (#140683)
* Split out yaml loading into library

* Code review

* Code review

* Fix check config script
2025-03-15 22:26:18 -04:00
Joost Lekkerkerker dcc63a6f2e
Bump ruff to 0.10.0 (#140541)
* Bump ruff to 0.10.0

* Bump ruff to 0.10.0

* Bump ruff to 0.10.0

* Bump ruff to 0.10.0

* Update pyproject.toml

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

* Fix

---------

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2025-03-14 12:32:50 +00:00
Franck Nijhof e8069e1c07
Add template functions: md5, sha1, sha256, sha512 (#140192) 2025-03-09 16:15:27 +02:00
Allen Porter 6675b497bd
Improve LLM tool descriptions for brightness and volume percentage (#138685)
* Improve tool descriptions for brightness and volume percentage

* Address lint errors

* Update intent.py to revert of a light

* Create explicit types to make intent slots more future proof

* Remove comments about slot type

---------

Co-authored-by: Franck Nijhof <git@frenck.dev>
2025-03-08 22:28:35 -05:00
Artur Pragacz f0c5e00cc1
Fix conversation trigger with variables (#140066) 2025-03-08 22:23:24 -05:00
Franck Nijhof 9aa8a786a5
Add template function: flatten (#140157) 2025-03-08 11:14:27 -10:00
Franck Nijhof e54febdc1e
Add template function: typeof (#140081) 2025-03-08 09:16:21 -10:00
Franck Nijhof d4f205c366
Add template function: shuffle (#140077) 2025-03-07 20:36:17 -05:00
Erik Montnemery c51e644203
Prioritize integration_domain passed to helper.frame.report_usage (#139819)
* Prioritize integration_domain passed to helper.frame.report_usage

* Update tests

* Update tests

* Improve docstring

* Rename according to suggestion
2025-03-06 13:16:50 +01:00
epenet 83dd1af6d2
Drop report method from frame helper (#139920)
* Drop report method from frame helper

* Adjust test_prevent_flooding

* Adjust test_report_missing_integration_frame

* Adjust test_report_error_if_integration

* Remove test_report
2025-03-06 11:25:22 +01:00
Erik Montnemery cc5c8bf5e3
Make helpers.frame.report_usage work when called from any thread (#139836)
* Make helpers.frame.report_usage work when called from any thread

* Address review comments, update tests

* Add test

* Update test

* Update recorder test

* Update tests
2025-03-05 19:37:34 +01:00
karwosts fa40d02a07
Add model_id filter to device selector (#135646)
* Add model_id filter to device selector

* Rerun CI
2025-03-02 21:15:37 +01:00
Michael Hansen 49c27ae7bc
Check area temperature sensors in get temperature intent (#139221)
* Check area temperature sensors in get temperature intent

* Fix candidate check

* Add new code back in

* Remove cruft from climate
2025-02-28 13:02:30 -05:00
Michael Hansen fca19a3ec1
Move climate intent to homeassistant integration (#139371)
* Move climate intent to homeassistant integration

* Move get temperature intent to intent integration

* Clean up old test
2025-02-28 10:25:38 -05:00