1
0
mirror of https://github.com/home-assistant/core.git synced 2025-08-26 13:50:02 +00:00
Commit Graph

57 Commits

Author SHA1 Message Date
Marc Mueller
dd22ee3dac Improve annotation styling () 2024-05-24 15:05:53 +02:00
Sid
0d66d298ec Enable Ruff RET504 ()
* 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] () 2024-03-08 10:35:23 -05:00
RoboMagus
c54b65fdf0 Add 'last_reset' for 'total' state_class template sensor ()
* 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 () 2023-09-13 12:30:43 -05:00
Erik Montnemery
63c538b024 Add config flow for template sensor ()
* 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 ()
* 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 ()
Clean off TemplateSensor
2023-08-24 12:14:39 +02:00
epenet
98198d3c1f Improve type hints in template () 2023-02-02 16:26:03 -05:00
Franck Nijhof
8819634b61 String formatting and max line length - Part 6 () 2022-12-24 13:19:51 +01:00
epenet
5287980f48 Remove template from mypy ignore list () 2022-07-14 21:15:37 +02:00
epenet
9211ba8371 Improve type hints in template () 2022-07-01 10:05:37 -07:00
Erik Montnemery
5987266e56 Refactor template entity to allow reuse ()
* 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 () 2022-04-21 09:32:18 -07:00
Erik Montnemery
a95b4f6763 Correct unit_of_measurement for trigger-based template sensor () 2022-04-04 22:10:59 -07:00
Erik Montnemery
e9a9b119c4 Teach TemplateEntity unique_id () 2022-01-24 23:16:31 +01:00
Erik Montnemery
321f54494e Teach TemplateEntity entity name ()
* 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 ()
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 () 2021-12-10 09:59:27 -08:00
Franck Nijhof
1ed490ce62 Fix date/datetime support for templates ()
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-12-09 11:43:48 +01:00
Erik Montnemery
a67a4873dc Minor refactor of template cover () 2021-12-02 10:26:10 -08:00
Erik Montnemery
5f8997471d Minor refactor of template sensor () 2021-11-10 22:34:49 -08:00
Erik Montnemery
c1d671b817 Fix template sensor when name template doesn't render () 2021-10-20 14:53:06 -07:00
Matthias Alphart
cd0ae66d58 Add CONF_STATE_CLASS to sensor/__init__.py ()
* 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) () 2021-08-11 18:57:50 +02:00
Paulus Schoutsen
cc00617cd5 Allow defining state class for template sensors () 2021-06-23 14:37:04 -07:00
Michael
9eecd90afc Add constructor return type in integrations T-Z () 2021-05-20 17:00:19 +02:00
Paulus Schoutsen
dcee78b747 Template sensor/binary sensors without trigger now respect section unique id () 2021-04-24 07:14:31 -07:00
Paulus Schoutsen
65126cec3e Allow top level non-trigger template entities () 2021-04-12 17:15:50 -07:00
Paulus Schoutsen
e882460933 Support modern config for the trigger based template entity () 2021-04-02 16:57:16 -07:00
Paulus Schoutsen
212d9aa748 Fix trigger template entities without a unique ID () 2021-04-02 10:24:38 -07:00
Paulus Schoutsen
022f56f54d Allow specifying template entities based on triggers ()
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 () 2021-03-23 20:35:15 -07:00
Erik Montnemery
783b453bbe Migrate integrations t-v to extend SensorEntity () 2021-03-22 19:47:44 +01:00
Marc Mueller
b67b9b94f9 Update typing 13 () 2021-03-18 14:43:52 +01:00
tkdrob
2c3a2bd35e Clean up template () 2021-02-14 12:16:30 +01:00
Philip Allgaier
dde6305549 Cleanup unused loggers (components N-Z + tests) () 2020-10-16 21:24:08 -05:00
J. Nick Koston
762537d82d Deprecate manually passing entity ids to template entities ()
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 ()
* 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 () 2020-08-26 00:25:15 +02:00
J. Nick Koston
83b9c6188d Make template entities reloadable ()
* Make template entities reloadable

* Address review items
2020-08-21 18:31:48 -05:00
J. Nick Koston
796d74886e Simplify template integration entities () 2020-08-21 14:33:53 +02:00
J. Nick Koston
5a8013b58c Convert template binary_sensor to use async_track_template_result ()
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 () 2020-08-20 08:51:27 -05:00
J. Nick Koston
d7f54ce98f Convert template lock to use async_track_template_result () 2020-08-20 08:32:52 -05:00
J. Nick Koston
1381b279f0 Update template sensor to use async_track_template_result ()
* 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 ()
* 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 ()
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 () 2020-07-05 23:04:19 +02:00
Ville Skyttä
e6388e186c Remove unnecessary string literal concatenations () 2020-01-02 21:17:10 +02:00