Commit Graph

93 Commits (3f948e027a9304bd7927af1c3e3b61dd25b9c292)

Author SHA1 Message Date
Marc Mueller 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
J. Nick Koston 3c84c7ccf0
Fix memory leak in websocket_api (#42894)
* Fix memory leak in websocket_api

Each named logger lives forever

* tweak
2020-11-06 09:27:41 +01:00
SigmaPic 51f847c4b8
Catch unhandled exception in websocket_api (#42693)
Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-11-03 10:35:45 +01:00
Paulus Schoutsen de12ac354a
Expose more Websocket API constants (#42263) 2020-10-25 21:10:13 +01:00
J. Nick Koston 4a3b40a3ef
Ensure websocket event serializer cache is effective if subscription iden differs (#42226)
Since someone websocket subscriptions will use an iden of 2 for
state_changed event (most comment), and some will use another
number for all events, the cache would not be used because the
iden number was different.  We now cache only the event and
use a fast replace to insert the iden number into the serailized
response.
2020-10-23 01:28:22 +02: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 Koston 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 35cfc80dd7
Log the remote ip address for incoming websocket connections when debug is on (#40581) 2020-09-26 09:32:50 +02: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
J. Nick Koston 741487a1fc
Return the listeners with the template result for the websocket api (#39925) 2020-09-11 13:18:40 -05:00
J. Nick Koston a77e09b2c2
Make async_track_template_result track multiple templates (#39371)
* Make async_track_template_result track multiple templates

Combine template entity updates to only write ha
state once per template group update

* Make async_track_template_result use dataclasses for input/output

* black versions

* naming
2020-08-31 19:07:40 -05:00
Ville Skyttä 1bf2c4d976
Upgrade pylint to 2.6.0 (#39363) 2020-08-29 07:59:24 +02:00
Ville Skyttä b4bac0f7a0
Exception chaining and wrapping improvements (#39320)
* Remove unnecessary exception re-wraps

* Preserve exception chains on re-raise

We slap "from cause" to almost all possible cases here. In some cases it
could conceivably be better to do "from None" if we really want to hide
the cause. However those should be in the minority, and "from cause"
should be an improvement over the corresponding raise without a "from"
in all cases anyway.

The only case where we raise from None here is in plex, where the
exception for an original invalid SSL cert is not the root cause for
failure to validate a newly fetched one.

Follow local convention on exception variable names if there is a
consistent one, otherwise `err` to match with majority of codebase.

* Fix mistaken re-wrap in homematicip_cloud/hap.py

Missed the difference between HmipConnectionError and
HmipcConnectionError.

* Do not hide original error on plex new cert validation error

Original is not the cause for the new one, but showing old in the
traceback is useful nevertheless.
2020-08-28 13:50:32 +02:00
Paulus Schoutsen 2a1fe9d29a
Add websocket trigger/condition commands (#39109) 2020-08-24 23:01:57 +02:00
jjlawren 6d95ee7a00
Websocket media browsing for Plex (#35590)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-08-24 12:41:01 +02:00
J. Nick Koston f560256546
Update websocket api to use async_track_template_result (#39057) 2020-08-21 14:04:29 +02:00
Paulus Schoutsen 3dc79aa60a
Track entity sources (#37258)
Co-authored-by: David Mulcahey <david.mulcahey@me.com>
2020-08-19 14:57:38 +02:00
J. Nick Koston 20d5d3c162
Switch a few more async_track_state_change to the faster async_track_state_change_event (#37833)
async_track_state_change_event is faster than async_track_state_change
and since we do not care about the data being returned to the callback
this is a simple speedup
2020-07-14 22:31:34 -07:00
J. Nick Koston 578d4a9b6a
Make the frontend available sooner (Part 1 of 2) (#36263)
* Part 1 of 2 (no breaking changes in part 1).

When integrations configured via the UI block startup or fail to start,
the webserver can remain offline which make it is impossible
to recover without manually changing files in
.storage since the UI is not available.

This change is the foundation that part 2 will build on
and enable a listener to start the webserver when the frontend
is finished loading.

Frontend Changes (home-assistant/frontend#6068)

* Address review comments

* bump timeout to 1800s, adjust comment

* bump timeout to 4h

* remove timeout failsafe

* and the test
2020-06-02 13:54:11 -05:00
Paulus Schoutsen 276f3afb00
Do async_setup_platform in background (#36244)
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-31 22:18:30 -07:00
Pascal Vizeli ed014e3c96
Revert "Ensure frontend is available if integrations fail to start - Part 1 of 2 (#36093)" (#36251)
This reverts commit fbe7b4ddfa.
2020-05-29 10:18:39 +02:00
J. Nick Koston fbe7b4ddfa
Ensure frontend is available if integrations fail to start - Part 1 of 2 (#36093)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-05-28 21:09:07 -07:00
Ville Skyttä f8416484f8
More data entry flow and HTTP related type hints (#34430) 2020-05-26 09:28:22 -05:00
Joakim Sørensen de7f82e18e
Correct typo Asssitant -> Assistant (#35117) 2020-05-03 11:36:06 +02:00
Paulus Schoutsen 9f1bffe3be
Add command to get integration manifests (#34262)
* Add command to get integration manifests

* Add is_built_in value to manifest

* Update APIs
2020-04-15 13:36:16 -07:00
Paulus Schoutsen d93c09327a
Report unserializable data in websocket (#34072)
* Report unserializable data in websocket

* Fix tests

* log types too
2020-04-13 23:46:41 -07:00
Paulus Schoutsen bea354b82a
Allow WS queue to temporarily peak (#34175)
* Allow WS queue to temporarily peak

* Remove unused code
2020-04-13 18:50:36 -07:00
springstan fca90a8ddc
Improve string formatting v5 (#33697)
* Improve string formatting v5

* Address review comments
2020-04-05 17:48:55 +02:00
springstan e3bcfb88e7
Improve string formatting v4 (#33668)
* Improve string formatting v4

* Use normal strings instead of f-strings

* Fix zeroconf test by adding back part of a condition
2020-04-05 16:01:41 +02:00
Franck Nijhof 7653dc947a
Enable pylint unnecessary-pass (#33650)
* Enable pylint unnecessary-pass

* Process review suggestions

* Fix smhi tests
2020-04-05 10:33:07 +02:00
Paulus Schoutsen f1d3c0d19b
Remove unused manifest fields (#33595) 2020-04-03 12:58:19 -07:00
Paulus Schoutsen 4ebbabcdd1
Unsub dispatcher when removing entity from hass (#33510)
* Unsub dispatcher when removing entity from hass

* Update homeassistant/components/plaato/sensor.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/volvooncall/__init__.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-02 09:25:33 -07:00
Paulus Schoutsen aaa1d06809
Directly call async_write_ha_state (#33508)
* Directly call async_write_ha_state

* Address comments

* Fix tests
2020-04-01 14:19:51 -07:00
Paulus Schoutsen 536b31305a
Support multiple Lovelace dashboards (#32134)
* Support multiple Lovelace dashboards

* Mark collection maintenance as unfinished

* Fix import

* Add websockets commands for resource management

* Revert "Add websockets commands for resource management"

This reverts commit 7d140b2bcc.

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-02-25 11:18:21 -08:00
Ville Skyttä 9b2544c923
Remove some unneeded pylint suppressions (#32152) 2020-02-24 16:47:15 -08:00
Paulus Schoutsen 3b3e062a35
Whitelist shopping list updated event (#31742)
* Whitelist shopping list updated event

* Add ignore to hassfest
2020-02-12 10:13:07 -08:00
Franck Nijhof bfa0edaf92 Migrate Integration Quality Scale from docs to manifest: internal (#30551) 2020-01-07 20:58:49 +01:00
Franck Nijhof b4d6d238e5 Correct names in manifests (T-Z) (#30546) 2020-01-07 14:31:18 +01:00
Franck Nijhof a84741392b
Format all manifests with prettier (#30521) 2020-01-06 21:28:23 +01:00
Paulus Schoutsen b9aba30a6e
Extract Collection helper from Person integration (#30313)
* Add CRUD foundation

* Use collection helper in person integration

* Lint/pytest

* Add tests

* Lint

* Create notification
2020-01-03 21:37:11 +01:00
springstan 6de8072e8a Move imports to top for websocket_api (#29556)
* Move imports to top for websocket_api

* Move back an import because of circular dependency, add annotations
2019-12-08 12:19:15 +01:00
Paulus Schoutsen bd54ff3c02 Add TT WS API (#28599)
* Add TT WS API

* Add a test

* Correctly convert TT errrors
2019-11-08 10:06:16 +01:00
Bram Kragten e419689229 Add config endpoint for scene (#28429)
* Add config endpoint for scene

* Add scenes to default config

* Fix test and add context to websocket service call

* Update scene.py

* Add tests
2019-11-04 12:38:18 -08:00
Ville Skyttä 381d423fec Upgrade mypy to 0.740 (#27913)
* Upgrade mypy to 0.740

http://mypy-lang.blogspot.com/2019/10/mypy-0740-released.html

* Type hint additions

* Type fixes

* Remove no longer needed type ignores and casts

* Disable untyped definition checks in bunch of files
2019-10-19 11:35:57 -07:00
Paulus Schoutsen 3231e22ddf
Remove direct authentication via trusted networks or API password (#27656)
* Remove direct authentication via trusted networks and API password

* Fix tests
2019-10-14 14:56:45 -07:00
Paulus Schoutsen c9e26b6fd0
Improve speed websocket sends messages (#27295)
* Improve speed websocket sends messages

* return -> continue
2019-10-07 20:08:07 -07:00