-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up frontend services and events #31654
Conversation
Hey there @home-assistant/frontend, mind taking a look at this pull request as its been labeled with a integration ( |
Does this disable Home Assistant users to choose their front-end theme from an input_select box, like shown here? That would be a major bummer if it were the case, as it's a really cool feature. |
|
@balloob this is the automation handling it:
|
Yeah, that won't be supported for non-admin users anymore. Instead, this should be implemented home-assistant/frontend#4813 |
Codecov Report
@@ Coverage Diff @@
## dev #31654 +/- ##
==========================================
- Coverage 94.65% 94.65% -0.01%
==========================================
Files 754 756 +2
Lines 54577 54810 +233
==========================================
+ Hits 51660 51879 +219
- Misses 2917 2931 +14
Continue to review full report at Codecov.
|
Good to know. Paging @basnijholt since he wrote the automation. |
Breaking change
frontend.set_theme
andfrontend.reload_themes
now require admin access. This will not break automations that set themes because those are run with admin access.themes_updated
event no longer contains all theme dataProposed change
Cleans up the services and events fired by frontend.
Require admin access for theme-related services that change defaults/reload themes from YAML.
The themes_updated event used to contain all the theme data, which could break the recorder because some themes contain base64 images (#31651)
While implementing this, I ran into a really nasty bug. If you use the
@functools.wraps
decorator, it copies all info over from the wrapped function, including if it's a callback! If a wrapped function is then passed toasync_add_job
, we can end upcalling sync methods in the event loop ornever awaiting async functions. This happens becauseasync_add_job
will useloop.call_soon
to call them, but not await them. To avoid this,I have introduced a new callback-awarecore will now always first check if it's a coroutine function before checking if it's a callback. This solves the problem.wraps
decorator that won't copy it to async functions. We should go through our codebase and verify all wraps invocations.Frontend change: home-assistant/frontend#4812
Type of change
Example entry for
configuration.yaml
:# Example configuration.yaml
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale: