Commit Graph

30 Commits (9742bfdf460b3b5a5b7d2a821975e3e0a5ab9a41)

Author SHA1 Message Date
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 65126cec3e
Allow top level non-trigger template entities (#48976) 2021-04-12 17:15:50 -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
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
Paulus Schoutsen 3dec394cad
Migrate template to register reload service on async_setup (#48273) 2021-03-23 20:35:15 -07:00
Erik Montnemery 783b453bbe
Migrate integrations t-v to extend SensorEntity (#48216) 2021-03-22 19:47:44 +01:00
Marc Mueller b67b9b94f9
Update typing 13 (#48077) 2021-03-18 14:43:52 +01:00
tkdrob 2c3a2bd35e
Clean up template (#46509) 2021-02-14 12:16:30 +01:00
Philip Allgaier dde6305549
Cleanup unused loggers (components N-Z + tests) (#41982) 2020-10-16 21:24:08 -05:00
J. Nick Koston 762537d82d
Deprecate manually passing entity ids to template entities (#39382)
It is no longer necessary to provide a list of entities to monitor
to the template platforms.

The template is now re-evaluated whenever
a referenced entity changes state, and new entities are automaticlly
discovered.

Automatic analysis can now determine the entities for all templates
without the need for manual setup.
2020-09-01 08:53:50 -05:00
J. Nick Koston 810df38f0d
Add the ability to reload light/cover groups from yaml (#39250)
* Add the ability to reload light/cover groups from yaml

Update previous usage to reduce code duplication.

* Fix conflict from rebase
2020-08-25 18:13:43 -05:00
J. Nick Koston 90842fcb84
Support reloading the universal platform (#39248) 2020-08-26 00:25:15 +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 796d74886e
Simplify template integration entities (#39083) 2020-08-21 14:33:53 +02: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 264e340b9e
Convert template switch to use async_track_template_result (#38950) 2020-08-20 08:51:27 -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
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
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
Franck Nijhof 53545c984b
Log lines do not end with a full stop (#37527) 2020-07-05 23:04:19 +02:00
Ville Skyttä e6388e186c
Remove unnecessary string literal concatenations (#30360) 2020-01-02 21:17:10 +02:00
Bas Nijholt 415176e350 Sort imports according to PEP8 for template (#29655) 2019-12-08 21:05:08 +01:00
Gil Peeters 0088995b98 Refactor template components to extract common routines (#27064)
* Added availability_template to Template Cover platform

* Added availability_template to Template Binary Sensor platform

* Added availability_template to Template Fan platform

* Added availability_template to Template Light platform

* Added availability_template to Template Sensor platform

* Added availability_template to Template Switch platform

* Added availability_template to Template Vacuum platform

* Added availability_template to Template Lock platform

* Added to test for invalid values in availability_template

* Black and Lint fix

* black formatting

* Added to test for invalid values in availability_template

* black

* Added to test for invalid values in availability_template

* Added to test for invalid values in availability_template

* simplified exception handler

* Fixed Entity discovery big and coverage

* Added to test for invalid values in availability_template

* flake8

* fixed component ID in test

* Added to test for invalid values in availability_template

* Added to test for invalid values in availability_template

* Made availability_template redering erorr more concise

* Cleaned template setup

* I'll remember to run black every time one of these days...

* Refactored Template initialisation

* Refactored Template initialisation

* Updated AVAILABILITY_TEMPLATE Rendering error

* Updated AVAILABILITY_TEMPLATE Rendering error

* Updated AVAILABILITY_TEMPLATE Rendering error

* Updated AVAILABILITY_TEMPLATE Rendering error

* Updated AVAILABILITY_TEMPLATE Rendering error

* Updated AVAILABILITY_TEMPLATE Rendering error

* Updated AVAILABILITY_TEMPLATE Rendering error

* Updated AVAILABILITY_TEMPLATE Rendering error

* Moved const to package Const.py

* Moved const to package Const.py

* Moved const to package Const.py

* Moved const to package Const.py

* Moved const to package Const.py

* Moved const to package Const.py

* Moved const to package Const.py

* Moved const to package Const.py

* Fix import order (pylint)

* Fix import order (pylint)

* Fix import order (pylint)

* Fix import order (pylint)

* Fix import order (pylint)

* Fix import order (pylint)

* Fix import order (pylint)

* Fixed linting issues

* Moved availability_template rendering to common loop

* Moved availability_template rendering to common loop

* Moved availability_template rendering to common loop

* Moved availability_template rendering to common loop

* Removed 'Magic' string

* Removed 'Magic' string and removed duplicate code

* Removed 'Magic' string

* Removed 'Magic' string

* Brought contant into line

* Refactored availability_tempalte rendering to common loop

* Removed 'Magic' string

* Cleaned up const and compare lowercase result to 'true'

* Cleaned up const and compare lowercase result to 'true'

* Cleaned up const and compare lowercase result to 'true'

* Cleaned up const and compare lowercase result to 'true'

* Cleaned up const and compare lowercase result to 'true'

* Cleaned up const and compare lowercase result to 'true'

* Cleaned up const and compare lowercase result to 'true'

* reverted _available back to boolean

* reverted _available back to boolean

* reverted _available back to boolean

* reverted _available back to boolean

* reverted _available back to boolean

* reverted _available back to boolean

* reverted _available back to boolean

* Fixed tests (magic values and state checks)

* Fixed tests (magic values and state checks)

* Fixed tests (async, magic values and state checks)

* Fixed tests (async, magic values and state checks)

* Fixed tests (async, magic values and state checks)

* Fixed tests (async, magic values and state checks)

* Fixed tests (async, magic values and state checks)

* Removed duplicate

* Clean up and remove debug

* Reverted Dev Container Change
2019-11-25 16:30:49 -08:00
Gil Peeters 161c8aada6 Add availability_template to Template Sensor platform (#26516)
* Added availability_template to Template Sensor platform

* Added to test for invalid values in availability_template

* Updated AVAILABILITY_TEMPLATE Rendering error

* Moved const to package Const.py

* Fix import order (pylint)

* Moved availability_template rendering to common loop

* Removed 'Magic' string

* Cleaned up const and compare lowercase result to 'true'

* Device is unavailbale if value template render fails

* Converted test ot Async and fixed states

* Comverted back to using boolean for _availability

* Fixed state check in test
2019-09-24 16:05:19 +02:00
Steven Rollason 79488daddf New template sensor attributes (#26127)
* updated sensor and test files

* Formatting fixes

* Updated attribute template code

* Black formatting

* Code improvements based on feedback on binary_sensor pull request

* Updated tests

* Remove duplicated code and fix tests

* Black formatting on tests

* Remove link from docstring

* Moved default to schema

* Formatting fix and change to use dict[key] to retrieve attribute_templates
2019-09-01 18:12:55 +02:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Tobias Sauerwein 048b100eea Clean up docstrings (#22679)
* Clean up docstrings

* Fix long lines

* Fix more docstrings

* Fix more docstrings

* Fix more docstrings
2019-04-03 17:40:03 +02:00
Penny Wood f195ecca4b Consolidate all platforms that have tests (#22109)
* Moved climate components with tests into platform dirs.

* Updated tests from climate component.

* Moved binary_sensor components with tests into platform dirs.

* Updated tests from binary_sensor component.

* Moved calendar components with tests into platform dirs.

* Updated tests from calendar component.

* Moved camera components with tests into platform dirs.

* Updated tests from camera component.

* Moved cover components with tests into platform dirs.

* Updated tests from cover component.

* Moved device_tracker components with tests into platform dirs.

* Updated tests from device_tracker component.

* Moved fan components with tests into platform dirs.

* Updated tests from fan component.

* Moved geo_location components with tests into platform dirs.

* Updated tests from geo_location component.

* Moved image_processing components with tests into platform dirs.

* Updated tests from image_processing component.

* Moved light components with tests into platform dirs.

* Updated tests from light component.

* Moved lock components with tests into platform dirs.

* Moved media_player components with tests into platform dirs.

* Updated tests from media_player component.

* Moved scene components with tests into platform dirs.

* Moved sensor components with tests into platform dirs.

* Updated tests from sensor component.

* Moved switch components with tests into platform dirs.

* Updated tests from sensor component.

* Moved vacuum components with tests into platform dirs.

* Updated tests from vacuum component.

* Moved weather components with tests into platform dirs.

* Fixed __init__.py files

* Fixes for stuff moved as part of this branch.

* Fix stuff needed to merge with balloob's branch.

* Formatting issues.

* Missing __init__.py files.

* Fix-ups

* Fixup

* Regenerated requirements.

* Linting errors fixed.

* Fixed more broken tests.

* Missing init files.

* Fix broken tests.

* More broken tests

* There seems to be a thread race condition.
I suspect the logger stuff is running in another thread, which means waiting until the aio loop is done is missing the log messages.
Used sleep instead because that allows the logger thread to run. I think the api_streams sensor might not be thread safe.

* Disabled tests, will remove sensor in #22147

* Updated coverage and codeowners.
2019-03-18 23:07:39 -07:00