Commit Graph
59 Commits
Author SHA1 Message Date
SidandGitHub 895f73d8e4 Enable Ruff A001 (#115654) 2024-04-21 23:25:27 +02:00
9bf87329da Enable Ruff FLY002 rule (#115112)
Co-authored-by: J. Nick Koston <[email protected]>
Co-authored-by: Jan Bouwhuis <[email protected]>
2024-04-12 09:04:16 +02:00
epenetandGitHub 0b01326f9f Use is in ConfigEntryState enum comparison in tests (A-M) (#114925) 2024-04-05 17:16:55 +02:00
SidandGitHub d5f883fbf0 Unignore Ruff PLR in tests (#114470)
* Unignore Ruff PLR in tests

* Address review comments

* review comments

* fix import

* Update test_api.py

* Update test_api.py

* Update test_api.py
2024-04-01 11:11:59 +02:00
6bb4e7d62c Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <[email protected]>
Co-authored-by: Marc Mueller <[email protected]>
Co-authored-by: J. Nick Koston <[email protected]>
2024-03-26 00:02:16 +01:00
SidandGitHub ccd2e989c3 Enable ruff RUF005 and fix occurrences (#113589) 2024-03-16 07:37:20 -10:00
Marc MuellerandGitHub cb8c14496c Use more f-strings [ruff] (#112695) 2024-03-08 18:44:42 +01:00
Marc MuellerandGitHub 38adfbf1a3 Add empty line after module docstring [tests a-e] (#112708) 2024-03-08 08:50:25 -05:00
J. Nick KostonandGitHub f6d4617c7a Avoid directly changing config entry state in tests (part 2) (#110115)
followup to #110048 for more places
2024-02-10 07:20:15 +01:00
Erik MontnemeryandGitHub 087df10d27 Improve validation of device automations (#102766)
* Improve validation of device automations

* Improve comments

* Address review comment
2023-10-26 09:46:16 +02:00
789a00043a Use real devices in device automation tests (#102736)
Co-authored-by: J. Nick Koston <[email protected]>
2023-10-25 06:14:53 +02:00
Erik MontnemeryandGitHub 4536720540 Use real devices in device_automation device trigger tests (#102684) 2023-10-24 21:57:42 +02:00
Erik MontnemeryandGitHub 3b9d6f2dde Add setup function to the component loader (#98148)
* Add setup function to the component loader

* Update test

* Setup the loader in safe mode and in check_config script
2023-08-15 10:59:42 +02:00
Erik MontnemeryandGitHub e1e4b0dcf0 Adjust device_automation tests which create devices (#98187) 2023-08-10 18:25:42 +02:00
a338e7e242 Use entity registry id in toggle_entity device automations (#94995)
* Use entity registry id in toggle_entity device automations

* Update tests

---------

Co-authored-by: J. Nick Koston <[email protected]>
2023-06-26 09:59:01 +02:00
Jan BouwhuisandGitHub ec98e22330 Add type hints for stub_blueprint_populate fixture (#93568)
Add typehints for stub_blueprint_populate fixture
2023-05-26 08:13:13 +02:00
Erik MontnemeryandGitHub 3cca338c6e Improve blueprint test fixtures (#93519) 2023-05-25 13:45:19 +02:00
J. Nick KostonandGitHub ead761dfa2 Ensure device_automation can handle RequirementsNotFound (#92037) 2023-04-26 18:43:38 +02:00
epenetandGitHub 728f62b1ec Add type hints to integration tests (part 5) (#87850) 2023-02-12 19:39:48 +01:00
Franck NijhofandGitHub 51a9f65a01 Clean up unnecessary registry mocks from Core tests (#87726) 2023-02-08 13:28:44 -06:00
epenetandGitHub 3052de3e8e Add type hints to integration tests (d-e) (#87699) 2023-02-08 13:01:44 +01:00
Erik MontnemeryandGitHub 1e2f00e186 Improve device automation validation (#86143) 2023-01-21 00:44:17 +01:00
Erik MontnemeryandGitHub 9af17fa5a0 Improve device automation tests (#84972) 2023-01-02 12:33:38 +01:00
Erik MontnemeryandGitHub 43091a9856 Revert "Improve device_automation trigger validation" (#79778)
Revert "Improve device_automation trigger validation (#75044)"

This reverts commit 55b036ec5e.
2022-10-07 08:23:53 -04:00
Ben RandallandGitHub 55b036ec5e Improve device_automation trigger validation (#75044)
* improve device_automation trigger validation

Validates the trigger configuration against the device_trigger schema before trying to access any of the properties in order to provide better error messages.
Updates the error message to include an explicit indication that the error is coming from a trigger configuration.  The inner error message from the validator can be accessed by viewing the stack trace.
Add test case for trigger missing domain.

Make action and condition validation consistent with trigger.  This is not strictly necessary, but should be helpful for certain use cases that bypass some of the outer validation.

Removed redundant schema elements from humidifier device_trigger.

**Blueprint with missing `domain`**
```
2022-07-12 06:02:18.351 ERROR (MainThread) [homeassistant.setup] Error during setup of component automation
Traceback (most recent call last):
  File "/workspaces/core/homeassistant/setup.py", line 235, in _async_setup_component
    result = await task
  File "/workspaces/core/homeassistant/components/automation/__init__.py", line 241, in async_setup
    if not await _async_process_config(hass, config, component):
  File "/workspaces/core/homeassistant/components/automation/__init__.py", line 648, in _async_process_config
    await async_validate_config_item(hass, raw_config),
  File "/workspaces/core/homeassistant/components/automation/config.py", line 74, in async_validate_config_item
    config[CONF_TRIGGER] = await async_validate_trigger_config(
  File "/workspaces/core/homeassistant/helpers/trigger.py", line 59, in async_validate_trigger_config
    conf = await platform.async_validate_trigger_config(hass, conf)
  File "/workspaces/core/homeassistant/components/device_automation/trigger.py", line 67, in async_validate_trigger_config
    hass, config[CONF_DOMAIN], DeviceAutomationType.TRIGGER
KeyError: 'domain'
```

**Blueprint with missing `property` (specific to zwave_js event schema)**
```
2022-07-12 06:09:54.206 ERROR (MainThread) [homeassistant.components.automation] Blueprint Missing Property generated invalid automation with inputs OrderedDict([('control_switch', '498be56d796836a67406e9ad373d23db')]): required key not provided @ data['property']. Got None
```

**Blueprint with missing `domain`**
```
2022-07-12 06:12:16.080 ERROR (MainThread) [homeassistant.components.automation] Blueprint Missing Domain generated invalid automation with inputs OrderedDict([('control_switch', '498be56d796836a67406e9ad373d23db')]): invalid trigger configuration: required key not provided @ data['domain']. Got <homeassistant.components.blueprint.models.BlueprintInputs object at 0x7f581e097820>
```

**Blueprint with missing `property` (specific to zwave_js event schema)**
```
2022-07-12 06:12:16.680 ERROR (MainThread) [homeassistant.components.automation] Blueprint Missing Property generated invalid automation with inputs OrderedDict([('control_switch', '498be56d796836a67406e9ad373d23db')]): invalid trigger configuration: required key not provided @ data['property']. Got <homeassistant.components.blueprint.models.BlueprintInputs object at 0x7f581c0dc9d0>
```

* Revert humifidier TRIGGER_SCHEMA change.
2022-10-03 16:42:57 +02:00
Erik MontnemeryandGitHub 5e50a8abd5 Mark device triggers from hidden or auxiliary entities as secondary (#70335)
* Mark device triggers from hidden or auxiliary entities as secondary

* Update tests
2022-04-21 08:01:32 +02:00
Erik MontnemeryandGitHub 150f173eed Mark device conditions from hidden or auxiliary entities as secondary (#70333) 2022-04-20 21:41:59 +02:00
Erik MontnemeryandGitHub 64381acbaf Mark device actions from hidden or auxiliary entities as secondary (#70278) 2022-04-20 10:48:46 -07:00
Paulus SchoutsenandGitHub 824066f519 Device Automation: enforce passing in device-automation-enum (#69013) 2022-03-31 14:30:11 -07:00
Erik MontnemeryandGitHub 513d6cc467 Change value of device_automation constant (#64296)
* Change value of constant CONF_CHANGED_STATES

* Adjust tests
2022-01-17 16:34:40 +01:00
e9b746e874 Add turned on or off device trigger to toggle entity (#61089)
* Add turned on or off device trigger to toggle entity

* Renamed changed_states trigger to toggled

* Adjust tests

* Fix homekit triggers test

* Add tests

* Adjust tests after rebase

Co-authored-by: J. Nick Koston <[email protected]>
2022-01-03 10:41:30 +01:00
Ville SkyttäandGitHub 334c6c5c02 Make device automation type an enum (#62354) 2021-12-20 19:16:30 +01:00
Paulus SchoutsenandGitHub 77d02d08bc Validate device automation capablities WS calls (#58444) 2021-10-26 14:47:07 +02:00
418d6a6a41 Guard for unexpected exceptions in device automation (#55639)
* Guard for unexpected exceptions in device automation

* merge

Co-authored-by: J. Nick Koston <[email protected]>
2021-09-03 09:04:50 -07:00
J. Nick KostonandGitHub 4bde4504ec Add api to device_automation to return all matching devices (#53361) 2021-08-10 14:21:34 -05:00
312531988a Vacation Mode on Alarm Panels (#45980)
Co-authored-by: Nathan Tilley <[email protected]>
Co-authored-by: Martin Hjelmare <[email protected]>
Co-authored-by: Franck Nijhof <[email protected]>
Co-authored-by: Khole Jones <[email protected]>
Co-authored-by: Erik Montnemery <[email protected]>
2021-07-01 17:26:32 +02:00
Joakim SørensenandGitHub 2f10f59717 Block custom integrations with missing or invalid version (#49916) 2021-05-17 15:48:41 +02:00
Ruslan SayfutdinovandGitHub 02764c2f46 Disable strict type checks for tests (#49851) 2021-04-29 15:57:02 +02:00
Ville SkyttäandGitHub dc880118a4 Lint suppression cleanups (#47248)
* Unused pylint suppression cleanups

* Remove outdated pylint bug references

* Add flake8-noqa config and note to run it every now and then

* Add codes to noqa's

* Unused noqa cleanups
2021-03-02 09:02:04 +01:00
b3be708db6 Add default config if not there (#43321)
Co-authored-by: Bram Kragten <[email protected]>
2020-11-25 15:10:04 +01:00
Bas NijholtandGitHub 0427d87ba4 Bump codespell from v1.16.0 to v1.17.1 and fix new spelling errors (#38663) 2020-08-08 14:41:02 +02:00
276f3afb00 Do async_setup_platform in background (#36244)
Co-authored-by: J. Nick Koston <[email protected]>
2020-05-31 22:18:30 -07:00
Paulus SchoutsenandGitHub 7127310f10 Catch device not found in device automations (#31401) 2020-02-02 07:13:07 -08:00
Christian ClaussandQuentame 1d537ad416 Fix typo: serivce --> service (#31217) 2020-01-27 19:56:26 +01:00
Bas NijholtandFranck Nijhof 2cd55bbb87 Sort imports according to PEP8 for device_automation (#29707) 2019-12-09 11:24:49 +01:00
SukramJandPaulus Schoutsen 1fde0d18ed Add supported_features to Alarm Control Panel to limit device_actions (#29065)
* Add supported_features to Alarm Control Panel

* mark supported_features abstract

* Add SF to async_register_entity_service

* fix test

* Add missing SF SUPPORT_ALARM_ARM_CUSTOM_BYPASS

* isort

* fix async_register_entity_service

* Update alarm_control_panel.py
2019-11-25 15:42:53 -08:00
Erik MontnemeryandPaulus Schoutsen 43c85c0549 Add device action support to the alarm_control_panel integration (#27616)
* Add device action support to the alarm_control_panel integration

* Improve tests
2019-10-16 21:34:56 -07:00
Erik MontnemeryandPaulus Schoutsen cda7692f24 Add support for for to binary_sensor, light and switch device conditions (#27153)
* Add support for `for` to binary_sensor, light and switch device conditions

* Fix typing

* Fixup

* Fixup
2019-10-03 13:29:57 -07:00
Erik MontnemeryandPaulus Schoutsen c43eeee62f Improve validation of device condition config (#27131)
* Improve validation of device condition config

* Fix typing
2019-10-02 15:58:14 -07:00
Erik MontnemeryandGitHub 65ce3b49c1 Add support for for to binary_sensor, light and switch device triggers (#26658)
* Add support for `for` to binary_sensor, light and switch device triggers

* Add WS API device_automation/trigger/capabilities
2019-10-02 22:14:52 +02:00