Villhellm / lovelace-animated-background

Animated backgrounds for lovelace
195 stars 61 forks source link

Rewrite logic to check config for enabled status #39

Open xBelladonna opened 3 years ago

xBelladonna commented 3 years ago

Rewrite function enabled() to check conditions for exclusion (explicitly defined or implied) and only enable if none exist. This includes the enable boolean flag which, even if set to true, will not enable animated background if any conditions for exclusion exist.

Fixes #38.

Please comment if any changes, stylistic or pragmatic, are preferred/required.

Villhellm commented 3 years ago

This, unfortunately, runs into the problem I was trying to explain. Includes are designed to override excludes. This change would essentially flip the logic, which could have been done by just moving the exclude checks below the include checks. Admittedly, it was a poorly designed system from the start.

My eventual plan was to implement the same exception system I have setup in Custom-Sidebar, which would give you the option to explicitly define the parameters of your includes/excludes and every combination.

Villhellm commented 3 years ago

I will start working on that implementation (hopefully) sometime this month. Until then I suggest you use the branch you created here in your HA instance as a temporary workaround.