Commit Graph
100 Commits
Author SHA1 Message Date
J. Nick KostonandGitHub b993fe1c9d Cache generation of the service descriptions (#93131) 2023-05-16 21:42:37 -05:00
J. Nick KostonandGitHub 99265a983a Speed up reconnects by caching state serialize (#93050) 2023-05-16 02:33:12 -05:00
J. Nick KostonandGitHub b95405a7e9 Small performance improvements to state diff messages (#92963)
Adds missing test coverage
2023-05-14 12:28:34 -04:00
J. Nick KostonandGitHub 2848f8648d Log last message when websocket reaches peak limit (#93038)
When we hit the absolute limit, we would log the last messages as
it was key to finding out the source. We now do the same when
we hit the peak limit
2023-05-14 12:22:19 -04:00
J. Nick KostonandGitHub 8711735ec0 Improve websocket throughput and reduce latency (#92967) 2023-05-13 00:13:57 +09:00
Paulus SchoutsenandGitHub 0ca6723378 Allow passing binary to the WS connection (#89882)
* Allow passing binary to the WS connection

* Expand test coverage

* Test non-existing handler

* Allow signaling end of stream using empty payloads

* Store handlers in a list

* Handle binary handlers raising exceptions
2023-03-22 08:36:36 -04:00
ecf87ae979 Improve performance of websocket_api dispatch (#88496)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2023-02-20 19:51:34 +01:00
epenetandGitHub a16e298599 Adjust json imports in tests (#88248) 2023-02-17 19:13:48 +01:00
epenetandGitHub aa50096a31 Add type hints to integration tests (part 24) (#88307) 2023-02-17 16:34:53 +01:00
Franck NijhofandGitHub ed79265843 Enable Ruff PT006 (#88165)
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
epenetandGitHub 278050a73f Add type hints to integration tests (t-z) (#87707) 2023-02-08 19:10:53 +01:00
J. Nick KostonandGitHub 0f4b17755e Improve logging and handling when websocket gets behind (#86854)
fixes undefined
2023-01-29 10:49:27 -10:00
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
Franck NijhofandGitHub 5c99e2e5d3 Improve error logging of WebSocket API (#81360) 2022-11-01 14:11:50 -04:00
Franck NijhofandGitHub bb287dd0ed Integrations v2.1: Virtual integrations (#80613) 2022-10-20 23:09:06 -04:00
Charles GarwoodandGitHub 58d531841b Fix typo SIGNAL_BOOTSTRAP_INTEGRATONS -> SIGNAL_BOOTSTRAP_INTEGRATIONS (#79970) 2022-10-09 17:06:28 -10:00
b173ae7f44 Add support for integrations v2 (#78801)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-09-28 11:31:48 -04:00
Franck NijhofandGitHub a19a7e64d5 Fix WebSocket condition testing (#78570) 2022-09-16 11:18:00 +02:00
Paulus SchoutsenandGitHub 0e734e629c Handle missing supported brands (#78090) 2022-09-09 07:47:33 +02:00
f6a03625ba Implement websocket message coalescing (#77238)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-08-24 22:50:48 -05:00
uvjustinandGitHub d989e4373d Remove websocket_api send_big_result (#75452) 2022-07-19 21:08:11 -07:00
uvjustinandGitHub 6b60fb9541 Don't use executor in send_big_result (#75427) 2022-07-19 08:40:23 -05:00
Paulus SchoutsenandGitHub 41ec8cd354 Expose supported brands via API (#75074) 2022-07-12 13:49:54 -07:00
J. Nick KostonandGitHub 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 KostonandGitHub 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 KostonandGitHub d9d22a9556 Initial orjson support (#72754) 2022-05-31 12:18:11 -07:00
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
Franck NijhofandGitHub 15cffbe496 Clean up async_dispatcher_connect helper usage (#68613) 2022-03-24 13:19:11 +01:00
J. Nick KostonandGitHub 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 SchoutsenandGitHub fbc39d1206 Log stack trace if exception without message (#67587) 2022-03-04 09:48:07 +01:00
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 SchoutsenandGitHub a42547c0e5 Allow get_states to recover (#67146) 2022-02-23 21:15:48 -08:00
Paulus SchoutsenandGitHub 756e711850 Add a new validate config WS command (#67057) 2022-02-22 22:28:37 +01:00
Mike DegatanoandGitHub 8ea6cbc257 Support variables in templates with timeout (#66990) 2022-02-21 09:56:20 -08:00
Erik MontnemeryandGitHub b196064540 Import persistent notification (part 5) (#63902) 2022-01-13 08:45:30 +01:00
Erik MontnemeryandGitHub 6eb0447566 Import websocket_api (part 3) (#63907) 2022-01-11 17:26:37 +01:00
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
Stefan AgnerandGitHub a13ae85982 Introduce only_supervisor for @websocket_api.ws_require_user() (#61298) 2021-12-08 16:49:35 -08:00
J. Nick KostonandGitHub 10d6247fee Bump to aiohttp 3.8.0 (#58974) 2021-11-04 10:07:50 -05:00
Paulus SchoutsenandGitHub 6d0da631bf Handle prepare timeout in websocket API (#55989) 2021-10-08 22:12:06 -07:00
7f966613bd Disconnect websockets after token is revoked (#57091)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-10-08 09:38:22 -07:00
Erik MontnemeryandGitHub 6954614e62 Warn if total_increasing sensor has negative states (#56564) 2021-09-30 07:49:16 -07:00
Erik MontnemeryandGitHub bfd799dc04 Use hass_client_no_auth test fixture in integrations s-x (#55585) 2021-09-02 14:50:10 +02:00
Ruslan SayfutdinovandGitHub 42ff687c32 Add missing type hints to websocket_api (#50915) 2021-05-21 09:39:18 -07:00
jan iversenandGitHub 9879b7becf Rename HomeAssistantType to HomeAssistant, integrations w* - z* (#49543)
* Integration zha: HomeAssistantType -> HomeAssistant.

* Integration zerproc: HomeAssistantType -> HomeAssistant.

* Integration xbox: HomeAssistantType -> HomeAssistant.

* Integration wunderground: HomeAssistantType -> HomeAssistant.

* Integration wled: HomeAssistantType -> HomeAssistant.

* Integration water_heater: HomeAssistantType -> HomeAssistant.

* Integration websocket_api: HomeAssistantType -> HomeAssistant.

* Integration wilight: HomeAssistantType -> HomeAssistant.
2021-04-22 11:04:28 -04:00
J. Nick KostonandGitHub 53853f035d Prevent calling stop or restart services during db upgrade (#49098) 2021-04-12 17:18:38 -07:00
Erik MontnemeryandGitHub 16196e2e16 Don't log template errors from developer tool (#48933) 2021-04-09 12:10:02 -07:00
J. Nick KostonandGitHub 1f80c756ab Fix subscribe_bootstrap_integrations to send events (#48754) 2021-04-08 07:30:33 -10:00
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 SchoutsenandGitHub bdbb4f939f Add variables to execute script (#48613) 2021-04-02 06:27:41 -07:00