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
Ability to disable media browser #262
Ability to disable media browser #262
Conversation
Codecov Report
@@ Coverage Diff @@
## master #262 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 12 12
Lines 1438 1445 +7
=========================================
+ Hits 1438 1445 +7
Continue to review full report at Codecov.
|
Co-authored-by: Dermot Duffy <dermot.duffy@gmail.com>
@@ -47,6 +47,11 @@ | |||
|
|||
async def async_get_media_source(hass: HomeAssistant) -> MediaSource: | |||
"""Set up Frigate media source.""" | |||
|
|||
for config_entry in hass.config_entries.async_entries(DOMAIN): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[With apologies in advance for re-thinking this] I think I have a much better idea. Leave this method the way it used to be, and check the option in FrigateMediaSource
.
Suggestion on how to do this (pardon the verbosity as this file is quite complex). You'll need to add a new method such as _isAllowedAsMediaSource
that takes a frigate_instance_id
and returns True
if for that instance_id, in the config entry (which can you get by calling get_config_entry_for_frigate_instance_id
) the option is set correctly.
Then call that verification method in these places (in all cases you can get the frigate_instance_id
from the identifer as identifier.frigate_instance_id
).
This is much better because if I have 3 Frigate instances, and I disable the media for 1 of them, media will still work as usual for the other 2 rather than 'all or nothing'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, that's a much better solution, will jump on that tomorrow.
The test will probably need to be tweaked as well
Not sure why HACS is failing. I am seeing that on my integration as well but unfortunately not seeing much help with what changes are actually needed. |
Not sure. This in the build logs (but you didn't change the manifest):
What happens when you load the integration? |
This happens to all the integration, that are still using hacs.json values, which are not supported anymore. Not connected to this PR, but to the HACS itself. #263 will fix it (checked on my HA integration recently) |
…gration into disable-media-browser
Seems the check is further up stream and the lower stream exception doesn't get tested, not really sure of a good way to test that unless it is called directly |
@dermotduffy Thank you! |
Fix for #218