Commit Graph

224 Commits (b5bd91096359c9cd7f070bac8015b2ae084d6488)

Author SHA1 Message Date
Jan-Philipp Benecke 4d708f1931
Migrate template tests to use freezegun (#105341) 2023-12-09 09:47:28 +01:00
Erik Montnemery 25bea91683
Use modern platform path when reporting platform config errors (#104238)
* Use modern platform path when reporting platform config errors

* Update tests

* Address review comment

* Explicitly pass platform domain to log helpers

* Revert overly complicated changes

* Try a simpler solution
2023-12-05 15:06:13 +01:00
Jan Bouwhuis 953a212dd6
Use ServiceValidationError for invalid fan preset_mode and move check to fan entity component (#104560)
* Use ServiceValidationError for fan preset_mode

* Use _valid_preset_mode_or_raise to raise

* Move preset_mode validation to entity component

* Fix bond fan and comments

* Fixes baf, fjaraskupan and template

* More integration adjustments

* Add custom components mock and test code

* Make NotValidPresetModeError subclass

* Update homeassistant/components/fan/strings.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Keep bond has_action validation

* Move demo test asserts outside context block

* Follow up comment

* Update homeassistant/components/fan/strings.json

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* Fix demo tests

* Remove pylint disable

* Remove unreachable code

* Update homeassistant/components/fan/__init__.py

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* Use NotValidPresetModeError, Final methods

* Address comments

* Correct docst

* Follow up comments

* Update homeassistant/components/fan/__init__.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-11-29 13:56:51 +01:00
Jan Bouwhuis 861bb48ab6
Assign specific error code for HomeAssistantError on websocket_api connection exceptions (#104700)
Assign specific error code for HomeAssistantError
2023-11-29 13:07:52 +01: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
Kevin Stillhammer 173f4760bc
Deprecate weather.get_forecast (#102534)
* Deprecate weather.get_forecast

* Rename forecast to get_forecasts

* raise issue for use of deprecated service

* Add fix_flow

* Add service translation/yaml
2023-11-19 20:44:02 +01:00
Erik Montnemery 80813e992d
Improve formatting of component errors (#104081)
* Improve formatting of component errors

* Update tests
2023-11-17 23:01:00 +01:00
Erik Montnemery dd7670cacf
Improve errors for component configuration with missing keys (#103982) 2023-11-15 10:47:05 +01:00
Erik Montnemery 94a2087ba0
Improve formatting of config validation errors (#103957)
* Improve formatting of config validation errors

* Address review comments
2023-11-14 12:48:45 +01:00
Erik Montnemery dedd3418a1
Improve print of line numbers when there are configuration errors (#103216)
* Improve print of line numbers when there are configuration errors

* Update alarm_control_panel test
2023-11-14 08:21:36 +01:00
Kevin Stillhammer dae742fba0
Use snapshots in weather tests (#102297) 2023-10-19 16:40:08 +02:00
Paul Bottein c98c18f25e
Return 'None' for light attributes when off instead of removing them (#101946) 2023-10-19 01:08:08 +02:00
G Johansson 43954d660b
Add trigger weather template (#100824)
* Add trigger weather template

* Add tests

* mod dataclass

* Remove legacy forecast

* Fix test failure

* sorting

* add hourly test

* Add tests

* Add and fix tests

* Improve tests

---------

Co-authored-by: Erik <erik@montnemery.com>
2023-09-27 10:11:57 +02:00
Erik Montnemery 42046a3ce2
Fix TriggerEntity.async_added_to_hass (#100119) 2023-09-11 14:33:43 +02:00
Erik Montnemery c9a6ea94a7
Send template render errors to template helper preview (#99716) 2023-09-06 16:07:05 +02:00
Erik Montnemery cdca4591a4
Include template listener info in template preview (#99669) 2023-09-06 09:49:42 +02:00
Allen Porter 7b1c0c2df2
Extend template entities with a script section (#96175)
* Extend template entities with a script section

This allows making a trigger entity that triggers a few times a day,
and allows collecting data from a service resopnse which can be
fed into a template entity.

The current alternatives are to publish and subscribe to events or to
store data in input entities.

* Make variables set in actions accessible to templates

* Format code

---------

Co-authored-by: Erik <erik@montnemery.com>
2023-09-02 16:19:45 -07:00
Erik Montnemery f36a300651
Improve template sensor config flow validation (#99373) 2023-08-31 15:16:32 +02:00
Erik Montnemery 8c04e4c7a3
Add explicit test of template config entry setup (#99345) 2023-08-30 19:56:34 +02:00
Erik Montnemery 501d5db375
Add config flow for template binary sensor (#99339) 2023-08-30 17:28:56 +02: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
Ville Skyttä 2399cd283a
Python 3.10 support cleanups (#98640) 2023-08-21 19:14:07 +02:00
G Johansson 207e3f90a6
Modernize template weather (#98064)
* Modernize template weather

* mods

* adds templates

* Fixes

* review comments

* more comments

* Fix validator

* Tests

* Mods

* Fix ruff
2023-08-21 15:48:14 +02:00
Franck Nijhof 868a5f377f
Ruff: isort don't split imports based on trailing comma (#98162) 2023-08-10 14:27:03 +02:00
Erik Montnemery 96c71b214f
Check supported features in calls to vacuum services (#95833)
* Check supported features in vacuum services

* Update tests

* Add comment
2023-07-10 13:05:47 +02:00
Erik Montnemery 68db751ce1
Refactor template image (#95353) 2023-06-27 18:46:36 +02:00
Erik Montnemery 17ac1a6d32
Set automations which fail validation unavailable (#94856) 2023-06-27 18:23:33 +02:00
G Johansson 30d22fe49b
Add new attributes into Template Weather (#95100) 2023-06-27 11:19:51 +02:00
Erik Montnemery 8e2ba81995
Add image platform to the template integration (#94928)
* Add image platform to the template integration

* Set a default name

* Fix typo

* Add tests

* Improve test coverage

* Derive content-type from fetched image
2023-06-26 15:54:51 +02:00
G Johansson 6ad4e13b38
Manual trigger entity and refactor command_line switch (#91506)
* TriggerEntity to CoordinatorTriggerEntity

* _render_templates

* split manual vs coordinator

* name

* ManualTriggerEntity

* value

* Remove ManualTriggerEntity

* ManualTriggerEntity

* process_manual_data

* Add test

* imports

* Move ManualTriggerEntity

* cmd_line switch

* Review comments

* Fix templating

* Review comments

* Remove unneeded logging
2023-05-08 10:19:37 +02:00
Jan Bouwhuis 722b991234
Support unknown state, position or tilt for template cover (#91172)
* Support unknown state for template cover

* Remove not related changes
2023-04-12 21:23:24 +02:00
epenet ff8b91aeea
Add freezer to known test fixtures in pylint (#89825)
Add freezer to known fixtures in pylint
2023-03-16 22:39:41 -04:00
epenet a0f725dfcb
Add type hints to tests (#89497) 2023-03-10 12:06:50 +01:00
epenet 9762b684c2
Adjust entity registry access in tests (3) (#88964) 2023-03-01 16:04:40 +01:00
Erik Montnemery 7bfc7f134c
Reset state of template cover on error (#88915) 2023-02-28 12:06:40 -05:00
Yann Le Moigne 2314d15761
Fix cover template: optimistic mode is ignored (#87925)
* Fix cover template: optimistic mode is ignored (#84334)

* Fix invalid check in is_closed (make test pass)

* Add test for non optimistic cover

* Update homeassistant/components/template/cover.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update test_cover.py

* Fix format

* Fix tests

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-02-22 15:54:18 +01:00
epenet 88cfbf6a34
Add type hints to integration tests (part 22) (#88234) 2023-02-16 14:08:03 +01:00
Franck Nijhof d3ed8de232
Update Ruff to v0.0.247 (#88210)
* Update Ruff to v0.0.247

* Fix new found violations
2023-02-15 16:46:03 -05:00
Franck Nijhof ed79265843
Enable Ruff PT006 (#88165)
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
epenet 278050a73f
Add type hints to integration tests (t-z) (#87707) 2023-02-08 19:10:53 +01:00
Franck Nijhof ef800335fb
Enable Ruff PT022 (#86792)
* Enable Ruff PT022

* Adjust found cases
2023-01-27 13:57:06 +01:00
Franck Nijhof e50a531cd9
Code styling tweaks to the tests - Part 2 (#86662)
Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
2023-01-26 01:23:53 +01:00
epenet 1a8933d59d
Adjust invalid test values in template (#86008) 2023-01-16 14:42:47 +01:00
Franck Nijhof 2e92fefc0a
Fix uom/device class mismatches in tests (#84372) 2022-12-21 22:47:59 +01:00
Petro31 f3007b22c4
Allow setting set_percentage and set_preset_mode of template fan without turning on (#75656)
* decouple set_percentage and set_preset_mode from entity state

* correct set_percent self._state logic

* Add tests

* remove _VALUD_STATES

* decouple percent and preset_mode
2022-10-03 20:22:05 +02:00
epenet 0ac581a0b1
Cleanup EntityFeature in tests (#78859) 2022-09-21 10:48:55 +02:00
epenet 7bc2712142
Adjust root-import in tests (#78761)
* Adjust root-import in tests

* Adjust diagnostics

* Adjust button

* Adjust select

* Adjust device_tracker

* Adjust camera

* Adjust humidifier

* Adjust media_source

* Adjust update

* Adjust siren

* Adjust number

* Adjust alarm_control_panel

* Adjust notify

* Adjust sensor

* Adjust switch

* Revert anthemav

* Don't adjust demo humidifier
2022-09-19 15:22:23 +02:00
Erik Montnemery c134bcc536
Remove use of deprecated SUPPORT_* constants from Template light (#77836) 2022-09-08 11:22:38 +02:00
Erik Montnemery 60c8d95a77
Remove white_value support from light (#76926) 2022-08-18 08:21:05 -04:00