Commit graph

64 commits

Author SHA1 Message Date
epenet
f4fa5b581e
Import PLATFORM_SCHEMA from platform not from helpers (#120565) 2024-06-26 15:43:48 +02:00
Marc Mueller
3559755aed
Add import aliases for PLATFORM_SCHEMA (#120445) 2024-06-25 19:16:19 +02:00
Marc Mueller
062cc4bfce
Add empty line after module docstring [t-v] (#112705) 2024-03-08 10:35:23 -05:00
Vaarlion
3929b0163c
Add RGB, RGBW and RGBWW capability to template.light (#86047)
* Add RGB, RGBW and RGBWW capability to template.light

Add the required unit test

Mute 'LightTemplate.async_turn_on' is too complex

Rename all HS color mode from a generic "Color" name to a specific "HS" name

* Bring back legacy "color" keyword

* Cleanup unrequested commented test

* Increase code coverage to 100%

* Remove confusing if that should never be false

* Apply suggestions from code review

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-11-22 08:15:26 +01:00
Jan Bouwhuis
0d33cba823
Use shorthand attrs in template integration (#100301) 2023-09-13 12:30:43 -05:00
Erik Montnemery
63c538b024
Add config flow for template sensor (#98970)
* Add config flow for template sensor

* Tweak error reporting

* Improve validation

* Fix test

* Rename translation strings

* Improve validation

* Fix sensor async_setup_entry

* Avoid duplicating sensor device class translations

* Avoid duplicating sensor device class translations

* Add config flow tests

* Include all units from DEVICE_CLASS_UNITS in unit_of_measurement select

* Address review comments
2023-08-30 16:22:52 +02:00
Ville Skyttä
3094991236
Upgrade ruff to 0.0.285 (#98647) 2023-08-19 08:17:17 -04:00
Franck Nijhof
8819634b61
String formatting and max line length - Part 6 (#84525) 2022-12-24 13:19:51 +01:00
epenet
7f1e1ed1d8
Enforce LightEntityFeature (#82460) 2022-11-22 07:14:47 +01:00
epenet
dd7bc7971f
Adjust type hints for LightEntityFeature (#82251) 2022-11-17 12:46:42 +01:00
Erik Montnemery
c134bcc536
Remove use of deprecated SUPPORT_* constants from Template light (#77836) 2022-09-08 11:22:38 +02:00
Erik Montnemery
426a620084
Remove deprecated white_value support from template light (#76923) 2022-08-17 07:53:56 -04:00
epenet
9211ba8371
Improve type hints in template (#74294) 2022-07-01 10:05:37 -07:00
Erik Montnemery
5987266e56
Refactor template entity to allow reuse (#72753)
* Refactor template entity to allow reuse

* Fix schema and default name

* Add tests

* Update requirements

* Improve test

* Tweak TemplateSensor initializer

* Drop attributes and availability from TemplateEntity

* Use rest sensor for proof of concept

* Revert changes in SNMP sensor

* Don't set _attr_should_poll in mixin class

* Update requirements
2022-06-08 15:55:49 +02:00
Erik Montnemery
9eca91afc9
Support this variable in template light actions (#71805) 2022-05-13 09:31:37 -07:00
Erik Montnemery
fb6cdb5a38
Optimistically set hs_color in template light (#71629)
* Optimistically set hs_color in template light

* Update light.py

* Update test
2022-05-11 09:57:54 +02:00
Shay Levy
75debb7dec
Add entity id to template error logging (#71107)
* Add entity id to template error logging

* Increase coverage
2022-04-30 19:24:24 +03:00
epenet
e63aef79fe
Use LightEntityFeature enum in template (#71056) 2022-04-29 22:43:33 +03:00
Erik Montnemery
2fb16fd06c
Deprecate white_value support in template light (#71044) 2022-04-29 22:40:23 +03:00
Erik Montnemery
76d105d0ba
Sort stuff in template light (#71045) 2022-04-29 09:46:02 +02:00
Erik Montnemery
e9a9b119c4
Teach TemplateEntity unique_id (#64837) 2022-01-24 23:16:31 +01:00
Erik Montnemery
321f54494e
Teach TemplateEntity entity name (#62175)
* Teach TemplateEntity entity name

* Remove default name from number and select config schemas

* Re-add default name to number and select config schemas

* Set name to None if name template fails to render

* Update template button
2022-01-24 15:44:05 +01:00
epenet
1c30992b0e
Add setup type hints to all template platforms (#63295)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-03 16:23:12 +01:00
Erik Montnemery
c9320b5ca1
Fix none-check in template light (#62089) 2021-12-16 16:12:43 +01:00
Erik Montnemery
a0b6edc894
Minor refactor of template light (#61857) 2021-12-16 16:11:23 +01:00
Erik Montnemery
acf58111c6
Correct initial update of async_track_template_result (#59705) 2021-11-15 13:00:46 +01:00
Erik Montnemery
3d909b00d5
Remove unneeded dynamic lookup of domain (#59423) 2021-11-09 07:41:45 -08:00
Paulus Schoutsen
cc00617cd5
Allow defining state class for template sensors (#52130) 2021-06-23 14:37:04 -07: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
Adrien Brault
676af205e4
Fix light template invalid color temp message (#48337) 2021-04-10 17:22:15 +02:00
Paulus Schoutsen
3dec394cad
Migrate template to register reload service on async_setup (#48273) 2021-03-23 20:35:15 -07:00
tkdrob
2c3a2bd35e
Clean up template (#46509) 2021-02-14 12:16:30 +01:00
Paulus Schoutsen
e21e28e49f
Fix string representation of template result wrappers (#42494) 2020-10-28 09:11:08 +01:00
Franck Nijhof
45aba9bdf2
Allow skip parsing template result (#42401) 2020-10-26 16:01:09 +01: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
J. Nick Koston
0507ec9d8b
Fix cover template entities honoring titlecase True/False (#39803) 2020-09-08 17:08:31 +02: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
Paulus Schoutsen
05d54a60b0
Deprecate optional script context (#39034)
Co-authored-by: Phil Bruckner <pnbruckner@gmail.com>
2020-08-21 14:17:47 +02:00
J. Nick Koston
b4f0485be2
Convert template light to use async_track_template_result (#39045)
* 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

Co-authored-by: Penny Wood <Swamp-Ig@users.noreply.github.com>
2020-08-20 09:29:41 -05:00
Phil Bruckner
716fa63e73
Update script helper constructor parameters (#38763)
Add domain and make it and name required.

Add optional running_description.
2020-08-12 11:39:05 -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
Erik Montnemery
e4333a7a44
Rename Light to LightEntity (#34593) 2020-04-26 18:49:41 +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
Alistair Galbraith
3db9d6a6aa
Fix template light returning NULL in color or temperature (#33498)
* Support for returning NULL in color or temperature. Fixes #33469

* Added further support for ‘None’ returns in level template

* Removed assumption that template render may not be a string

* Streamlined code per cloud pylint

* Updates per code review suggestions

* Added improved error handling and logging for brightness

* Additional exception handling for temperature
2020-04-02 17:41:19 -05:00