Commit Graph

48 Commits (2ee73ca911eec2d25ccf9b8c7489daad8bd9afa2)

Author SHA1 Message Date
Anders Melchiorsen aa9b5e6ea5 Return of entity_id in template platforms (#12234) 2018-02-07 22:46:14 -08:00
Anders Melchiorsen 9e0ca719ed Deprecate explicit entity_id in template platforms (#11123)
* Deprecate explicit entity_id in template platforms

* Use config validator for deprecation

* Fix copy/paste typos

* Also print the config value

* Add test for config validator

* Assert the module name that logged the message
2018-01-10 00:06:26 -08:00
Pascal Vizeli f463f4d8c6
WIP: Cleanup async stuff on templates (#10275)
Cleanup async stuff on templates
2017-11-01 15:48:09 +01:00
Aaron Bach 646c03eea1 Add entity_picture_template options to Template Cover, Template Light, Template Sensor, and Template Switch (#9854)
* Re-adding cover

* Re-adding light

* Re-adding sensor

* Re-adding switch

* Re-added tests

* Fixing missing imports in rebased test

* Fixing broken tests

* Owner-requested changes

* Owner-requested changes

* Fixed exception
2017-10-30 09:28:37 -07:00
Pascal Vizeli c1b197419d Fix async probs (#9924)
* Update entity.py

* Update entity_component.py

* Update entity_component.py

* Update __init__.py

* Update entity_component.py

* Update entity_component.py

* Update entity.py

* cleanup entity

* Update entity_component.py

* Update entity_component.py

* Fix names & comments / fix tests

* Revert deadlock protection

* Add tests for entity

* Add test fix name

* Update other code

* Fix lint

* Remove restore state from template entities

* Lint
2017-10-19 10:56:25 +02:00
Pascal Vizeli 90f9a6bc0a Cleanup and simplitfy the async state update (#9390)
* Cleanup and simplitfy the async state update

* Update test_entity.py
2017-09-12 10:01:03 +02:00
PhracturedBlue 2b850f417e Minor cleanup - Define 'CONF_ICON_TEMPLATE' constant centrally (#7910)
* Add 'icon_template' to switch templates (similar to sensor template)

* Add test for template switch 'icon_template'

* Define 'CONF_ICON_TEMPLATE' constant centrally

* Missed a redundant definition
2017-06-05 17:33:57 +02:00
PhracturedBlue 11dcbd4449 Add 'icon_template' to switch templates (similar to sensor template) (#7862)
* Add 'icon_template' to switch templates (similar to sensor template)

* Add test for template switch 'icon_template'
2017-06-05 11:27:48 +02:00
Fabian Affolter 4d52b0ecd5 Update docstrings (#7405)
* Update docstrings

* Fix lint issues

* Update docstrings
2017-05-02 22:47:20 +02:00
Fabian Affolter a4f1f6e724 Update docstrings (#7374)
* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstring

* Update docstrings

* Update docstrings

* Fix lint issues

* Update docstrings

* Revert changes in dict
2017-05-02 09:18:47 -07:00
Pascal Vizeli 55dc483c91 Template switch change flow / add restore (#6356)
* Template switch change flow / add restore

* fix tests

* fix binary_sensor template
2017-03-02 14:09:53 +01:00
Pascal Vizeli 41f558b181 Bootstrap / Component setup async (#6264)
* Bootstrap / Entiy setup async

* Cleanup add_job stuff / return task/future object

* Address paulus comments / part 1

* fix install pip

* Cleanup bootstrap / move config stuff to config.py

* Make demo async

* Further bootstrap improvement

* Address Martin's comments

* Fix initial tests

* Fix final tests

* Fix bug with prepare loader

* Remove no longer needed things

* Log error when invalid config

* More cleanup

* Cleanups platform events & fix lint

* Use a non blocking add_entities callback for platform

* Fix Autoamtion is setup befor entity is ready

* Better automation fix

* Address paulus comments

* Typo

* fix lint

* rename functions

* fix tests

* fix test

* change exceptions

* fix spell
2017-02-28 20:33:19 -08:00
Pascal Vizeli 41aaeb715a Convert switch to AsnycIO (#4382)
* Convert switch to AsnycIO

* Move update entity to service

* use time better for faster handling

* Change to suggestion from paulus

* Use new shedule_update_ha_state

* fix lint

* minimize executor calls
2016-11-15 21:06:50 -08:00
Pascal Vizeli 382ac5c3b5 Async cleanups with new handling and executor (#4234) 2016-11-06 01:01:03 +01:00
Fabian Affolter be272ac64a Disable too-many-* (#4107)
* Disable too-many-* and too-few-public-methods

* Remove globally disabled pylint warnings
2016-10-30 22:18:53 +01:00
Pascal Vizeli 9c0455e3dc Allow update entities on add_entities callback (#4114)
* Allow udpate entities on add_entities callback

* fix wrong position

* update force_update to update_before_add

* add unittest for update_befor_add

* fix unittest

* change mocking
2016-10-29 15:33:11 -07:00
Pascal Vizeli 754e93ff6a Rename add_devices to async_add_devices like dev guide (#3938) 2016-10-19 00:35:22 +02:00
Pascal Vizeli 14ef0ca786 Bugfix Template sensors (#3931) 2016-10-18 07:27:32 +02:00
Pascal Vizeli 1540bb1279 Async template (#3909)
* port binary_sensor/template

* port sensor/template

* port switch/template

* fix unittest

* fix

* use task instead yield on it

* fix unittest

* fix unittest v2

* fix invalid config

* fix lint

* fix unuset import
2016-10-17 07:00:55 +02:00
Paulus Schoutsen 5085cdb0f7 Add async_safe annotation (#3688)
* Add async_safe annotation

* More async_run_job

* coroutine -> async_save

* Lint

* Rename async_safe -> callback

* Add tests to core for different job types

* Add one more test with different type of callbacks

* Fix typing signature for callback methods

* Fix callback service executed method

* Fix method signatures for callback
2016-10-04 20:44:32 -07:00
Paulus Schoutsen d58548dd1c Address asyncio comments (#3663)
* Template platforms: create_task instead of yield from

* Automation: less yielding, more create_tasking

* Helpers.script: less yielding, more create_tasking

* Deflake logbook test

* Deflake automation reload config test

* MQTT: Use async_add_job and threaded_listener_factory

* Deflake other logbook test

* lint

* Add test for automation trigger service

* MQTT client can be called from within async
2016-10-03 22:39:27 -07:00
Paulus Schoutsen 4198c42736 Have template platforms never leave the event loop 2016-10-01 14:11:16 -07:00
Paulus Schoutsen 00e298206e Optimize template 2 (#3521)
* Enforce compiling templates

* Refactor templates

* Add template validator to Logbook service

* Some more fixes

* Lint

* Allow easy skipping of rfxtrx tests

* Fix template bug in AND & OR conditions

* add entities extractor

Conflicts:
	tests/helpers/test_template.py

* fix unittest

* Convert template to be async

* Fix Farcy

* Lint fix

* Limit template updates to related entities

* Make template automation async
2016-09-27 21:29:55 -07:00
Paulus Schoutsen 0c0feda834 Pre-compile templates (#3515)
* Pre-compile templates

* Compile templates in numeric_state condition
2016-09-25 13:33:01 -07:00
Fabian Affolter 94e3986d54 Use constants and update ordering (#3261) 2016-09-08 16:26:54 +02:00
Greg Dowling dfd76fc0e6 Minor tidy of voluptuous. (#2945) 2016-08-22 23:57:07 -07:00
Greg Dowling eac67fd971 Add voluptuous to template switch (#2940)
* Add voluptuous to template switch / revise tests.
2016-08-23 00:05:45 +02:00
Paulus Schoutsen 271546d101 Merge branch 'pr/2251' into dev
Conflicts:
	homeassistant/components/switch/template.py
2016-06-07 19:16:14 -07:00
Johann Kellerman d1ed17e7db Default parameter for .run() 2016-06-07 23:00:09 +02:00
Johann Kellerman ed44d28fc0 service helper replaced with script helper (#2242) 2016-06-06 07:36:04 -07:00
Johann Kellerman d5f9c1bc01 Updated template switch to cache Script objects 2016-06-06 06:41:29 +02:00
Johann Kellerman 8887c2a8af service helper replaced with script helper 2016-06-05 21:44:57 +02:00
Paulus Schoutsen 3ac31b2c1b Fix broken tests + linting 2016-05-30 10:19:12 -07:00
Paulus Schoutsen a91f937245 Fix linting issues 2016-05-30 10:08:49 -07:00
Bart274 65fbba0e79 List entity_ids in config and only react to them (#2144)
* List entity_ids in config and only react to them

This allows us to define a list of entity_ids in the config to make the
template sensor, binary sensor and switch only react to state changes of
these entities instead of listening to all state changes.

* Forgot to import the track_state_change function

* Changed test for added entity_ids to config

* Use default MATCH_ALL and remove event_listener
2016-05-29 14:34:21 -07:00
Paulus Schoutsen 41f205e09d Clean up template platforms 2016-03-24 23:22:17 -07:00
pavoni 4e7160139e Fix race condition in template components. 2016-03-17 12:10:19 +00:00
Fabian Affolter 49ebc6d0b0 Fix PEP257 issues 2016-03-08 13:35:39 +01:00
pavoni 4e3c8a8697 Fix noisy error on startup. Make callbacks code consistent. 2016-03-06 19:19:07 +00:00
Fabian Affolter 582394bc3b Modify import of template and PEP257 2016-02-23 21:19:22 +01:00
Paulus Schoutsen e80309c03c Fix imports (using isort) 2016-02-18 21:27:50 -08:00
pavoni 2622cf2e53 Use available, remove state, improve true,false tests. 2016-02-05 11:18:50 +00:00
pavoni ced380f0cd Remove unneeded entity_id check and blank lines. 2016-02-04 17:24:38 +00:00
pavoni b20d3f8b3a Update docstrings. 2016-02-03 23:23:19 +00:00
pavoni 6e6c3c5cd5 Tidy. 2016-02-03 14:30:58 +00:00
pavoni 5521096c02 Add actions. 2016-02-03 14:29:25 +00:00
pavoni 9a9dbcfaea Refactor, support template logic values, add tests. 2016-02-03 13:16:13 +00:00
pavoni a955f3db08 WIP commit - template state working, on / off still to do. 2016-02-02 19:25:17 +00:00