Commit Graph

74 Commits (a9381d259040d4a02881cc9e203bc8e3946b2146)

Author SHA1 Message Date
Franck Nijhof 70ad5ab3e4
Update helper tests to use device & entity registry fixtures (#103710) 2023-11-10 09:32:19 +01:00
Ville Skyttä 3094991236
Upgrade ruff to 0.0.285 (#98647) 2023-08-19 08:17:17 -04:00
epenet 1a7e316b51
Fix lingering timer in condition tests (#89807) 2023-03-16 18:19:29 +01:00
epenet 3aa5629665
Improve type hints in condition helper tests (#89754) 2023-03-15 19:42:23 +01:00
Erik Montnemery cc4a179ca8
Support templating for in state conditions (#88411) 2023-02-20 18:57:00 +01:00
epenet 5f25b71df7
Add type hints to core tests (#88478) 2023-02-20 11:42:56 +01:00
epenet c98b4e3204
Add typing to tests with single hass argument (2) (#87675)
* Add typing to tests with single hass argument (2)

* a few more
2023-02-08 08:51:43 +01:00
epenet aa00114c2f
Add return type to async tests without arguments (#87612) 2023-02-07 10:26:56 +01:00
Franck Nijhof ca1a12898c
Enable Ruff D212 (#87347) 2023-02-03 23:08:48 +01:00
Franck Nijhof e50a531cd9
Code styling tweaks to the tests - Part 2 (#86662)
Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
2023-01-26 01:23:53 +01:00
Erik Montnemery 1e2f00e186
Improve device automation validation (#86143) 2023-01-21 00:44:17 +01:00
Karlie Meads 156307f3f2
Fix logic of disabled condition for "OR" (#79718) 2023-01-16 21:08:09 +01:00
Franck Nijhof dd266b7119
Remove elevation warning from sun (#80239) 2022-10-14 15:23:44 +02: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
Thomas Lovén b50f369fe4
Add shorthand notation for boolean conditions (#70120) 2022-04-18 22:09:09 +02: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 cf4033b1bc
Simplify time zone setting in tests (#68330)
* Simplify timezone setting in tests

* Fix typo

* Adjust caldav tests

* Adjust input_datetime tests

* Adjust time_date tests

* Adjust tod tests

* Adjust helper tests

* Adjust recorder tests

* Adjust risco tests

* Adjust aemet tests

* Adjust flux tests

* Adjust forecast_solar tests

* Revert unnecessary change in forecast_solar test

* Adjust climacell tests

* Adjust google tests

* Adjust sensor tests

* Adjust sonarr tests

* Adjust template tests

* Adjust zodiac tests

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-03-20 10:25:15 +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
Tobias Sauerwein 8b38fa58aa
Bump pytest to 7.0.0 (#65981) 2022-02-08 10:03:27 +01:00
Franck Nijhof fa09cf663e
Update black to 22.1.0 (#65788) 2022-02-05 14:19:37 +01:00
Robert Hillis 626a3f35f5
Use enums in helpers tests (#62141) 2021-12-17 11:09:24 +01: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
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
Ville Skyttä 7d03b02192
Spelling fixes (#51642) 2021-06-11 13:35:03 +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 05241a7a68
Allow number/sensor entities in numeric state conditions/triggers (#51439) 2021-06-04 18:14:48 +02:00
Franck Nijhof c5dc99c052
Fix time condition microsecond offset when using input helpers (#51337) 2021-06-01 17:57:23 +02:00
J. Nick Koston bf2d40adfe
Migrate from pytz to python-dateutil (#49643)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-05-07 22:46:26 -07:00
Erik Montnemery d28b959a09
Improve sun condition trace (#49551) 2021-04-22 16:46:27 -07: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
Erik Montnemery 0c6a1c29ec
Fix broken trace tests (#48458) 2021-03-29 10:06:22 +02:00
Erik Montnemery 73e546e2b8
Improve condition trace tests (#48152) 2021-03-21 22:09:59 -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
Erik Montnemery 2d70806035
Add support for "alias" in script steps device, device_condition, and conditions (#46647)
Co-authored-by: Donnie <donniekarnsinsb@hotmail.com>
2021-02-20 19:21:09 -08: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
Anders Melchiorsen 48002f47f4
Use caplog fixture for log capturing (#46214) 2021-02-08 14:33:57 +01:00
Anders Melchiorsen b9b1caf4d7
Raise ConditionError for numeric_state errors (#45923) 2021-02-08 10:47:57 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00