Commit graph

163 commits

Author SHA1 Message Date
J. Nick Koston
f6a03625ba
Implement websocket message coalescing (#77238)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-08-24 22:50:48 -05:00
uvjustin
d989e4373d
Remove websocket_api send_big_result (#75452) 2022-07-19 21:08:11 -07:00
uvjustin
6b60fb9541
Don't use executor in send_big_result (#75427) 2022-07-19 08:40:23 -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
Zac West
20960e182d
Log unknown websocket commands at info instead of error (#72336) 2022-05-22 22:41:51 -07:00
J. Nick Koston
9c3f949165
Add live streaming logbook websocket endpoint (#72258)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-05-22 14:57:54 -05:00
Franck Nijhof
c8f700c803
Clean up accessing dispatcher helpers via hass (#72014)
Clean up accessing ditpatcher helpers via hass
2022-05-17 18:41:36 +02:00
J. Nick Koston
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 Koston
e2cef55162
Add history/history_during_period websocket endpoint (#71688) 2022-05-11 17:52:22 -05:00
J. Nick Koston
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
Marc Mueller
9b9b553521
Disable no-self-use [pylint] (#70641)
* Disable no-self-use

* Remove disable comments
2022-04-25 07:41:01 -07:00
J. Nick Koston
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
Marc Mueller
53110f8cb7
Update pylint to 2.13.2 (#68704) 2022-03-27 16:08:24 +02:00
Marc Mueller
911b159281
Cleanup after pylint update (#68657) 2022-03-26 00:34:12 +01:00
Franck Nijhof
15cffbe496
Clean up async_dispatcher_connect helper usage (#68613) 2022-03-24 13:19:11 +01:00
J. Nick Koston
ea6da674df
Remove unneeded permissions check from subscribe entities (#68044) 2022-03-12 13:30:27 -08:00
J. Nick Koston
68310a426b
Small code quality improvements for subscribe_entities (#68026) 2022-03-12 02:07:01 -10: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
fbc39d1206
Log stack trace if exception without message (#67587) 2022-03-04 09:48:07 +01:00
Paulus Schoutsen
7f4faafe38
Add type code that is being ignored (#67311) 2022-02-26 13:56:47 -08:00
J. Nick Koston
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
epenet
78e92d1662
Adjust pylint plugin to enforce platform type hints (#64836)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-24 18:51:06 +01:00
Paulus Schoutsen
63f8e437ed
Add Home Assistant Content user (#64337) 2022-01-21 10:06:39 -08:00
Marc Mueller
67c35652f0
Update typing - collections.abc (2) (#63934) 2022-01-12 09:04:37 +01:00
Marc Mueller
bcb93d95bb
Update typing (4) [u-z] (#63925) 2022-01-11 21:26:45 +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üller
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
Stefan Agner
a13ae85982
Introduce only_supervisor for @websocket_api.ws_require_user() (#61298) 2021-12-08 16:49:35 -08:00
Erik Montnemery
caf5ee2fab
Remove optional validation when creating conditions (#60481) 2021-11-28 14:54:07 +01:00
J. Nick Koston
10d6247fee
Bump to aiohttp 3.8.0 (#58974) 2021-11-04 10:07:50 -05:00
Marc Mueller
a48ddcadd4
Use assignment expressions 31 (#58715) 2021-10-30 16:29:07 +02:00
Marc Mueller
aa7dc78a1e
Use assignment expressions 11 (#57792) 2021-10-17 20:15:48 +02:00
Paulus Schoutsen
6d0da631bf
Handle prepare timeout in websocket API (#55989) 2021-10-08 22:12:06 -07:00
David Boslee
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
Marc Mueller
d51487f82a
Import Callable from collections.abc (3) (#56777) 2021-09-29 16:19:06 +02:00
Paulus Schoutsen
677abcd484
Allow confirming local push notifications (#54947)
* Allow confirming local push notifications

* Fix from Zac

* Add tests
2021-09-22 23:17:04 +02:00
Marc Mueller
48bada5a18
Update pylint to 2.11.1 (#56364) 2021-09-18 13:52:59 +02:00
Erik Montnemery
ae507aeed1
Move temperature conversions to sensor base class (8/8) (#54483)
* Move temperature conversions to entity base class (8/8)

* Fix wallbox sensor

* Fix tests
2021-08-11 21:17:16 +02:00
Bram Kragten
fcc6ea7497
Add energy integration (#52001)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Erik <erik@montnemery.com>
2021-07-26 09:37:37 -07:00
Ville Skyttä
470f2dd73f
Upgrade pyupgrade to 2.21.2, apply its changes (#52987) 2021-07-19 10:46:09 +02:00