Closed infeeeee closed 1 year ago
Hi @infeeee, been busy these days. Thank you for all your work, I'll watch it in the following days.
I think the choice will be to keep Entity dependencies so I'll create a flow to initialize everything in the correct order. It will be like:
Ok, thanks, no rush. I just had too much free time nowadays.
The main problem, I don't understand what is the point of dependencies. They are only checked during Initialize
and during normal runtime they don't even matter. What else do you plan to add as dependency source beside existing os
and de
?
It seems they add a huge avoidable complexity to the code. Remember the KISS principle. I will create proof of concept to show what I'm trying to say.
I think the current flow is not really efficient, and not easily maintainable.
The problems:
Initialize()
andPostInitialize()
. it's easy to miss it accidentally, and init flow differ between entities, but it could be similar. SometimesRegisterEntitySensor()
is inInitialize()
sometimes it's inPostInitialize()
. Chaotic.de
andos
) are actually just providing static information, which usually shouldn't change at all.MyApp.App
also provides static data, but it's not an Entity but a separate submodule.Possible solutions:
A: Remove the whole dependency system. Move all the base methods to submodules, just like
MyApp
. Convertos
andde
entities similar toAppInfo
. If in the future some part of an Entity needed in another one, move that methods to a submodule, or create the new entity as a subclass.Maybe this new module could be merged with
MyApp
, to create a single source for all static info. I recommend this solution.This solution could also help with the config flow, as elements not available could be hidden from the list.
B: Build correct dependency chain in EntityManager. Evaluate which entity depends on which and initialize them in the correct order.
What do you think @richibrics ? What is your plan with the dependency system?