Visibility control of section view - how to list the collective state of update entities placed within a 'section view' on a dashboard page

Hello @Didgeridrew and everyone,

I have read and seen the good solutions you and this site has produced and just wonder if it is possible to either setup a template, binary or sensor for the following use case as stated below.

I have created a dashboard page with 4 individual sections on that page listed as addons / integrations / hacs / server etc.

These each have a header title at the top of each section view with the above list.

Here is what I want to do…

I would like to make the ‘section views’ hidden (using a condition) until one or more of the update entities listed within the individual ‘section view’ has a state of ‘on’…

I have half the answer…
I have set up a template binary sensor with the code below

{{ (states.update | selectattr('state', 'eq', 'on') | list | count) > 0 }}

However, this checks every update entity on the HA platform regardless of where it resides.

So if a single update entity was switched on all my sections would become visible if I was to use this sensor to set a condition in each of the 4 ‘section views’ visibility tabs.

I want to try an iterate out what ever is in the ‘section view’ and check its state for ‘on’

I think I would need to create an individual template binary sensor for each ‘section view’ with a possible ‘for’ loop to fetch out the list within the associated ‘section view’.

The problem is that I don’t know how to target or iterate (list out) the ‘section view’ ?

At the moment I can only list update entities via integration type (e.g. hacs / addons / intergration or server) and not by what ever update entity I move in to a particular ‘section view’ as there are more update entities outside of the 4 integration models as I have listed above.

So… Hacs ‘for’ loop example could be…

{%- for x in expand(states.update

| selectattr('entity_id','in',integration_entities('hacs'))

| selectattr('state','contains','on')

| sort(attribute='entity_id', reverse=true)) %}

{{x.name}}

{%-endfor %}

This would return a state within “hacs” only if one of the update entities were set to ‘on’ and sets “x.name” with the update entity.

This is ok if you want to just stick to the integration type but I don’t want to do that.

However, the problem is as I stated above before, I don’t know how to pull a list or address the list inside of a ‘section view’ or if it could even be done ?

Any suggestion of how to do this or if I am even going in the correct direct would be much appreciated…

Thanks in advance.

AFAIK, there isn’t a way to get the contents of a Dashboard section directly via templating. This is true about most things in the frontend, not just Sections.

Your best option is probably going to be using Labels and just manually adding or removing them if you move things around.

For example, let’s say you add the Label update_section_1 just to the update entities… then your binary sensor could use:

{{ label_entities('update_section_1') | select('is_state', 'on') | list | count > 0 }}

Excellent idea…

Thank you for the pointer, I will give that ago and let you know the outcome. :slightly_smiling_face: