1
0
mirror of https://github.com/home-assistant/core.git synced 2025-07-28 07:37:34 +00:00

168 Commits

Author SHA1 Message Date
Marc Mueller
238b488642
Use assignment expressions 03 () 2021-10-17 20:08:11 +02:00
Erik Montnemery
2b37943355
Don't add indirectly referenced config entities to service calls () 2021-10-15 08:46:43 -07:00
Marc Mueller
77ee72cbb9
Import Callable from collections.abc (1) () 2021-09-29 16:32:11 +02:00
Marc Mueller
f6b162bc39
Add pylint CodeStyle extension () 2021-07-19 06:57:06 -07:00
Erik Montnemery
abd6f739e8
Pylint fix () 2021-05-25 10:53:18 -07:00
Erik Montnemery
7b5e63132c
Prevent parallel reload of automations () 2021-05-25 08:50:50 -07:00
Ruslan Sayfutdinov
391b2f8ccd
Add missing return type in Core constructors () 2021-05-20 18:53:29 +03:00
Marc Mueller
c07646db5d
Update typing syntax ()
* Update typing syntax

* Replace typing imports with ones from collections where possible

* Changes after review
2021-04-20 17:40:41 +02:00
Tobias Sauerwein
9d4ad1821e
Fix logic of entity id extraction ()
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-14 14:12:26 +02:00
Franck Nijhof
4e3c12883e
Allow templatable service target to support scripts () 2021-04-01 13:10:01 -07:00
Franck Nijhof
38d14702fa
Remove HomeAssistantType alias from helpers () 2021-03-27 12:55:24 +01:00
Marc Mueller
4cb7718192
Update typing 16 () 2021-03-18 22:58:19 +01:00
J. Nick Koston
08db262972
Add a service to reload config entries that can easily be called though automations () 2021-03-17 21:27:21 -07:00
Marc Mueller
6fb2e63e49
Update typing 02 () 2021-03-17 18:34:19 +01:00
Ville Skyttä
dc880118a4
Lint suppression cleanups ()
* Unused pylint suppression cleanups

* Remove outdated pylint bug references

* Add flake8-noqa config and note to run it every now and then

* Add codes to noqa's

* Unused noqa cleanups
2021-03-02 09:02:04 +01:00
Franck Nijhof
42fd3be0e8
Add template support to service targets ()
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-02-23 22:46:00 -08:00
Bram Kragten
afa91e886b
Add description to tts and notify services ()
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-02-23 14:29:57 +01:00
Franck Nijhof
c8ffac20b9
Add name to services () 2021-02-22 16:26:46 +01:00
Anders Melchiorsen
9f4874bb81
Explicitly create_task for asyncio.wait () 2021-02-20 19:57:46 +01:00
Bram Kragten
6986fa4eb6
Add target to services.yaml ()
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-02-16 09:35:27 +01:00
Franck Nijhof
9b7c39d20b
Postponed evaluation of annotations in core ()
* Postponed evaluation of annotations in core

* Remove unneeded future
2021-02-12 10:58:20 +01:00
Ville Skyttä
a6358430b4
Fix deprecated asyncio.wait use with coroutines ()
https://docs.python.org/3/library/asyncio-task.html#asyncio-example-wait-coroutine
2021-02-10 14:16:58 +01:00
Bram Kragten
4b493c5ab9
Add target to service call API ()
* Add target to service call API

* Fix _async_call_service_step

* CONF_SERVICE_ENTITY_ID overrules target

* Move merging up before processing schema

* Restore services.yaml

* Add test
2021-02-10 12:42:28 +01:00
tkdrob
c2302784c2
Use core constants for helpers () 2021-02-08 22:53:17 +01:00
Ville Skyttä
82607977ef
Various type hint improvements () 2021-02-08 11:59:46 +01:00
Ville Skyttä
1c8fbc7e6a
Upgrade codespell to 2.0.0 ()
* Upgrade codespell to 2.0.0

* Fix newly found spelling errors
2020-12-31 19:14:07 +01:00
Paulus Schoutsen
cf5be049b3
Warn when referencing missing devices/areas () 2020-12-01 08:01:27 +01:00
Paulus Schoutsen
0de9e8e952
Allow specifying device_id as target () 2020-11-30 14:27:02 +01:00
Paulus Schoutsen
dd513147a5
Add a service target () 2020-11-28 23:33:32 +01:00
Paulus Schoutsen
d34753473d
Use run_job for service helper () 2020-11-27 16:12:39 +01:00
Erik Montnemery
a5e5c5c7e6
Exclude disabled entities from async_entries_for_device () 2020-11-27 09:03:44 +01:00
Paulus Schoutsen
edf70e9f06
Make input_datetime better handle timezones ()
* Make input_datetime better handle timezones

