Commit Graph

1871 Commits (cab8a59be48a027e2da9ed96aa782f7018d91b59)

Author SHA1 Message Date
Erik Montnemery 6d9411b8a1
Improve trigger platform typing (#88511)
* Improve trigger platform typing

* Tweak docstring

* Revert "Tweak docstring"

This reverts commit c31f790fc3.

* Tweak docstring
2023-02-22 11:59:53 +01:00
J. Nick Koston 8806c3dd20
Speed up loading non-english language translations (#88553)
Speed up loading non-english languages

We called async_get_integrations in each gathered task
instead of once for both languages we were loading
2023-02-21 21:18:33 -05:00
Erik Montnemery 0c4c95394e
Add WS command config/entity_registry/list_for_display (#87787)
* Add WS command config/entity_registry/list_for_display

* Make more keys in the display dict optional

* Move disabled_by check to ws command handler

* Hide hidden_by if not hidden

* Use send_json_auto_id in the new test

* Don't include entities which have no data needed for display

* Include platform for entries with translation_key
2023-02-21 20:40:39 +01:00
Erik Montnemery 30ebc6604f
Invert trigger._PLATFORM_ALIASES (#88503) 2023-02-20 22:14:41 +01:00
Erik Montnemery cc4a179ca8
Support templating for in state conditions (#88411) 2023-02-20 18:57:00 +01:00
Erik Montnemery 83e5bf7ae8
Use entity_sources to determine integration in recorder platforms (#88382) 2023-02-18 07:21:41 -06:00
Michael Hansen dc30210237
Use blocking in intent service calls and verify results (#88035)
* Use blocking in service calls and verify result

* Block for 2 seconds and update states after

* Small timeout in service call to allow exceptions

* Move sun test
2023-02-16 14:01:41 -05:00
epenet ba23816a0c
Inverse json import logic (#88099)
* Fix helpers and util

* Adjust components

* Move back errors

* Add report

* mypy

* mypy

* Assert deprecation messages

* Move test_json_loads_object

* Adjust tests

* Fix rebase

* Adjust pylint plugin

* Fix plugin

* Adjust references

* Adjust backup tests
2023-02-16 11:37:57 +01:00
J. Nick Koston c0e22be7a8
Fix allowing identical flows to be created before startup (#88213)
The check for identical flows only worked after
the start event. We now check against pending
flows as well

If startup took a while we could end up
with quite the thundering herd
2023-02-15 21:36:00 -05:00
Franck Nijhof 9030ca05b1
Enable Ruff SIM118 (#87772) 2023-02-15 12:39:12 +01:00
epenet a1b7842df2
Fix incorrect reference to json WriteError (#88161) 2023-02-15 10:40:26 +01:00
J. Nick Koston e41af8928b
Restore original aiohttp cancelation behavior (#88046) 2023-02-13 22:00:36 -06:00
J. Nick Koston ac97097167
Speed up template lru_caches (#87942)
By avoiding the argument unpacking these functions are faster
and reduce stack overhead
2023-02-12 14:13:13 -05:00
J. Nick Koston e19f8595fa
Small cleanups to template helper (#87944)
- reduce dict lookups
- avoid split_entity_id
2023-02-12 14:11:48 -05:00
J. Nick Koston aa8927c98c
Speed up loops with jinja templates (#87945) 2023-02-12 18:40:55 +01:00
Michael Hansen 8cd5106c15
Add HassGetState intent for queries (#87808)
* Use names instead of entity ids for list

* Add HassGetState for Assist queries

* Add unknown area to test

* Clean up and test device classes
2023-02-09 23:39:46 -05:00
Erik Montnemery cc564026fa
Move EntityCategory to homeassistant.const (#87792)
* Move EntityCategory to homeassistant.const

* Fix more imports
2023-02-09 20:15:37 +01:00
Erik Montnemery 8ccb3b7151
Fix circular import loop in homeassistant/helpers/entity.py (#87780)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-02-09 19:15:53 +01:00
Erik Montnemery 2d2ff19949
Round value in state_with_unit template function (#87619) 2023-02-09 12:54:59 +01:00
Erik Montnemery 93dafefd96
Include entity options in RegistryEntry.as_partial_dict (#87539) 2023-02-08 08:32:46 -05:00
epenet a202588fd2
Add return type to json_loads (#85672)
* Add JSON type definitions

* Sample use

* Keep mutable for a follo-up PR (avoid dead code)

* Use list/dict

* Remove JsonObjectType

* Remove reference to Union

* Cleanup

* Improve rest

* Rename json_dict => json_data

* Add docstring

* Add type hint to json_loads

* Add cast

* Move type alias to json helpers

* Cleanup

* Create and use json_loads_object

* Make error more explicit and add tests

* Use JsonObjectType in conversation

* Remove quotes
2023-02-07 17:21:55 +01:00
Marc Mueller 42008c50f3
Enable error-code `truthy-iterable` [mypy 1.0] (#87596) 2023-02-07 11:16:22 +01:00
Marc Mueller ea4e2ab4aa
Add Self typing (4) [mypy 1.0] (#87601) 2023-02-06 22:30:22 -06:00
Marc Mueller 342b406dc0
Add Self typing (1) [mypy 1.0] (#87598) 2023-02-06 22:29:47 -06:00
Paulus Schoutsen a090652560
Use correct state in Entity repr and output similar value to State class (#87519)
* Use correct state in Entity repr

* Test Entity.__repr__

* Align with State class
2023-02-06 13:35:36 -05:00
krahabb 899342d391
Refactor async_call_later to improve performance and reduce conversion loss (#87117)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-02-05 12:04:38 -06:00
Franck Nijhof fcb612cd6f
Collection of code styling tweaks (#87344) 2023-02-03 23:51:27 +01:00
Erik Montnemery 4d4fb2477d
Optionally update sensor units when unit system is changed (#83851) 2023-02-03 16:30:50 +01:00
epenet 810367b757
Fix `can not` typo (#87254) 2023-02-03 11:37:16 +01:00
Franck Nijhof b8a1f87073
Fix schema typing on async_register_entity_service (#87250) 2023-02-03 11:25:02 +01:00
Karlie Meads e40a9822f5
Fix disabled condition within an automation action (#87213)
fixes undefined
2023-02-02 22:35:02 +01:00
Franck Nijhof 5e81d28116
Update black to 23.1.0 (#87188) 2023-02-02 18:35:24 +01:00
Marc Mueller 07a3046d11
Update pylint to 2.16.0 (#87083) 2023-02-02 12:49:01 +01:00
Michael Hansen be69c81db5
Prioritize entity names over area names in Assist matching (#86982)
* Refactor async_match_states

* Check entity name after state, before aliases

* Give entity name matches priority over area names

* Don't force result to have area

* Add area alias in tests

* Move name/area list creation back

* Clean up PR

* More clean up
2023-01-30 23:46:25 -05:00
Michael Hansen adeaf746ec
Use device area id in intent matching (#86678)
* Use device area id when matching

* Normalize whitespace in response

* Add extra test entity
2023-01-26 09:48:49 -06:00
Erik Montnemery fea30c1ce9
Terminate strings at NUL when recording states and events (#86687) 2023-01-26 11:11:03 +01:00
Paulus Schoutsen df0fc30695
Fix oauth2 error (#86634) 2023-01-25 20:50:16 +01:00
Vaarlion 3007e0259d
Add a `contains` jinja filter and test (#86390) 2023-01-25 11:51:47 +01:00
Michael Hansen ea95abcb30
Use intent responses from home-assistant-intents (#86484)
* Use intent responses from home_assistant_intents

* Use error responses from home_assistant_intents

* Remove speech checks for intent tests (set by conversation now)

* Bump hassil and home-assistant-intents versions

* Use Home Assistant JSON reader when loading intents

* Remove speech checks for light tests (done in agent)

* Add more tests for code coverage

* Add test for reloading on new component

* Add test for non-default response
2023-01-23 22:38:41 -05:00
Marc Mueller 6f94e47270
Update Union typing (6) [Py310] (#86454) 2023-01-23 15:01:07 +01:00
Marc Mueller 4f87c1f30f
Update pre-commit-config [Py310] (#86415) 2023-01-23 09:59:44 +01:00
Marc Mueller 6397138589
Update Optional typing (1) [Py310] (#86417)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-01-23 09:56:10 +01:00
Marc Mueller da35097803
Update Optional typing (2) [Py310] (#86419) 2023-01-23 09:10:05 +01:00
Marc Mueller 8abce25948
Update Union typing (4) [Py310] (#86427) 2023-01-23 09:04:40 +01:00
Marc Mueller 45b4b0e990
Import `ParamSpec` from typing [Py310] (#86413)
* Import ParamSpec from typing [Py310]

* Update additional imports
2023-01-23 07:28:43 +01:00
J. Nick Koston ca4d7634a8
Switch an `asyncio.wait_for` in the template helper to `async_timeout` (#86349)
Switch an asyncio.wait_for in the template helper to async_timeout

Eliminates the extra task when calling async_render_will_timeout
2023-01-22 00:02:03 +02:00
Franck Nijhof 79b52a2b41
Stricter pylint message control (#86154) 2023-01-20 13:47:55 +01:00
Aarni Koskela 656632f504
Fix docstring in helpers.template_entity (#86227) 2023-01-19 21:24:44 -05:00
Michael Hansen 5aca996f22
HassTurnOn/Off intents to also handle cover entities (#86206)
* Move entity/area resolution to async_match_states

* Special case for covers in HassTurnOn/Off

* Enable light color/brightness on areas

* Remove async_register from default agent

* Remove CONFIG_SCHEMA from conversation component

* Fix intent tests

* Fix light test

* Move entity/area resolution to async_match_states

* Special case for covers in HassTurnOn/Off

* Enable light color/brightness on areas

* Remove async_register from default agent

* Remove CONFIG_SCHEMA from conversation component

* Fix intent tests

* Fix light test

* Fix humidifier intent handlers

* Remove DATA_CONFIG for conversation

* Copy ServiceIntentHandler code to light

* Add proper errors to humidifier intent handlers
2023-01-19 17:15:01 -06:00
Jan Bouwhuis 25392655e7
Allow translating select selector options (#85531)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2023-01-17 16:22:19 +01:00