Show/Hide dependent on state of device

Forgive me if this is in the wrong place. I’m fairly new at this and after fussing with HA for the past week, I finally got it to work!

So now I’m doing some cleaning up… I have a slew of Google Home devices that I set hidden: true in the customize.yaml file so that when I log in, my overview isn’t overrun with all those devices.

I wanted to write a script so that if one of those devices is playing, it will show in the overview.

Is that even possible? If so, how do I write that script?

1 Like

Yes this is totally possible and is funny that you wrote this because I was going to share a package tonight with something similar but with my 3D printers.

You need to create a group containing the entities that you want to hide and then set the visibility of the group with an automation like so…

automation:

- id: a_show_cr10
  alias: Show CR10
  trigger:
    platform: state
    entity_id: switch.cr10_16
    to: 'on'
  action:
    service: group.set_visibility
    entity_id: group.cr10_information
    data:
      visible: True

And then to hide it you would have another automation that set visible to false

In your case it would be something like

- id: show_google_home
  alias: Show Google Home
  trigger:
    platform: state
    entity_id: media_player.your_google_home
    to: 'playing'
  action:
    service: group.set_visibility
    entity_id: group.google_homes
    data:
      visible: True
1 Like

Ok, I must be doing something wrong here, cause. This is what I did so far without adding the automation in…

In my customization.yaml

Blockquote
media_player.family_room_speaker:
  friendly_name: Insiginia Google Assistant
  icon: mdi:google-home
media_player.loft_speaker:
  friendly_name: Google Chromecast Audio
  icon: mdi:google-chrome
media_player.master_bedroom_speaker:
  friendly_name: Google Mini - Master Bedroom
  icon: mdi:google-home
media_player.office_speaker:
  friendly_name: Google Mini - Office
  icon: mdi:google-home
media_player.all_speakers:
  friendly_name: All Speakers
  icon: mdi:speaker

And in my groups.yaml, I set a “group” for just the Office Mini

Blockquote
  office_mini:
    name: Office Mini
    entities:
      - media_player.office_speaker

And this is what’s showing

If you notice, my group for the office_mini isn’t even showing.

Thoughts?

Just curious but did you add the group to the views?

The views? Doesn’t setting the views just put it on a tab? on the top header of the frontend?

Sorry I meant did you add the group that you created to the view that you are trying to get it to show up on

Here’s the link to the documentation on HA for group visibility

1 Like

Thanks! I’ll play around with the groups some more when I can come up for air from my daytime job! Hopefully I can get this squared away soon! I wanna move on to getting other stuff into HA!

1 Like

So I created a new view called “Google Home Devices” and I got all the entities for my devices to show in that tab. That’s great, now I know how to create tabs. Thanks!

However, for the default view (when you initially log in to HA). It still shows the separate entities for those devices.

The only way I can hide those entities is by adding “hidden: true” to the entity under the customize.yaml file. Doing this though, will hide those entities with that attribute across the board… Meaning, any groups that contain that entity(ies) or views (tabs) that also display the group that the entity(ies) is in.

I tried an automation where if the condition changes from off->playing to change visibility. But that automation only works in a group. But, if I take off the hidden: true under each device entity then it ALWAYS shows up on the default view.

Also, for some reason, I can’t group multiple google devices under one card.

Yep! I think what I’m trying to do is impossible. Or at least it seems like it! No matter how I configure the groups and entities it will always show up on the default view. If I create a tab (view: yes), it will show up there AND the default view.

If I hide it by setting the entity’s attribute hidden: true, then it hides it across the board.

This is annoying! LOL Seems like an easy thing to do but it’s not. Maybe Google Devices just don’t play nice with HA?