What’s the best way to create a data STRUCTure (eg. data Array / List of Lists / Table of Tables ) that can be accessed across multiple Automations/Scripts?
Size at least 60 rows x 11 columns, but could be more. Mostly string data values.
The data will be fairly static, but (read) access must be fast and efficient, as the data access will be intense, not sparce.
Ideally it should survive restarts, but it could be reloaded at HA Startup.
If it can be (occassionally) updated on-the-fly, that would be nice, but not essential.
I’ve searched the HA Documentation and Community topics, but not found anything that seems to fit the need…
Currently I have a large List of Lists defined under an Automation’s top level Variables: key, but that’s obviously not visible or shared outside that Automation.
Hi Daryl. I was aware of the Trigger based Template Sensor, but not sure if it may have a significant access overhead. I’ll take another look at it…
Thanks.
Hi @Troon,
I’ll take a closer look at this method too.
Do you have any idea
a) Does it have any data or structure size limitations?
b) What’s the access overhead of using state_attr(…) to get the data value out compared with directly accessing an array (table of tables/list of lists)?
I guess it really depends where you want to use this info, but I’d just make the data in a custom macro and import it in templates when I need it. That way, it doesn’t make its way into your database, but it’s accessible at any time a template can be used.
If you want anything greater than that, make a custom integration.
Hi Petro, and many thanks.
That may be the easiest / most access efficient and most extensible approach of the options.
I’ll look into these various approaches and do some testing…
It does ‘bug’ me somewhat that HA needs these “extensions” to be able to do non-trivial tasks though… Does make things so much harder than they should be. Hey ho - that’s HA life, for now.