Commit Graph

179 Commits (f24f0c2954a4a489912d6466edee5e5d6223b7e7)

Author SHA1 Message Date
J. Nick Koston 7fbe1dbc99
Remove legacy fan compatibility shim (#59781) 2021-12-03 21:57:46 -08:00
Erik Montnemery acf58111c6
Correct initial update of async_track_template_result (#59705) 2021-11-15 13:00:46 +01:00
Paulus Schoutsen 31153ac155
Move fixtures part 1 (#58902) 2021-11-01 20:47:05 -07:00
Franck Nijhof 65b19da3ff
Refactor input_select (#53334) 2021-10-25 20:38:06 -07:00
Erik Montnemery c1d671b817
Fix template sensor when name template doesn't render (#58088) 2021-10-20 14:53:06 -07:00
Jan Bouwhuis e2303dc713
bitwise and for test supported_features (#58097) 2021-10-20 15:31:23 +02:00
Jan Bouwhuis 62b7453719
Fix supported_features behaviour for fan platform (#58065) 2021-10-20 13:06:06 +02:00
Franck Nijhof 13db867c1d
Move attribution attribute to Entity base class (#57492) 2021-10-11 23:15:32 +02:00
Jeff Irion 9dfb684002
Enable template icons for template selects (#57092)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2021-10-07 15:38:02 +02:00
Paulus Schoutsen a4d9019ffc
Refactor persistent notification to no longer route all data via a service (#57157)
* Convert persistent notification tests to async

* Create/dismiss persistent notifications in exposed functions, not service calls

* Fix notify persistent_notification

* Remove setting up persistent_notification

* Drop more setups

* Empty methods

* Undeprecate sync methods because too big task

* Fix setup clearing notifications

* Fix a bunch of tests

* Fix more tests

* Uno mas

* Test persistent notification events

* Clean up stale comment

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-10-07 12:58:00 +02:00
Jeff Irion 15a8f6741b
Enable template icons for template numbers (#56154) 2021-10-01 09:35:44 -07:00
avee87 daebc34f4d
Add code_format to template alarm (#56700)
* Added code_format to template alarm

* review comment

* review comment

* use constant

* back to enum

* none -> no_code
2021-09-29 16:59:46 +02:00
jan iversen c4195c547c
Update template/test_init.py to use pytest (#56336) 2021-09-17 15:13:17 -07:00
jan iversen 70eb519f76
Update template/test_light.py to use pytest (#56300) 2021-09-16 11:05:00 -07:00
jan iversen 692f611109
Update template/test_fan.py to use pytest (#56215) 2021-09-14 13:51:46 -07:00
jan iversen 96a9af8cc4
Update template/test_weather.py to use pytest (#56223) 2021-09-14 13:06:55 -07:00
jan iversen 4b2ff0a0ba
Update template/alarm_control_panel.py to use pytest (#56229) 2021-09-14 13:06:29 -07:00
jan iversen 990d474d02
use fixtures. (#56130) 2021-09-12 15:08:46 -07:00
jan iversen cb8c0cb123
Update template/test_lock.py to use pytest (#56102) 2021-09-11 11:48:25 -07:00
jan iversen ac1251c52b
Update template/test_trigger.py to use pytest (#55950) 2021-09-10 09:55:51 -07:00
Raman Gupta 37d75e8a03
Allow multiple template.select platform entries (#55908) 2021-09-07 14:50:07 -07:00
jan iversen 6348bf70ac
Add caplog setup fixture. (#55714) 2021-09-04 07:09:55 -07:00
jan iversen 7aa454231f
Update template/test_sensor.py to use pytest (#55288) 2021-09-03 22:56:12 -07:00
jan iversen a756308e79
Update template/test_binary_sensor.py to use pytest (#55220) 2021-09-03 15:43:07 -07:00
Paulus Schoutsen 0c2772e0be
Fix template sensor availability (#55635) 2021-09-03 09:02:45 +02:00
Raman Gupta e9625e4b7a
Add number platform to template integration (#54789) 2021-08-25 11:34:20 -07:00
Raman Gupta 8407ad01d4
Add select platform to template integration (#54835) 2021-08-25 11:21:24 -07:00
jan iversen de7352dbde
Convert template/vacuum to pytest with fixtures (#54841) 2021-08-24 14:11:40 +02:00
J. Nick Koston ee242764a1
Update template lock to support locking, unlocking, jammed (#52817) 2021-07-20 21:50:21 -07:00
Erik Montnemery 2097ab76f5
Allow combining value_template and position_template for template cover (#52383) 2021-07-01 14:09:48 +02:00
Paulus Schoutsen cc00617cd5
Allow defining state class for template sensors (#52130) 2021-06-23 14:37:04 -07:00
Franck Nijhof c5383219f1
Remove stale debug statements from tests (#51059) 2021-05-25 11:52:20 +02:00
jacekpaszkowski 85495c08b0
Add support for effects, transition/brightness parameters to template light, min_mireds and max_mireds templates (#43850)
* Add support for effects, transition/brightness parameters to template light, min_mireds and max_mireds templates

* code fixes

* min_mireds, max_mireds fixes

* test fixes

* more fixes

* format fix

* style fix

* _update_effect_list change

* style fix

* Fixes after review

* additional fixes

* duplicated lines removed

* fixes after CI run

* test fixes

* code and test fixes

* supports transition change, added test cases
2021-05-24 13:31:57 +02:00
Paulus Schoutsen f5e4b13814
Add auto_off to binary sensor template entity (#49615) 2021-04-29 09:25:34 -07:00
Paulus Schoutsen dcee78b747
Template sensor/binary sensors without trigger now respect section unique id (#49613) 2021-04-24 07:14:31 -07:00
Paulus Schoutsen 1016d4ea28
Support trigger-based template binary sensors (#49504)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-04-22 14:54:28 -07:00
Paulus Schoutsen beea2dd35f
Internally work with modern config syntax for template binary sensor platform config (#48981) 2021-04-13 07:58:44 -07:00
Paulus Schoutsen 65126cec3e
Allow top level non-trigger template entities (#48976) 2021-04-12 17:15:50 -07:00
Paulus Schoutsen 2d5edeb1ef
Set hass when adding template attribute (#49094) 2021-04-11 22:49:09 -07:00
Brandon Rothweiler 52e8c7166b
Allow template covers to have opening and closing states (#47925) 2021-04-09 11:36:02 +02:00
Paulus Schoutsen 09635678bc
Allow reloading top-level template entities (#48733) 2021-04-06 12:10:39 -07:00
Paulus Schoutsen e882460933
Support modern config for the trigger based template entity (#48635) 2021-04-02 16:57:16 -07:00
Paulus Schoutsen 212d9aa748
Fix trigger template entities without a unique ID (#48631) 2021-04-02 10:24:38 -07:00
Erik Montnemery b26779a27a
Add id to automation triggers (#48464) 2021-03-31 14:56:04 +02:00
Paulus Schoutsen 022f56f54d
Allow specifying template entities based on triggers (#48169)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-03-29 09:57:51 -07:00
J. Nick Koston 564688af25
Fix template fan default speed count (#48389)
* Fix template fan default speed count

The default speed count was defaulting to 3 when percentage
was implemented instead of the documented value of 100

* Increase coverage

* remove unreachable code
2021-03-29 09:33:56 +02:00
Christian Soltenborn 955804bf58
Add template support for remaining attributes of weather entity (#47736)
* added template support for remaining attributes of weather entity

* wind bearing is now angle (number)
2021-03-27 18:53:35 +00:00
Paulus Schoutsen 3dec394cad
Migrate template to register reload service on async_setup (#48273) 2021-03-23 20:35:15 -07:00
Franck Nijhof 5a2b5fe7c5
Yoda assertion style removed is (#48142) 2021-03-20 13:55:10 +01:00
sycx2 009e44ed9b
Rewrite tests for Template Light (#41163) 2021-03-17 11:30:44 +01:00
J. Nick Koston 53952b9662
Ensure template fan value_template always determines on state (#47598) 2021-03-08 18:34:34 +01:00
Ville Skyttä dc880118a4
Lint suppression cleanups (#47248)
* 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
Erik Montnemery dd9e926689
Pass variables to initial evaluation of template trigger (#47236)
* Pass variables to initial evaluation of template trigger

* Add test

* Clarify test
2021-03-01 23:34:26 +01:00
Diogo Gomes 0e44d61225
Add weather platform to template domain (#45031)
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-02-21 18:08:00 -10:00
J. Nick Koston f2b303d509
Implement percentage step sizes for fans (#46512)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-02-18 21:05:09 -10:00
Anders Melchiorsen f8f86fbe48
Do not trigger when template is true at startup (#46423) 2021-02-14 19:54:11 +01:00
Erik Montnemery ed31cc363b
Wait for registries to load at startup (#46265)
* Wait for registries to load at startup

* Don't decorate new functions with @bind_hass

* Fix typing errors in zwave_js

* Load registries in async_test_home_assistant

* Tweak

* Typo

* Tweak

* Explicitly silence mypy errors

* Fix tests

* Fix more tests

* Fix test

* Improve docstring

* Wait for registries to load
2021-02-11 17:36:19 +01:00
J. Nick Koston babfef829d
Add support for percentage speeds and preset modes to template fan (#45478) 2021-01-28 10:44:36 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
J. Nick Koston 035f9412ba
Fix template triggers from time events (#44603)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-12-29 23:16:39 +01:00
Paulus Schoutsen b3be708db6
Add default config if not there (#43321)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-11-25 15:10:04 +01:00
Maciej Wilczyński 6a5546afc1
Add an option to template delay_on/off in template binary sensor (#43259) 2020-11-17 07:24:04 -10:00
J. Nick Koston 935c2df7cb
Add a test for template entities that reuse the template (#42404) 2020-10-26 16:08:57 +01:00
Paulus Schoutsen 5dac3883b0
Stub light profiles (#42232) 2020-10-23 16:28:21 +02:00
Philip Allgaier dde6305549
Cleanup unused loggers (components N-Z + tests) (#41982) 2020-10-16 21:24:08 -05:00
Jaroslav Hanslík 3e82cc1b4f
Add arming state to template alarm control panel (#41964) 2020-10-16 23:01:06 +02:00
sycx2 91042e3e46
Improve template test lock (#41195)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-10-16 13:25:57 +02:00
sycx2 fc75927d85
Rewrite tests for Template Binary Sensor (#41098) 2020-10-12 17:56:08 +02:00
Franck Nijhof ee914366a8
Add native Python types support to templates (#41227)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-10-07 00:05:52 +02:00
Franck Nijhof 357a0e9d7e
Improve switch template tests, remove common test helpers (#41322) 2020-10-06 14:54:39 +02:00
sycx2 e813d3ebf9
Improve template test sensor (#41199) 2020-10-05 14:52:31 +02:00
J. Nick Koston b1ba1a7134
Verify template sensors that reference other template sensors can reload (#41031) 2020-10-02 08:34:33 +02:00
J. Nick Koston deedd41d62
Prevent template loop detection from triggering when all templates are self referencing (#41013) 2020-10-01 22:11:11 +02:00
J. Nick Koston b45215f1d2
Implement template rate_limit directive (#40667) 2020-10-01 21:39:44 +02:00
Franck Nijhof 8837ed35cd
Use direct service calls in tests instead of automation common (#40623)
* Use direct service calls in tests instead of automation common

* Remove automation common test helpers
2020-09-26 19:28:26 +02:00
J. Nick Koston aaa8083d49
Change template loop detection strategy to allow self-referencing updates when there are multiple templates (#39943) 2020-09-12 14:20:21 +02:00
J. Nick Koston fd8a4182d9
Detect self-referencing loops in template entities and log a warning (#39897) 2020-09-10 20:50:11 +02:00
J. Nick Koston 4bbd69955b
Restore missing device_class to template binary_sensor (#39805) 2020-09-08 17:12:23 +02:00
J. Nick Koston 0507ec9d8b
Fix cover template entities honoring titlecase True/False (#39803) 2020-09-08 17:08:31 +02:00
Franck Nijhof 1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
J. Nick Koston 20398cc0a6
Subscribe to state change events only if the template has entities (#39188) 2020-08-26 00:20:04 +02:00
J. Nick Koston 83b9c6188d
Make template entities reloadable (#39075)
* Make template entities reloadable

* Address review items
2020-08-21 18:31:48 -05:00
J. Nick Koston 5db90478f3
Convert template vacuum to use async_track_template_result (#39047)
* Convert template lock to use async_track_template_result

* Convert template switch to use async_track_template_result

* Convert template fan to use async_track_template_result

* Convert template binary_sensor to use async_track_template_result

Co-Authored-By: Penny Wood <Swamp-Ig@users.noreply.github.com>

* Convert template cover to use async_track_template_result

* Convert template light to use async_track_template_result

* Convert template vacuum to use async_track_template_result

Co-authored-by: Penny Wood <Swamp-Ig@users.noreply.github.com>
2020-08-20 09:30:31 -05:00
J. Nick Koston 5a8013b58c
Convert template binary_sensor to use async_track_template_result (#39027)
Co-Authored-By: Penny Wood <Swamp-Ig@users.noreply.github.com>

Co-authored-by: Penny Wood <Swamp-Ig@users.noreply.github.com>
2020-08-20 09:07:58 -05:00
J. Nick Koston 8813f669c2
Convert template alarm_control_panel to use async_track_template_result (#39014)
* Convert template lock to use async_track_template_result

* Convert template switch to use async_track_template_result

* Convert template fan to use async_track_template_result

* Convert template alarm_control_panel to use async_track_template_result
2020-08-20 08:54:16 -05:00
J. Nick Koston f3d077c1e1
Convert template fan to use async_track_template_result (#38983)
* Convert template lock to use async_track_template_result

* Convert template switch to use async_track_template_result

* Convert template fan to use async_track_template_result
2020-08-20 08:53:45 -05:00
J. Nick Koston d7f54ce98f
Convert template lock to use async_track_template_result (#38946) 2020-08-20 08:32:52 -05:00
J. Nick Koston 1381b279f0
Update template sensor to use async_track_template_result (#38940)
* Add template entity

* Update template tracking to work for template sensors

* add test for whitespace

* Update homeassistant/helpers/config_validation.py

* revert

* fix

* reduce

* fix _refresh missing decorator

* defer until start

* do not throw errors during startup

* defer tracking until start event

Co-authored-by: Swamp-Ig <github@ninjateaparty.com>
2020-08-20 08:06:41 -05:00
Phil Bruckner ca9dd0c833
Reorganize trigger code (#38655) 2020-08-17 11:54:56 -05:00
Thomas Hollstegge 5de21375c0
Make sure groups are initialized before template sensors (#37766)
* Make sure groups are initialized before template sensors

This way users may use the `expand` function in templates to expand
groups and have HA listen for changes to group members.

Fixes #35872

* Patch async_setup_platform instead of async_setup

* Cleanup

* Use an event to avoid sleep

* Update tests/components/template/test_sensor.py

Co-authored-by: J. Nick Koston <nick@koston.org>

Co-authored-by: J. Nick Koston <nick@koston.org>
2020-08-08 21:34:14 -05:00
Michaël Arnauts f09a9abc1c
Add optional unique_id attribute to the template platforms (#38011)
* Add unique_id to template platforms

* Update test_binary_sensor.py

* Update test_binary_sensor.py
2020-08-01 12:45:55 -10:00
Thomas Delaet 3ff5c17009
Support unavailable state in template fan (#38114)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-07-24 15:48:07 +02:00
J. Nick Koston 44fefb3216
Improve handling of template platforms when entity extraction fails (#37831)
Most of the the template platforms would check for
extract_entities failing to extract entities and avoid
setting up a state change listner for MATCH_ALL after
extract_entities had warned that it could not extract
the entities and updates would need to be done manually.
This protection has been extended to all template platforms.

Alter the behavior of extract_entities to return the
successfully extracted entities if one or more templates
fail extraction instead of returning MATCH_ALL
2020-07-14 22:34:35 -07:00
akloeckner d0668d3a6c
Add optimistic mode to template switch (#31637) 2020-07-06 16:32:33 -07:00
Chris 16f1ef5a44
Add attribute templates to template vacuum (#36518) 2020-06-22 17:21:20 -07:00
Paulus Schoutsen 276f3afb00
Do async_setup_platform in background (#36244)
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-31 22:18:30 -07:00
Martin Hjelmare 39431c0764
Add required features to cover service registration (#35073)
* Fix typing in component service method

* Add required features to cover service registration

* Fix template cover tilt features

* Delint template cover tests
2020-05-03 23:21:12 +02:00
Elahd Bar-Shai c5d2e44baf
Add white value in light template platform (#32481)
* Added support for white value in Template Light integration.

* Tests now working.

* Clean up

* Make template more robust

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-20 14:26:28 +02:00
springstan 46bbe816f6
Remove None from dict.get(key, None) (#33794) 2020-04-07 21:06:05 +02:00
springstan 0d95eff21d
Use dict literals (#33658) 2020-04-04 22:31:56 +02:00