Commit Graph
77 Commits
Author SHA1 Message Date
Jan Bouwhuis 23bc39b7f4 Add type hints on Template().__init__() (#82574) 2022-11-23 20:26:55 +01:00
Franck Nijhof bb287dd0ed Integrations v2.1: Virtual integrations (#80613) 2022-10-20 23:09:06 -04:00
Charles Garwood 58d531841b Fix typo SIGNAL_BOOTSTRAP_INTEGRATONS -> SIGNAL_BOOTSTRAP_INTEGRATIONS (#79970) 2022-10-09 17:06:28 -10:00
Erik MontnemeryandMartin Hjelmare b173ae7f44 Add support for integrations v2 (#78801)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-09-28 11:31:48 -04:00
Franck Nijhof a19a7e64d5 Fix WebSocket condition testing (#78570) 2022-09-16 11:18:00 +02:00
Paulus Schoutsen 0e734e629c Handle missing supported brands (#78090) 2022-09-09 07:47:33 +02:00
J. Nick KostonandPaulus Schoutsen f6a03625ba Implement websocket message coalescing (#77238)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-08-24 22:50:48 -05:00
J. Nick Koston 61cc9f5288 Consolidate executor jobs when loading integration manifests (#75176) 2022-07-14 13:06:08 -07:00
Paulus Schoutsen 41ec8cd354 Expose supported brands via API (#75074) 2022-07-12 13:49:54 -07:00
J. Nick Koston 8b067e83f7 Initial orjson support take 3 (#73849)
* Initial orjson support take 2

Still need to work out problem building wheels

--

Redux of #72754 / #32153 Now possible since the following is solved:
ijl/orjson#220 (comment)

This implements orjson where we use our default encoder.  This does not implement orjson where `ExtendedJSONEncoder` is used as these areas tend to be called far less frequently.  If its desired, this could be done in a followup, but it seemed like a case of diminishing returns (except maybe for large diagnostics files, or traces, but those are not expected to be downloaded frequently).

Areas where this makes a perceptible difference:
- Anything that subscribes to entities (Initial subscribe_entities payload)
- Initial download of registries on first connection / restore
- History queries
- Saving states to the database
- Large logbook queries
- Anything that subscribes to events (appdaemon)

Cavets:
orjson supports serializing dataclasses natively (and much faster) which
eliminates the need to implement `as_dict` in many places
when the data is already in a dataclass. This works
well as long as all the data in the dataclass can also
be serialized. I audited all places where we have an `as_dict`
for a dataclass and found only backups needs to be adjusted (support for `Path` needed to be added for backups).  I was a little bit worried about `SensorExtraStoredData` with `Decimal` but it all seems to work out from since it converts it before it gets to the json encoding cc @dgomes

If it turns out to be a problem we can disable this
with option |= [orjson.OPT_PASSTHROUGH_DATACLASS](https://github.com/ijl/orjson#opt_passthrough_dataclass) and it
will fallback to `as_dict`

Its quite impressive for history queries
<img width="1271" alt="Screen_Shot_2022-05-30_at_23_46_30" src="https://user-images.githubusercontent.com/663432/171145699-661ad9db-d91d-4b2d-9c1a-9d7866c03a73.png">

* use for views as well

* handle UnicodeEncodeError

* tweak

* DRY

* DRY

* not needed

* fix tests

* Update tests/components/http/test_view.py

* Update tests/components/http/test_view.py

* black

* templates
2022-06-22 21:59:51 +02:00
J. Nick Koston c365454afb Revert "Initial orjson support (#72754)" (#72789)
This was causing the wheels to fail to build. We need
to workout why when we don't have release pressure

This reverts commit d9d22a9556.
2022-05-31 13:51:55 -07:00
J. Nick Koston d9d22a9556 Initial orjson support (#72754) 2022-05-31 12:18:11 -07:00
J. Nick KostonandPaulus Schoutsen 78f0716574 Add support for specifying the integrations manifest/list fetches (#71982)
* Add support for specifying the integrations manifest/list fetches

See https://github.com/home-assistant/core/pull/71979 for
the motovation

* Update homeassistant/components/websocket_api/commands.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-05-17 01:22:56 -05:00
J. Nick KostonandPaulus Schoutsen d612b9e0b4 Reduce event loop overhead for listeners that already queue (#71364)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-05-05 23:09:10 -04:00
J. Nick KostonandMartin Hjelmare fe6a4bfb1d Remove EVENT_TIME_CHANGED and EVENT_TIMER_OUT_OF_SYNC (#69643)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-04-09 09:05:54 -10:00
J. Nick Koston ea6da674df Remove unneeded permissions check from subscribe entities (#68044) 2022-03-12 13:30:27 -08:00
J. Nick Koston 0d8f649bd6 Websocket api to subscribe to entities (payloads reduced by ~80%+ vs state_changed events) (#67891) 2022-03-11 20:54:49 -08:00
Paulus Schoutsen 7f4faafe38 Add type code that is being ignored (#67311) 2022-02-26 13:56:47 -08:00
J. Nick KostonandPaulus Schoutsen c9e46d360b Use compact encoding for JSON websocket messages (#67148)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-02-23 22:15:20 -08:00
Paulus Schoutsen a42547c0e5 Allow get_states to recover (#67146) 2022-02-23 21:15:48 -08:00
Paulus Schoutsen 756e711850 Add a new validate config WS command (#67057) 2022-02-22 22:28:37 +01:00
Mike Degatano 8ea6cbc257 Support variables in templates with timeout (#66990) 2022-02-21 09:56:20 -08:00
Marc Mueller b2ee7cebc9 Improve setup_time typing (#66509) 2022-02-14 14:24:58 +01:00
Erik Montnemery 8d6e2ae354 Import persistent notification part 1 (#63898) 2022-01-11 17:24:59 +01:00
Marc Mueller 198ade5e2b Fix typing TrackTemplateResultListener [helpers.event] (#63541) 2022-01-06 13:43:54 -10:00
Nico MüllerandPaulus Schoutsen cf1df5ff38 Add 'fire_event' command to websocket api (#63378)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-01-05 12:28:40 -08:00
Michael 90e52cd3ad Use relative imports [S-Z] (#61576) 2021-12-13 09:39:13 +01:00
Erik Montnemery caf5ee2fab Remove optional validation when creating conditions (#60481) 2021-11-28 14:54:07 +01:00
Marc Mueller aa7dc78a1e Use assignment expressions 11 (#57792) 2021-10-17 20:15:48 +02:00
Ville Skyttä 470f2dd73f Upgrade pyupgrade to 2.21.2, apply its changes (#52987) 2021-07-19 10:46:09 +02:00
Ruslan Sayfutdinov 42ff687c32 Add missing type hints to websocket_api (#50915) 2021-05-21 09:39:18 -07:00
Paulus Schoutsen 1e10772497 Add support for local push channels to mobile_app (#50750) 2021-05-17 11:06:42 -07:00
J. Nick Koston 53853f035d Prevent calling stop or restart services during db upgrade (#49098) 2021-04-12 17:18:38 -07:00
Jason 7cc857a298 Add custom JSONEncoder for subscribe_trigger WS endpoint (#48664) 2021-04-09 20:47:10 -07:00
Erik Montnemery 16196e2e16 Don't log template errors from developer tool (#48933) 2021-04-09 12:10:02 -07:00
J. Nick Koston 1f80c756ab Fix subscribe_bootstrap_integrations to send events (#48754) 2021-04-08 07:30:33 -10:00
J. Nick KostonandPaulus Schoutsen 12e3bc8101 Provide api to see which integrations are being loaded (#48274)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-04 22:11:44 -10:00
Paulus Schoutsen bdbb4f939f Add variables to execute script (#48613) 2021-04-02 06:27:41 -07:00
J. Nick Koston 1fb9008488 Include platform only integrations in the manifest list api (#48269) 2021-03-29 12:51:48 +02:00
Erik Montnemery 333e6a215a Add execute_script WS API (#47964)
* Add execute_script WS API

* Improve tests
2021-03-16 08:51:00 +01:00
Paulus Schoutsen 4c181bbfe5 Raise error instead of crashing when template passed to call service target (#47467) 2021-03-05 15:34:18 -08:00
Bram Kragten 4b493c5ab9 Add target to service call API (#45898)
* Add target to service call API

* Fix _async_call_service_step

* CONF_SERVICE_ENTITY_ID overrules target

* Move merging up before processing schema

* Restore services.yaml

* Add test
2021-02-10 12:42:28 +01:00
Marc MuellerandMartin Hjelmare fb39185420 Add schema error handling to websocket_api (#45602)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-01-27 15:20:22 +01:00
Kendell R 5b67030c26 Change WHITELIST to ALLOWLIST for websockets (#44766) 2021-01-04 12:40:03 +01:00
Jason Cronquist 787027958d Use the async_call context in result of call_service (#44458) 2020-12-31 16:15:39 -10:00
Philip Allgaier dde6305549 Cleanup unused loggers (components N-Z + tests) (#41982) 2020-10-16 21:24:08 -05:00
J. Nick Koston b897ca7260 Ensure all template errors are caught and the websocket api reports them (#41719) 2020-10-12 16:38:24 +02:00
J. Nick Koston e08ee282ab Abort execution of template renders that overwhelm the system (#40647) 2020-09-28 14:43:22 +02:00
J. Nick KostonandPaulus Schoutsen 57b7559832 Ensure all jinja2 errors are trapped and displayed in the developer tools (#40624)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-09-26 17:03:32 -05:00
J. Nick Koston f0f817c361 Serialize websocket event message once (#40453)
Since most of the json serialize work for the websocket was done
multiple times for the same message, we can avoid the overhead
of serializing the same message many times (once per websocket
client) with a cache.
2020-09-22 08:47:04 -05:00