Commit Graph

100 Commits (c048b840fc70d0b7b069141710e9aa340bd64428)

Author SHA1 Message Date
Erik Montnemery d90ee85118
Allow conditions to be implemented in platforms (#88509)
* Allow conditions to be implemented in platforms

* Update tests

* Tweak typing

* Rebase fixes
2023-02-23 22:30:51 -05:00
Erik Montnemery cc4a179ca8
Support templating for in state conditions (#88411) 2023-02-20 18:57:00 +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
Karlie Meads 156307f3f2
Fix logic of disabled condition for "OR" (#79718) 2023-01-16 21:08:09 +01:00
Franck Nijhof 06a35fb7db
Code styling tweaks to core helpers (#85441) 2023-01-08 13:44:09 -10:00
Franck Nijhof d4f69a3652
String formatting and max line length - Part 7 (#84532)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-12-27 11:18:56 +01:00
Janick Bergeron f21a004aa9
Fix before sunrise OR after sunset condition (#76143)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Ben Randall <veleek@gmail.com>
2022-10-14 13:11:10 +02:00
Malte Franken 638992f9c4
Make zone condition more robust by ignoring unavailable and unknown entities (#72751)
* ignore entities with state unavailable or unknown

* test for unavailable entity
2022-05-31 11:34:52 -07:00
Franck Nijhof e04fef3c2d
Allow disabling specific triggers/actions/conditions (#70082) 2022-04-15 09:33:09 -07:00
Franck Nijhof 7087020283
Allow any entity to match state condition (#69763) 2022-04-11 10:53:42 -07:00
Erik Montnemery cd25769667
Rename async_resolve_entity_ids to async_validate_entity_ids (#67603) 2022-03-04 09:51:53 +01:00
Paulus Schoutsen c2e62e4d9f
Re-org device automations (#67064)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-02-22 13:15:16 -08:00
Marc Mueller 1a247f7d1b
Improve `device_automation` typing (#66621) 2022-02-17 22:08:43 +01:00
Marc Mueller 12757a8cd2
Update typing - collections.abc (1) (#63933)
* Update typing - collections.abc (1)

* Additional typing updates
2022-01-12 07:56:35 +01:00
Marc Mueller 240c9979c7
Move `disallow-any-generics` to mypy.ini (#63917) 2022-01-11 13:33:25 -08:00
Marc Mueller 01baa20671
Fix implicit reexport [dt_util] (#63829) 2022-01-10 16:31:23 +01:00
Marc Mueller c384596899
Use SensorDeviceClass in `sensor` and `helpers` packages (#63452) 2022-01-05 14:59:51 +01:00
Tobias Sauerwein 2c904c0974
Bump mypy to 0.930 (#62642)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2021-12-27 17:55:17 +01:00
Ruslan Sayfutdinov 55f4962c06
Fix pylint plugin which checks relative imports (#62693) 2021-12-23 11:14:47 -08:00
Erik Montnemery e48f567176
Wrap shorthand template conditions during schema validation (#62485) 2021-12-21 17:20:15 +01:00
Ville Skyttä 334c6c5c02
Make device automation type an enum (#62354) 2021-12-20 19:16:30 +01:00
Erik Montnemery 17dc609363
Correct validation of conditions in scripts and automations (#60890)
* Correct validation of conditions in scripts and automations

* Fix test
2021-12-03 09:08:28 -08:00
Erik Montnemery 0e3bc21d54
Teach state and numeric_state conditions about entity registry ids (#60841) 2021-12-02 14:55:12 -08:00
Erik Montnemery caf5ee2fab
Remove optional validation when creating conditions (#60481) 2021-11-28 14:54:07 +01:00
Erik Montnemery ff837c736e
Return False from state conditions on missing attributes (#59405) 2021-11-09 11:34:18 +01:00
Marc Mueller 238b488642
Use assignment expressions 03 (#57710) 2021-10-17 20:08:11 +02:00
Ville Skyttä 59809503d1
Various type hint related improvements (#54971)
* Avoid some implicit generic Anys

* Fix hassio discovery view type hints

* Fix http view result type in assert message
2021-08-21 13:58:49 +02:00
Raman Gupta bef8be9256
Support dynamic schema validation in device conditions and actions (#52007)
* Allow integrations to provide dynamic schema validation in device conditions and actions

* Add tests

* re-add type

* mypy
2021-06-28 09:23:46 +02:00
Erik Montnemery b01b33c304
Add trigger condition (#51710)
* Add trigger condition

* Tweaks, add tests
2021-06-11 15:05:57 +02:00
Franck Nijhof f35929ba63
Allow referencing sensor entities for before/after in time conditions (#51444)
* Allow referencing sensor entities for before/after in time conditions

* Fix typo in variable naming

* Improve test coverage
2021-06-07 14:50:31 +02:00
Franck Nijhof c5dc99c052
Fix time condition microsecond offset when using input helpers (#51337) 2021-06-01 17:57:23 +02:00
Erik Montnemery 63e16de6c0
Improve time condition trace (#51335) 2021-06-01 17:07:45 +02:00
Erik Montnemery 1ea0d8ae02
Correct trace of condition actions (#50800) 2021-05-17 16:54:17 -07:00
J. Nick Koston 3fa8ffa731
Enable mccabe complexity checks in flake8 (#49616)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-04-25 12:38:40 +02:00
Erik Montnemery d28b959a09
Improve sun condition trace (#49551) 2021-04-22 16:46:27 -07:00
Marc Mueller c07646db5d
Update typing syntax (#49480)
* Update typing syntax

* Replace typing imports with ones from collections where possible

* Changes after review
2021-04-20 17:40:41 +02:00
Erik Montnemery ff5fbea1fb
Improve trace of template conditions (#49101)
* Improve trace of template conditions

* Refactor

* Fix wait_template trace

* Update tests
2021-04-12 20:22:28 +02:00
Marc Mueller 2956eb0902
Update pylint to 2.7.3 (#48488)
* Update pylint to 2.7.3

* Add class-const-naming-style

* Remove unused-import message

* Additional cleanup
2021-03-29 18:02:56 -10:00
Marc Mueller 6fb2e63e49
Update typing 02 (#48014) 2021-03-17 18:34:19 +01:00
Erik Montnemery f82e59c32a
Make it possible to list debug traces for a specific automation (#47744) 2021-03-15 16:51:04 -07:00
Erik Montnemery 2f9d03d115
Merge action and condition traces (#47373)
* Merge action and condition traces

* Update __init__.py

* Add typing to AutomationTrace

* Make trace_get prepare a new trace by default

* Correct typing of trace_cv

* Fix tests
2021-03-06 12:57:21 +01:00
Franck Nijhof 7a8b7224c8
Don't raise on known non-matching states in numeric state condition (#47378) 2021-03-04 13:09:08 -08:00
Erik Montnemery 17401cbc29
Initial automation tracing (#46755)
* Initial prototype of automation tracing

* Small fixes

* Lint

* Move trace helpers to its own file

* Improve trace for state and numeric_state conditions

* Tweaks + apply suggestions from code review

* Index traces by automation_id, trace while script is running

* Refactor condition tracing

* Improve WS API to get traces for single automation

* Add tests

* Fix imports

* Fix imports

* Address review comments

* Cap logging of loops

* Remove unused ContextVar action_config
2021-03-04 14:16:24 +01:00
Anders Melchiorsen d61d39de08
Handle ConditionError with multiple entity_id for state/numeric_state (#46855) 2021-02-22 08:11:59 +01:00
Anders Melchiorsen d33a1a5ff8
Refine printing of ConditionError (#46838)
* Refine printing of ConditionError

* Improve coverage

* name -> type
2021-02-21 14:54:36 +01:00
Anders Melchiorsen bfea7d0baa
Raise ConditionError for and/or/not errors (#46767) 2021-02-19 13:15:30 +01:00
Anders Melchiorsen e7e3e09063
Raise ConditionError for zone errors (#46253)
* Raise ConditionError for zone errors

* Do not test missing state

* Handle multiple entities/zones
2021-02-19 13:14:47 +01:00
Anders Melchiorsen 888c9e120d
Raise ConditionError for time errors (#46250) 2021-02-11 17:29:17 +01:00
Anders Melchiorsen 1f5fb8f28a
Raise ConditionError for template errors (#46245) 2021-02-11 10:30:09 +01:00
Anders Melchiorsen f27066e773
Raise ConditionError for state errors (#46244) 2021-02-09 09:46:36 +01:00