Commit graph

61 commits

Author SHA1 Message Date
Erik Montnemery
dc462aa529
Remove unnecessary assignment of Template.hass from template (#123773) 2024-08-13 11:54:36 +02:00
dougiteixeira
0d48d5a5ec
Remove device ID from config schema via YAML in helper template (#120708) 2024-07-07 16:40:02 +02:00
Marc Mueller
3559755aed
Add import aliases for PLATFORM_SCHEMA (#120445) 2024-06-25 19:16:19 +02:00
dougiteixeira
6e32a96ff3
Add the ability to bind the template helper entity to a device (#117753) 2024-06-22 12:45:06 +02:00
Marc Mueller
dd22ee3dac
Improve annotation styling (#118032) 2024-05-24 15:05:53 +02:00
Sid
0d66d298ec
Enable Ruff RET504 (#114528)
* Enable Ruff RET504

* fix test

* Use noqa instead of cast

* fix sonos RET504

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-06 11:07:37 +02:00
Marc Mueller
062cc4bfce
Add empty line after module docstring [t-v] (#112705) 2024-03-08 10:35:23 -05:00
RoboMagus
c54b65fdf0
Add 'last_reset' for 'total' state_class template sensor (#100806)
* Add last_reset to trigger based template sensors

* Add last_reset to state based template sensors

* CI check fixes

* Add pytests

* Add test cases for last_reset datetime parsing

* Add test for static last_reset value

* Fix ruff-format
2024-01-25 11:12:03 +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
G Johansson
61c17291fb
Move TemplateEntity to template (#98957)
* Move TemplateEntity to template

* Rename template_entity in helpers
2023-08-24 15:37:04 +02:00
G Johansson
b69e8fda77
Remove TemplateSensor from the template_entity helper (#98945)
Clean off TemplateSensor
2023-08-24 12:14:39 +02:00
epenet
98198d3c1f
Improve type hints in template (#87172) 2023-02-02 16:26:03 -05:00
Franck Nijhof
8819634b61
String formatting and max line length - Part 6 (#84525) 2022-12-24 13:19:51 +01:00
epenet
5287980f48
Remove template from mypy ignore list (#74426) 2022-07-14 21:15:37 +02: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
9bec649323
Restore state of trigger-based template sensor (#69344) 2022-04-21 09:32:18 -07:00
Erik Montnemery
a95b4f6763
Correct unit_of_measurement for trigger-based template sensor (#69291) 2022-04-04 22:10:59 -07: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
aa36dde148
Correct rest sensor configured to generate timestamps (#61429) 2021-12-10 09:59:27 -08:00
Franck Nijhof
1ed490ce62
Fix date/datetime support for templates (#61088)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-12-09 11:43:48 +01:00
Erik Montnemery
a67a4873dc
Minor refactor of template cover (#59537) 2021-12-02 10:26:10 -08:00
Erik Montnemery
5f8997471d
Minor refactor of template sensor (#59466) 2021-11-10 22:34:49 -08:00
Erik Montnemery
c1d671b817
Fix template sensor when name template doesn't render (#58088) 2021-10-20 14:53:06 -07:00
Matthias Alphart
cd0ae66d58
Add CONF_STATE_CLASS to sensor/__init__.py (#54106)
* add CONF_STATE_CLASS to const.py

* move to `sensor/__init__.py`

* move to sensor/const.py

* Revert "move to sensor/const.py"

This reverts commit 604d0d066b.

* move it to `sensor/const.py` but import it from `sensor/__init__.py`

* add Modbus
2021-08-27 05:54:50 +02:00
Erik Montnemery
94a264afaf
Move temperature conversions to entity base class (7/8) (#54482) 2021-08-11 18:57:50 +02:00
Paulus Schoutsen
cc00617cd5
Allow defining state class for template sensors (#52130) 2021-06-23 14:37:04 -07:00
Michael
9eecd90afc
Add constructor return type in integrations T-Z (#50899) 2021-05-20 17:00:19 +02: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
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