Commit Graph
1260 Commits
Author SHA1 Message Date
Erik MontnemeryandGitHub 1654ef7759 Make WS command render_template not give up if initial render raises (#99808) 2023-09-08 21:02:06 +02:00
J. Nick KostonandGitHub 034fabe188 Use loop time to set context (#99701)
* Use loop time to set context

loop time is faster than utcnow, and since its only used internally it can
be switched without a breaking change

* fix mocking
2023-09-06 11:04:49 +02:00
Erik MontnemeryandGitHub 48f7924e9e Allow specifying a custom log function for template render (#99572)
* Allow specifying a custom log function for template render

* Bypass template cache when reporting errors + fix tests

* Send errors as events

* Fix logic for creating new TemplateEnvironment

* Add strict mode back

* Only send error events if report_errors is True

* Force test of websocket_api only

* Debug test

* Run pytest with higher verbosity

* Timeout after 1 minute, enable syslog output

* Adjust timeout

* Add debug logs

* Fix unsafe call to WebSocketHandler._send_message

* Remove debug code

* Improve test coverage

* Revert accidental change

* Include severity in error events

* Remove redundant information from error events
2023-09-06 10:03:35 +02:00
J. Nick KostonandGitHub a2dae60170 Refactor dispatcher to reduce run time and memory overhead (#99676)
* Fix memory leak in dispatcher removal

When we removed the last job/callable from the dict for the
signal we did not remove the dict for the signal which meant
it leaked

* comment

* cleanup a bit more
2023-09-05 21:18:27 -04:00
709ce7e0af Set state of entity with invalid state to unknown (#99452)
* Set state of entity with invalid state to unknown

* Add test

* Apply suggestions from code review

Co-authored-by: Robert Resch <robert@resch.dev>

* Update test_entity.py

---------

Co-authored-by: Robert Resch <robert@resch.dev>
2023-09-04 14:09:51 +02:00
Erik MontnemeryandGitHub 9dac6a2948 Use loop.time in DataUpdateCoordinator (#98937) 2023-08-28 10:16:34 -05:00
Ville SkyttäandGitHub 6399d74c15 Remove unnnecessary pylint configs from core (#98704) 2023-08-22 23:12:12 +02:00
Ville SkyttäandGitHub 3094991236 Upgrade ruff to 0.0.285 (#98647) 2023-08-19 08:17:17 -04:00
7fcc2dd44e Make the check_config script open issue_registry read only (#98545)
* Don't blow up if validators can't access the issue registry

* Make the check_config script open issue_registry read only

* Update tests/helpers/test_issue_registry.py

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

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-08-18 20:15:00 +02:00
Marc MuellerandGitHub a9ade1f84d Use asyncio.timeout [core] (#98447) 2023-08-15 08:36:05 -05:00
Erik MontnemeryandGitHub 97f3199d6d Do not add entities with invalid device info (#98150) 2023-08-11 13:14:47 +02:00
Franck NijhofandGitHub 296c27859e Fix issue registry sending unneeded update events (#98230) 2023-08-10 21:57:42 -04:00
Erik MontnemeryandGitHub 4e8b81370e Adjust device_registry tests which create devices (#98215) 2023-08-10 19:28:33 +02:00
Erik MontnemeryandGitHub c7b4d4f361 Adjust helpers tests which create devices (#98214) 2023-08-10 19:28:16 +02:00
Marc MuellerandGitHub f39a35c4ef Fix jinja2 DeprecationWarnings (#97728) 2023-08-04 11:25:08 +02:00
83af2f5b8b Allow to sort options in select selector (#97680)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-08-03 21:49:22 +02:00
MeowandGitHub 6fd60024cc Refactored deprecated UNITS (#97368) 2023-08-03 21:12:01 +02:00
Franck NijhofandGitHub af5fc7e759 Ensure load the device registry if it contains invalid configuration URLs (#97589) 2023-08-01 23:15:31 +02:00
J. Nick KostonandGitHub 094f2cbad7 Fix saving subclassed datetime objects in storage (#97502) 2023-07-31 18:49:02 +02:00
J. Nick KostonandGitHub 13349e76ed Avoid firing update coordinator callbacks when nothing has changed (#97268) 2023-07-28 12:19:20 -05:00
Franck NijhofandGitHub 737ac8c600 Fix DeviceInfo configuration_url validation (#97319) 2023-07-27 18:57:01 +02:00
Franck NijhofandGitHub b655b9d530 Allow for translating service examples (#97141) 2023-07-24 15:57:02 +02:00
Marc MuellerandGitHub 995c29e052 Cleanup EventType typing (#97136) 2023-07-24 13:18:38 +02:00
Marc MuellerandGitHub 4161f53bea Improve async_track_state_change_filtered callback typing (#97134) 2023-07-24 12:42:29 +02:00
Marc MuellerandGitHub 582499a260 Improve async_track_template_result callback typing (#97135) 2023-07-24 12:42:17 +02:00
Marc MuellerandGitHub 797a9c1ead Improve async_track_state_added/removed_domain callback typing (#97126) 2023-07-24 09:11:41 +02:00
Marc MuellerandGitHub 2618bfc073 Use EventType for state changed [core] (#97115) 2023-07-23 18:10:03 -05:00
Jan BouwhuisandGitHub 9424d11408 Allow homeassistant in MQTT configuration_url schema (#96107) 2023-07-22 22:50:58 +02:00
Erik MontnemeryandGitHub df46179d26 Fix broken service test (#96943) 2023-07-20 13:11:55 +02:00
0ba2531ca4 Fix bug in check_config when an integration is removed by its own validator (#96068)
* Raise if present is False

* Fix feedback

* Update homeassistant/helpers/check_config.py

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

* Update homeassistant/helpers/check_config.py

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

* Fix tests

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-07-20 11:45:44 +02:00
J. Nick KostonandGitHub 01e66d6fb2 Improve handling of unrecoverable storage corruption (#96712)
* Improve handling of unrecoverable storage corruption

fixes #96574

If something in storage gets corrupted core can boot loop
or if its integration specific, the integration will fail to
start.

We now complainly loudly in the log, move away the corrupt data
and start fresh to allow startup to proceed so the user can
get to the UI and restore from backup without having to attach
a console (or otherwise login to the OS and manually modify files).

* test for corruption

* ensure OSError is still fatal

* one more case

* create an issue for corrupt storage

* fix key

* persist

* feedback

* feedback

* better to give the full path

* tweaks

* grammar

* add time

* feedback

* adjust

* try to get issue_domain from storage key

* coverage

* tweak wording some more
2023-07-19 09:23:12 +02:00
Paul BotteinandGitHub d8c989f732 Make default theme selectable for set theme service (#96849) 2023-07-18 17:36:35 +02:00
Franck NijhofandGitHub b9f92b526b Add prefix support to text selector (#96830) 2023-07-18 12:17:31 +02:00
J. Nick KostonandGitHub bc6a41fb94 Remove deprecated state.get_changed_since (#96579) 2023-07-18 09:42:48 +02:00
7ec506907c Ensure async_get_system_info does not fail if supervisor is unavailable (#96492)
* Ensure async_get_system_info does not fail if supervisor is unavailable

fixes #96470

* fix i/o in the event loop

* fix tests

* handle some more failure cases

* more I/O here

* coverage

* coverage

* Update homeassistant/helpers/system_info.py

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* remove supervisor detection fallback

* Update tests/helpers/test_system_info.py

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-07-16 11:10:07 -04:00
Erik MontnemeryandGitHub 614f3c6a15 Move device info validation to device registry (#96465)
* Move device info validation to device registry

* Don't move DeviceInfo

* Fix type annotation

* Don't block adding device for unknown config entry

* Fix test

* Remove use of locals()

* Improve error message
2023-07-14 08:55:17 -04:00
Erik MontnemeryandGitHub 7539cf25be Don't require passing identifiers to DeviceRegistry.async_get_device (#96479)
* Require keyword arguments to DeviceRegistry.async_get_device

* Update tests

* Update tests

* Don't enforce keyword arguments
2023-07-13 13:39:25 -04:00
J. Nick KostonandGitHub 08af42b00e Fix mixed case service schema registration (#96448) 2023-07-12 14:39:51 -10:00
Paul BotteinandGitHub e513b7d0eb Add condition selector for blueprint (#96350)
* Add condition selector for blueprint

* Add tests and validation

* Update comment
2023-07-12 10:58:35 -04:00
594d240a96 Migrate & fix logger services to support translations (#96393)
* Migrate logger services to support translations

* Fix tests and schema validation

* Apply suggestions from code review

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

---------

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
2023-07-12 10:37:18 -04:00
Franck NijhofandGitHub f054de0ad5 Add support for service translations (#95984) 2023-07-11 15:52:12 +02:00
eee8566694 Differentiate between device info types (#95641)
* Differentiate between device info types

* Update allowed fields

* Update homeassistant/helpers/entity_platform.py

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

* Split up message in 2 lines

* Use dict for device info types

* Extract device info function and test error checking

* Simplify parsing device info

* move checks around

* Simplify more

* Move error checking around

* Fix order

* fallback config entry title to domain

* Remove fallback for name to config entry domain

* Ensure mocked configuration URLs are strings

* one more test case

* Apply suggestions from code review

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

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-07-10 09:56:06 -04:00
Erik MontnemeryandGitHub 3d064b7d6b Add filters to cover/services.yaml (#95854) 2023-07-08 11:51:02 +02:00
Jan BouwhuisandGitHub 18ee9f4725 Refactor async_get_hass to rely on threading.local instead of a ContextVar (#96005)
* Test for async_get_hass

* Add Fix
2023-07-07 14:52:38 -04:00
Erik MontnemeryandGitHub 86a397720f Move platform_integration_no_support issue to the homeassistant integration (#95927)
* Move platform_integration_no_support issue to the homeassistant integration

* Update test

* Improve repair text

* Update test
2023-07-07 13:31:54 +02:00
J. Nick KostonandGitHub b7b8afffd0 Handle integrations with empty services or failing to load during service description enumeration (#95911)
* wip

* tweaks

* tweaks

* add coverage

* complain loudly as we never execpt this to happen

* ensure not None

* comment it
2023-07-06 11:19:06 -04:00
Jan BouwhuisandGitHub b9c7e7c15e Fix not including device_name in friendly name if it is None (#95485)
* Omit device_name in friendly name if it is None

* Fix test
2023-07-06 11:14:09 -04:00
Bram KragtenandGitHub 342d07cb92 Set correct response value in service description when async_set_service_schema is used (#95985)
* Mark scripts as response optional, make it always return a response if return_response is set

* Update test_init.py

* Revert "Update test_init.py"

This reverts commit 8e113e54db.

* Split + add test
2023-07-06 10:24:34 -04:00
J. Nick KostonandGitHub b2e708834f Add slots to the StateMachine class (#95849) 2023-07-05 14:00:37 +02:00
J. Nick KostonandGitHub b24c6adc75 Avoid regex for negative zero check in sensor (#95691)
* Avoid regex for negative zero check in sensor

We can avoid calling the regex for every sensor value
since most of the time values are not negative zero

* tweak

* tweak

* Apply suggestions from code review

* simpler

* cover

* safer and still fast

* safer and still fast

* prep for py3.11

* fix check

* add missing cover

* more coverage

* coverage

* coverage
2023-07-02 21:53:50 -04:00