Allow dynamic visibility of items in UI

If you are talking about group visibility, it has been already implemented:
https://home-assistant.io/topics/group_visibility/

2 Likes

Wow, I’m surprised I didn’t see that in any of the release notes - you’d think something that big would be announced proudly in the notes. But I just checked my group services in .32.3 and I can confirm that the set_visibility service is in fact there.

Do you know when this was added? I went back and searched the blog release notes and I can’t find any mention of it at all!

As minor feature in 0.32.0.

1 Like

Im surprised too. I read the release notes religiously and was surprised to see this has been added. This will be very useful! Being able to dynamically show things on the front end as they turn on and off is awesome.

2 Likes

Thanks! So surprised this was considered a minor feature, but so glad I can start to use it!

Me too! Hell, I follow the pull requests so I can see what’s coming up and be prepared.

We should keep our findings and use cases in here when we start playing with it!

I don’t know whom to ask to add this retrospectively to the release notes to make it more “visible” :slight_smile:

I would notify @fabaff as he was the author of the .32 release notes blog entry. (Although by tagging him in this post, he may already see it…)

Well, that solves that! Thanks, this is excellent!

Ok, the one outstanding issue. First, some context. I have 8 Chromecast devices, all doing a Sonos-like whole-home audio. I want them to be invisible on the UI unless they’re playing. This almost works.

Here’s the group for one device:

  cast_office:
    name: "Office Audio"
    entities:
    - media_player.office

Here’s the automation for same device;

- alias: 'Hide media_player.office while not playing'
  hide_entity: true
  trigger:
    platform: state
    entity_id: media_player.office
    state: 'off'
  action:
    service: group.set_visibility
    entity_id: group.cast_office
    data:
      visible: False
- alias: 'Show media_player.office while playing'
  hide_entity: true
  trigger:
    platform: state
    entity_id: media_player.office
    state: 'playing'
  action:
    service: group.set_visibility
    entity_id: group.cast_office
    data:
      visible: True

This is almost perfect, except the media player appears on every reboot, and only changes when the state goes from something back to off - then it disappears.

If I customize the group and hide it, then it never re-appears; so the visible is different than “hidden” in the UI. Is there a way to specify a default state for the group, that is hidden, unless automation unhides it?

3 Likes

You can trigger an event when HASS starts to hide it. Here’s the trigger syntax:

trigger:
    platform: event
    event_type: homeassistant_start

Collecting the data for the release notes is a manual process and sometimes stuff is missed. Usually there are between 100 and 150 commits thus changes are high that one or two feature are missed.

Anything we can do to help?

1 Like

It appears that only groups have this functionality. I would love to do this by individual entity/sensor/badge on the home / default view to show active devices, only when they are active.

4 Likes

Yep, came here because I wanted to change the visibility of entities (in my case scripts). Doesn’t look like it’s (easily) possible currently…

I had to put all entities I wanted to control visibility in their own group.

I’d like to see this for entities as well as groups. I’d like to stick with badges for some entities but still dynamically show and hide them.

The use case I’ve got in mind is travel time (using the Google API):

  • I’ll track two travel times - time to work and time to home.
  • If I’m at home and it’s morning on a weekday, show the time to work entity only
  • If I’m away show time to home entity only
  • If I’m home and it’s not during the morning commute hours, hide both

Apart from the last one I guess it could be done with a template sensor that picks the travel time value according to the other rules, although it would still ideally need a dynamic label to show what time is being shown.

I’m sure there are other use cases, though, and it would be nice to be able to surface badges when the information is relevant.

2 Likes

I have crammed it into a group and it works OK but I want to dynamically show running appliances or things that need attention like open garage doors on the home screen, but only when they are needed.

Item level visibility with empty groups auto hiding would be far more flexible.

I had exactly the same thing in mind and now I’ve discovered this thread only to find out it’s not possible (yet). bummer

You can probably do his in custom ui by using templated hidden attribute.

Note that it will work for state cards only, not for full-size cards like media player.