Commit Graph

1727 Commits (cf7acb5ae87076010ca533ac107e388e3d0bc44d)

Author SHA1 Message Date
Robert Resch 4d96ed4c68
Update modified_at datetime on storage collection changes (#125218) 2024-09-04 15:05:51 +02:00
Erik Montnemery d6bd4312ab
Add explaining comments in cv.template tests (#125081) 2024-09-03 15:34:31 +02:00
Erik Montnemery cf10549df4
Restore unnecessary assignment of Template.hass in event helper (#125143) 2024-09-03 15:25:35 +02:00
Erik Montnemery 851600630c
Log deprecation warning when `template.Template` is created without `hass` (#125142)
* Log deprecation warning when template.Template is created without hass

* Improve docstring
2024-09-03 14:28:33 +02:00
Artur Pragacz fb27297df9
Fix area registry indexing when there is a name collision (#125050) 2024-09-02 09:23:07 -10:00
Erik Montnemery df4bd721b5
Deprecate template.attach (#124843) 2024-09-02 15:33:10 +02:00
Erik Montnemery 114e254aa6
Don't raise when registering entity service with invalid schema (#125057)
* Don't raise when registering entity service with invalid schema

* Update homeassistant/helpers/service.py

Co-authored-by: Robert Resch <robert@resch.dev>

---------

Co-authored-by: Robert Resch <robert@resch.dev>
2024-09-02 14:20:50 +02:00
G Johansson 78cf7dc873
New template merge_response (#114204)
* New template merge_response

* Extending

* Extend comment

* Update

* Fixes

* Fix comments

* Mods

* snapshots

* Fixes from discussion
2024-09-02 08:13:10 +02:00
J. Nick Koston 0a9e20615e
Limit maximum template render output to 256KiB (#124946)
* Limit maximum template render output to 256KiB

fixes #124931

256KiB is likely to still block the event loop for an unreasonable amont of
time but its likely someone is using the template engine for large
blocks of data so we want a limit which still allows that but has
a reasonable safety to prevent the system from crashing down

* Update homeassistant/helpers/template.py
2024-08-30 22:33:57 +02:00
Erik Montnemery c772c4a2d5
Allow specifying icons for service sections (#124656)
* Allow specifying icons for service sections

* Improve kitchen_sink example
2024-08-28 11:15:26 +02:00
Erik Montnemery 55c42fde88
Improve validation of entity service schemas (#124102)
* Improve validation of entity service schemas

* Update tests/helpers/test_entity_platform.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-08-27 19:05:49 +02:00
Petro31 5d64155bb6
Add zip to template engine (#122460)
* add zip to template engine

* fix doc strings
2024-08-22 19:11:08 +02:00
Erik Montnemery 533442f33e
Add async friendly helper for validating config schemas (#123800)
* Add async friendly helper for validating config schemas

* Improve docstrings

* Add tests
2024-08-17 11:01:49 +02:00
epenet 56b4a7f291
Add missing hass type in tests/helpers (#124039) 2024-08-16 17:09:12 +02:00
Erik Montnemery 14a3217d7e
Improve entity platform tests (#124051) 2024-08-16 15:08:37 +02:00
Erik Montnemery 799e95c1bd
Do sanity check in EntityComponent.async_register_entity_service schema (#124029)
* Do sanity check in EntityComponent.async_register_entity_service schema

* Improve test
2024-08-16 13:39:25 +02:00
Erik Montnemery f9ade788eb
Do sanity check EntityPlatform.async_register_entity_service schema (#123058)
* Do a sanity check of schema passed to EntityPlatform.async_register_entity_service

* Only attempt to check schema of Schema

* Handle All/Any wrapped in schema

* Clarify comment

* Apply suggestions from code review

Co-authored-by: Robert Resch <robert@resch.dev>

---------

Co-authored-by: Robert Resch <robert@resch.dev>
2024-08-16 10:01:12 +02:00
Erik Montnemery e1a0a855d5
Support None schema in EntityComponent.async_register_entity_service (#123867) 2024-08-14 11:44:38 +02:00
Erik Montnemery 7063541733
Support None schema in EntityPlatform.async_register_entity_service (#123064) 2024-08-14 10:46:29 +02:00
Erik Montnemery 78f7b3340d
Remove unnecessary assignment of Template.hass from event helper (#123777) 2024-08-13 12:09:30 +02:00
Joost Lekkerkerker 13b12a7657
Clean up codespell words (#123541) 2024-08-10 18:28:01 +02:00
epenet ad26db7dc8
Replace pylint broad-exception-raised rule with ruff (#123021) 2024-08-02 12:24:03 +02:00
Denis Shulyaka ed6d6575d7
Add aliases to script llm tool description (#122380)
* Add aliases to script llm tool description

* Also add name
2024-08-02 08:05:06 +02:00
karwosts 3df78043c0
Add enable_millisecond to duration selector (#122821)
* Add enable_milliseconds to duration selector.

* One more test
2024-07-31 16:13:05 +02:00
Franck Nijhof 8b96c7873f
Rename 'service' to 'action' in automations and scripts (#122845) 2024-07-31 14:36:53 +02:00
Allen Porter f14471112d
Improve LLM tool quality by more clearly specifying device_class slots (#122723)
* Limit intent / llm API device_class slots to only necessary services and limited set of values

* Fix ruff errors

* Run ruff format

* Fix typing and improve output schema

* Fix schema and improve flattening

* Revert conftest

* Revert recorder

* Fix ruff format errors

* Update using latest version of voluptuous
2024-07-31 14:36:02 +02:00
Denis Shulyaka be24475cee
Update selector converters for llm script tools (#122830) 2024-07-30 08:24:03 -07:00
Allen Porter e5bb1b2cc6
Update LLM prompt to improve quality for local LLMs (#122746) 2024-07-29 12:04:23 +02:00
J. Nick Koston e1e64be3c9
Remigrate device_registry created_at/modified_at (#122490)
* Remigrate device_registry created_at/modified_at

Nightly current does not boot up because the device registry
will have KeyError: created_at if the previous nightly was
installed.

* reduce

* split migration per discord comments
2024-07-23 15:47:27 -05:00
Robert Resch e00f159ebe
Fix loading created_at/modified_at from entity registry store (#122486) 2024-07-23 21:15:12 +02:00
Marc Mueller da6a7ebd42
Update clientsession socket family typing (#122464) 2024-07-23 09:04:09 -05:00
Robert Resch 545514c5cd
Add created_at/modified_at to category registry (#122454) 2024-07-23 14:39:38 +02:00
Erik Montnemery 92acfc1464
Indicate database migration in /api/core/state response (#122445)
* Indicate database migration in /api/core/state response

* Change API response according to review comment

* Adjust API response

* Update test

* Add test
2024-07-23 14:13:08 +02:00
Robert Resch 0d765a27c9
Add created_at/modified_at to entity registry (#122444) 2024-07-23 13:12:29 +02:00
Robert Resch 4c853803f1
Add created_at/modified_at to device registry (#122369) 2024-07-22 19:15:23 +02:00
Denis Shulyaka 064d7261b4
Ensure script llm tool name does not start with a digit (#122349)
* Ensure script tool name does not start with a digit

* Fix test name
2024-07-22 11:11:09 +02:00
Marc Mueller a6068dcdf2
Update import locations in tests (#122216) 2024-07-20 11:16:04 +02:00
Josef Zweck f006716173
Add `async_setup` method to `DataUpdateCoordinator` (#116677)
* init

* Update homeassistant/helpers/update_coordinator.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* fix typo, ruff

* consistency with rest, test

* pylint suppression

* ruff

* ruff

* switch to one test

* add last exc

* add tests for auth & Entry Errors

* move exceptions to correct test

* Update update_coordinator.py

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* test setup call

* simplify

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
2024-07-19 14:24:25 +02:00
Robert Resch 10c084c6e0
Add created_at/modified_at to label registry (#122078) 2024-07-17 16:36:14 +02:00
Robert Resch a0f91d27a3
Add created_at/modified_at to floor registry (#122071) 2024-07-17 13:18:26 +02:00
Robert Resch 35f84f32d6
Add created_at/modified_at for area registry (#122014) 2024-07-17 09:54:06 +02:00
Joost Lekkerkerker f8ba4d41ba
Add support for adding model_id in device info (#121989) 2024-07-16 15:12:25 +02:00
Franck Nijhof a9bf12f102
Rename Services to Actions in translation strings (#121777) 2024-07-15 21:19:25 +02:00
Alan 8ff4991f07
LLM to handle int attributes (#121037) 2024-07-06 11:41:18 +02:00
epenet e4731c07cb
Add monkeypatch to enforce-type-hints plugin (#121051) 2024-07-05 11:35:56 +02:00
epenet fe0bafd067
Add warnings for deprecated json helpers (#121161) 2024-07-04 20:48:08 +02:00
Marc Mueller ca55986057
Import Generator from collections.abc (1) (#120914) 2024-07-01 11:51:51 +02:00
Joost Lekkerkerker 03c6e0c55f
Fix SIM300 (#120725) 2024-06-28 10:46:02 +02:00
Erik Montnemery 8de771de96
Rename async_track_state_reported_event to async_track_state_report_event (#120637)
* Rename async_track_state_reported_event to async_track_state_report_event

* Update tests
2024-06-27 13:45:15 +02:00
Erik Montnemery 3e9b57cc07
Don't allow updating a device to have no connections or identifiers (#120603)
* Don't allow updating a device to have no connections or identifiers

* Move check to the top of the function
2024-06-27 09:26:31 +02:00
dougiteixeira 617ab48fa9
Address device helper review comments (#120615)
* Address review comments from #119761

* Address review comments from #119761

* Address review comments from #119761

* Remove reference from config entry
2024-06-27 08:50:20 +02:00
J. Nick Koston a5a631148e
Add async_track_state_reported_event to fix integration performance regression (#120622)
split from https://github.com/home-assistant/core/pull/120621
2024-06-26 23:04:27 -04:00
Erik Montnemery 9bbeb5d608
Add primary_config_entry attribute to device registry entries (#119959)
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Robert Resch <robert@resch.dev>
2024-06-26 12:26:24 +02:00
Michael Hansen d3ceaef098
Allow timer management from any device (#120440) 2024-06-26 09:06:56 +02:00
Erik Montnemery 75c7ae7c69
Support in service descriptions for input sections (#116100) 2024-06-25 20:00:48 +02:00
Erik Montnemery d4e93dd01d
Validate new device identifiers and connections (#120413) 2024-06-25 19:17:54 +02:00
Denis Shulyaka 2386ed3830
Add script llm tool (#118936)
* Add script llm tool

* Add tests

* More tests

* more test

* more test

* Add area and floor resolving

* coverage

* coverage

* fix ColorTempSelector

* fix mypy

* fix mypy

* add script reload test

* Cache script tool parameters

* Make custom_serializer a part of api

---------

Co-authored-by: Michael Hansen <mike@rhasspy.org>
2024-06-25 10:43:26 -05:00
Erik Montnemery 6fb400f76b
Add test of get_all_descriptions resolving features (#120384) 2024-06-25 09:47:43 +02:00
Paulus Schoutsen 19f97a3e53
LLM to handle decimal attributes (#120257) 2024-06-23 17:09:57 -04:00
Paulus Schoutsen bc45dcbad3
Add template config_entry_attr function (#119899)
* Template config_entry_attr function

* Complete test coverage

* Improve readability
2024-06-22 21:51:09 -04:00
G Johansson 5ddda14e59
Remove deprecated (moved) helpers from helpers.__init__ (#120172) 2024-06-22 20:55:03 +02:00
dougiteixeira 6e32a96ff3
Add the ability to bind the template helper entity to a device (#117753) 2024-06-22 12:45:06 +02:00
epenet 648ef94888
Improve type hints in core helper tests (#120096) 2024-06-21 15:43:27 +02:00
dougiteixeira a8ba22f6bb
Add device linking and stale device link clean up helpers (#119761) 2024-06-21 14:46:39 +02:00
epenet e2a34d209f
Improve type hints in Config entry oauth2 tests (#120090) 2024-06-21 14:44:28 +02:00
G Johansson 127af149ca
Remove legacy template hass config option (#119925) 2024-06-21 12:53:55 +02:00
epenet dc6c1f4e87
Add MockPlatform type hints in tests (#120012)
* Add MockPlatform type hints in tests

* Remove useless code

* Improve

* Revert "Improve"

This reverts commit 9ad04f9255.
2024-06-21 11:04:15 +02:00
Erik Montnemery 0ca3f25c57
Add WS command for subscribing to storage collection changes (#119481) 2024-06-18 16:15:42 +02:00
Paulus Schoutsen eb89ce47ea
Inline primary integration (#119860) 2024-06-18 08:08:08 +02:00
Paulus Schoutsen 836abe68c7
Track primary integration (#119741)
* Track primary integration

* Update snapshots

* More snapshots updated

* Uno mas

* Update snapshot
2024-06-16 13:26:06 -04:00
tronikos 6b8bddf6e3
Make remaining time of timers available to LLMs (#118696)
* Include speech_slots in IntentResponse.as_dict

* Populate speech_slots only if available

* fix typo

* Add test

* test all fields

* Fix another test

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-06-14 20:47:41 +02:00
epenet 01be5d5f6b
Move fixtures to decorators in core tests (#119675) 2024-06-14 13:32:42 +02:00
Erik Montnemery 003f216820
Rename collection.CollectionChangeSet to collection.CollectionChange (#119532) 2024-06-14 08:54:37 +02:00
epenet 9f41133bbc
Add missing argument type to core tests (#119667) 2024-06-14 08:42:01 +02:00
epenet 38a6e666a7
Add missing return type to some test functions (#119665) 2024-06-14 08:26:45 +02:00
epenet ca8d3e0c83
Ignore unnecessary-lambda warnings in tests (#119564) 2024-06-13 16:58:41 +02:00
Erik Montnemery 9f322b20d1
Use send_json_auto_id in some collection tests (#119570)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2024-06-13 16:04:32 +02:00
epenet 20817955af
Fix bad-chained-comparison pylint warning in tests (#119477) 2024-06-12 12:35:55 +02:00
epenet abb8c58b87
Fix consider-using-tuple pylint warnings in core tests (#119463) 2024-06-12 12:35:01 +02:00
epenet c70cfbb535
Fix arguments-renamed pylint warning in tests (#119473) 2024-06-12 12:25:29 +02:00
epenet 7d631c28a6
Ignore attribute-defined-outside-init pylint warnings in tests (#119470) 2024-06-12 12:22:31 +02:00
epenet 2a7e78a80f
Ignore broad-exception-raised pylint warnings in tests (#119468) 2024-06-12 12:21:41 +02:00
epenet 7388271689
Fix unspecified-encoding warnings in tests (#119405) 2024-06-11 17:58:40 +02:00
Erik Montnemery 8620bef5b0
Support shared keys starting with period in services.yaml (#118789) 2024-06-11 16:31:19 +02:00
epenet fce4fc663e
Fix import-outside-toplevel pylint warnings in core tests (#119394) 2024-06-11 16:10:34 +02:00
Erik Montnemery 904b89df80
Allow importing typing helper in core files (#119377)
* Allow importing typing helper in core files

* Really fix the circular import

* Update test
2024-06-11 13:48:12 +02:00
epenet 650cf13bca
Improve type hints in aiohttp_client helper tests (#119300) 2024-06-10 20:31:19 +02:00
epenet eb6af2238c
Improve type hints in registry helper tests (#119302) 2024-06-10 20:25:34 +02:00
epenet 6733f86c61
Use service_calls fixture in helper tests (#119275)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-06-10 14:57:34 +02:00
Sid 721b2c2ca8
Enable Ruff PT012 (#113957) 2024-06-08 17:59:08 +02:00
Paulus Schoutsen c49ca5ed56
Ensure intent tools have safe names (#119144) 2024-06-08 17:53:47 +02:00
Erik Montnemery 6c15351c18
Add support for common references in strings.json (#118783)
* Add support for common references in strings.json

* Update tests
2024-06-07 20:59:26 +02:00
paulusbrand 624017a0f9
Add template Base64 decode encoding parameter (#116603)
Co-authored-by: Robert Resch <robert@resch.dev>
2024-06-07 17:01:35 +02:00
J. Nick Koston 62b1bde0e8
Only entity verify state writable once after success unless hass is missing (#118896) 2024-06-06 11:46:44 -05:00
Marc Mueller 279483ddb0
Import Generator from typing_extensions (2) (#118989) 2024-06-06 17:24:22 +02:00
J. Nick Koston 475c20d529
Always do thread safety check when writing state (#118886)
* Always do thread safety check when writing state

Refactor the 3 most common places where the thread safety check
for the event loop to be inline to make the check fast enough
that we can keep it long term. While code review catches most
of the thread safety issues in core, some of them still make
it through, and new ones keep getting added. Its not possible
to catch them all with manual code review, so its worth the
tiny overhead to check each time.

Previously the check was limited to custom components
because they were the most common source of thread
safety issues.

* Always do thread safety check when writing state

Refactor the 3 most common places where the thread safety check
for the event loop to be inline to make the check fast enough
that we can keep it long term. While code review catches most
of the thread safety issues in core, some of them still make
it through, and new ones keep getting added. Its not possible
to catch them all with manual code review, so its worth the
tiny overhead to check each time.

Previously the check was limited to custom components
because they were the most common source of thread
safety issues.

* async_fire is more common than expected with ccs

* fix mock

* fix hass mocking
2024-06-05 23:41:55 -04:00
Paulus Schoutsen 52ad90a68d
Include script description in LLM exposed entities (#118749)
* Include script description in LLM exposed entities

* Fix race in test

* Fix type

* Expose script

* Remove fields
2024-06-04 11:18:07 -04:00
Paulus Schoutsen bdcfd93129
Automatically fill in slots based on LLM context (#118619)
* Automatically fill in slots from LLM context

* Add tests

* Apply suggestions from code review

Co-authored-by: Allen Porter <allen@thebends.org>

---------

Co-authored-by: Allen Porter <allen@thebends.org>
2024-06-03 10:36:41 -04:00
epenet 37fc16d7b6
Fix incorrect `patch` type hint in main conftest (#118461) 2024-06-02 15:34:30 +02:00
J. Nick Koston 8f94205014
Include a traceback for non-strict event loop blocking detection (#118620) 2024-06-02 06:36:25 -04:00