#Prevent showing TODO and Calendar panels when not needed
1 messages ยท Page 1 of 1 (latest)
Maybe a stupid side question, can the frontend hide panels if there are no relevant entities
PR for solution 1: https://github.com/home-assistant/core/pull/164778
Integrations may not work correctly if platforms are loaded but not the integration, that's not something we normally do.
That is incorrect, trigger and condition platforms are required to function without their integration loaded. That is part of their design.
For what we've implemented, sure, but we don't know about custom stuff.
Not easily, it's core which asks frontend to add the panel
Reason for this is that those triggers and conditions may be needed by some other integration, so they are required to work correctly even if their integration is not loaded (yet).
Then that custom stuff is fundamentally broken. All implementations of trigger and condition platforms need to make sure they work correctly.
Artur, the point of creating this thread was to ask others about input. Not that you should continue selling your idea.
Sure, I agree, just want people to have a clear and accurate picture of benefits and drawbacks. The lack of support for services is absolutely a drawback of solution 1, "things may work incorrectly" isn't.
I don't understand this:
The frontend panel will be loaded if an integration which has a todo or frontend platform is loaded even though the integration doesn't load those platforms
If you have no todo lists, the to-do page doesn't show in the sidebar, because the todo component isn't loaded
the moment you add shopping list, it will appear
That's what the PR is solving as I understand it. I don't understand the quoted sentence though.
Oh right
I assume if you for example have an ESPHome or ZHA like setup, where if you only set up a contact sensor it doesn't setup everything from water heaters to sirens
They conditionally load platforms
Exactly, async_process_integration_platforms isn't really meant to be used with entity platforms, it will import them unconditionally if the loaded integration has the platform file, even if the integration doesn't want to load it.
I think it's fine as a temporary solution to fix the issue, but not long term.
There's more context in https://discord.com/channels/330944238910963714/1486747262775197839
Do we absolutely need these todo and calendar triggers to be always available? If the intention is to just make editing already existing ones possible, then here's a better alternative: https://github.com/home-assistant/core/pull/166911
This one should be merged either way, as it will work for all integrations, not just base platforms.
Which problem does this PR solve?
Who is ensuring this? Where is it documented it should work like that?
For reference, we've had problems previously with integration specific triggers requiring the integration + config entry to be loaded for the triggers to be able to be attached.
It's not required that triggers and conditions work without their integration loaded.
Honestly, I think the calendar should only register the panel after the first calendar entity is added
Which problem does this PR solve?
It solves the problem of trigger descriptions not being available to the frontend when a trigger is already being used, but the relevant integration is not loaded.
Who is ensuring this? Where is it documented it should work like that?
For reference, we've had problems previously with integration specific triggers requiring the integration + config entry to be loaded for the triggers to be able to be attached.
It's not required that triggers and conditions work without their integration loaded.
OK, I see there's a confusion regarding how trigger platform works and what are its requirements. Let me clarify.
It is required that all trigger platforms work without their integrations loaded. By "work" here it is meant that they are able to validate and initialise their triggers, off course it is likely that before the integration actually loads, no trigger will actually activate.
The reason it is a requirement is that other integrations are allowed to use the triggers. And those integrations can load before the integration that provides the trigger.
That is why the API is constructed the way it is. When you callasync_validate_trigger_configthe trigger platform of that trigger is loaded, but not the integration itself.
So both the specification of the system and the API shape already enforce this requirement. If some trigger platform doesn't follow it, it is already broken.
Yes, but as I mentioned we had problems where integrations didn't expect async_validate_trigger_config to be called on them before the config entry was loaded. We can't change the behavior again the day before release.
This is already the behaviour we enforce due to how the API works.
If integration X uses trigger from integration Y, and loads before it, it will fully expect the trigger platform of Y to load correctly.
hmm, is that how it works? it's been too long since I messed with the fundamentals of the trigger loading
Yes, that is how it works. ๐
If you look at my last PR I'm not adding any loading there, the platform is already loaded.
i should remember this, because I wrote the stupid code ๐
But you've improved it since of course ๐
But, can we try to first focus on doing something realistic for the release tomorrow so the users don't see the stupid panels? I think the lowest risk and least hacky would be to either merge one of my PRs from yesterday, or just remove calendar and todo from always-loaded integrations.
For quick fix I would propose to simply merge my last PR https://github.com/home-assistant/core/pull/166911 and remove the todo and calendar from bootstrap.
can you make a variant of that for conditions too?
but your PR doesn't really solve the issue with editing. if an automation is disabled, the loading doesn't happen, right?
I'm not 100% sure, do disabled automations validate their configs?
Here's a PR for conditions https://github.com/home-assistant/core/pull/166939
Yes, validation is required to work before the integration is loaded. Eg in Z-Wave we have a check to bypass dynamic validation if the config entry isn't loaded.
I've approved Artur's trigger PR @frigid jolt ok with you?
https://github.com/home-assistant/core/pull/166911