iantrich / config-template-card

📝 Templatable Lovelace Configurations
MIT License
434 stars 56 forks source link

Improved Performance and Memory Usage #68

Closed kamtschatka closed 3 years ago

kamtschatka commented 3 years ago

The variables part of the eval statement is always the same unless the config changes, so I changed the code to cache this part. I have also changed the loop to evaluate the template only once instead of twice and allow for early returns.

kamtschatka commented 3 years ago

Just looked at #47 and realized a bug in this implementation. prepareVariablesString does not make states and user available properly AND the way it is currently implemented it is not possible, because the hass object is only set at a later point.

I'll have another go at this later/tomorrow