* Improve test coverage

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Revert change to time format

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-11-26 20:20:10 +01:00
J. Nick Koston
94bf55e29b
Limit concurrency of async_get_integration to avoid creating extra threads ()
* Limit concurrency of async_get_integration to avoid creating extra threads

Since async_get_integration is waiting on the disk most of the time
it would end up creating many new threads because the disk could
not deliver the data in time.

* pylint
2020-11-10 21:34:54 -10:00
Robert Svensson
e06c8009e1
Add area id to entity registry ()
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-10-24 21:25:28 +02:00
J. Nick Koston
4a0d18ccd8
Avoid overloading the executor with service.yaml loads () 2020-10-21 22:24:50 +02:00
Ville Skyttä
167490b71c
Complete helpers.service type hints ()
* Complete helpers.service type hints

* Update homeassistant/helpers/service.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Handle None entity.supported_features
2020-09-20 12:03:58 +03:00
Franck Nijhof
181709f3d2
Allow templates in data & service parameters (making data_template & service_template obsolete) () 2020-08-24 16:21:48 +02:00
Ville Skyttä
802c556e82
State and service related type hint improvements ()
* Improve type hint of service_func to register

* Add named type for state values

* Narrow some unnecessarily broad state type hints
2020-08-17 15:02:43 -04:00
Franck Nijhof
53545c984b
Log lines do not end with a full stop () 2020-07-05 23:04:19 +02:00
Ville Skyttä
0c5ca3084e
Add and fix type hints ()
* Fix exceptions.Unauthorized.permission type

* Use auth.permission consts more

* Auth typing improvements

* Helpers typing improvements

* Calculate self.state only once
2020-06-06 20:34:56 +02:00
Robert Chmielowiec
d21cfd869e
Fix service registration supported features check () 2020-05-23 18:11:51 +02:00
Paulus Schoutsen
87801d8aca
Minor helpers cleanup () 2020-04-28 14:31:25 -07:00
Paulus Schoutsen
26f78132ae
Fix circular import () 2020-04-19 14:41:52 -07:00
Ville Skyttä
267d98b5eb
Type hint improvements () 2020-04-17 11:33:58 -07:00
Phil Bruckner
5f5cb8bea8
Add support for simultaneous runs of Script helper - Part 2 ()
* Add limit parameter to service call methods

* Break out prep part of async_call_from_config for use elsewhere

* Minor cleanup

* Fix improper use of asyncio.wait

* Fix state update

Call change listener immediately if its a callback

* Fix exception handling and logging

* Merge Script helper if_running/run_mode parameters into script_mode

- Remove background/blocking _ScriptRun subclasses which are no longer needed.

* Add queued script mode

* Disable timeout when making fully blocking script call

* Don't call change listener when restarting script

This makes restart mode behavior consistent with parallel & queue modes.

* Changes per review

- Call all script services (except script.turn_off) with no time limit.
- Fix handling of lock in _QueuedScriptRun and add comments to make it
  clearer how this code works.

* Changes per review 2

- Move cancel shielding "up" from _ScriptRun.async_run to Script.async_run
  (and apply to new style scripts only.) This makes sure Script class also
  properly handles cancellation which it wasn't doing before.
- In _ScriptRun._async_call_service_step, instead of using script.turn_off
  service, just cancel service call and let it handle the cancellation
  accordingly.

* Fix bugs

- Add missing call to change listener in Script.async_run
  in cancelled path.
- Cancel service task if ServiceRegistry.async_call cancelled.

* Revert last changes to ServiceRegistry.async_call

* Minor Script helper fixes & test improvements

- Don't log asyncio.CancelledError exceptions.
- Make change_listener a public attribute.
- Test overhaul
  - Parametrize tests.
  - Use common test functions.
  - Mock timeout so tests don't need to wait for real time to elapse.
  - Add common function for waiting for script action step.
2020-03-11 16:34:50 -07:00
Paulus Schoutsen
6a21afa2a8
Improve script validation () 2020-03-05 11:44:42 -08:00
Paulus Schoutsen
12de3f1e47 Clean up frontend services and events ()
* Clean up frontend services and events

* Fix bug in core instead

* Add test that core works correctly with callback marked async funcs
2020-02-09 19:47:16 -08:00
Paulus Schoutsen
e970177eeb
Use entity.async_request_call in service helper ()
* Use entity.async_request_call in service helper

* Clean up semaphore handling

* Address comments

* Simplify call entity service helper

* Fix stupid rflink test
2020-02-04 15:30:15 -08:00
Paulus Schoutsen
f41623ca64
Log warning when entities referenced in service call not found ()
* Raise entities not found error

* Make it a warning, not an error

* Add support for MATCH_ENTITY_NONE

* Fix lint

* Fix tests
2020-02-04 14:42:07 -08:00
Paulus Schoutsen
7687ac8b91
Fix service annotations ()
* Fix service annotations

* Filter area_id from service data

* Fix services not accepting entities

* Typo
2020-02-02 15:36:39 -08:00