Groups and Sensors

I have a card in the default Hass.io (0.95.4) GUI that I created using Groups. I want an at-a-glance summary of things I’m interested in. I have not quite got it right and I’m asking for someone to point me in the right direction. My problem can be seen in the last pic in this post, the group “Media Players” status is being reported as “unknown” even though the sensor value is correctly reporting “true”.

groups.yaml

home_status:
  name: Home Status
  control: hidden  
  entities:
    - group.residents
    - group.media_players
    
residents:
  name: Residents
  control: hidden
  entities:
   - person.scott

media_players:
  name: Media Players
  control: hidden
  entities:
   - media_player.roku   	# Note that these are the same device.
   - sensor.roku_is_playing	# I’ve tried with both of these experimenting.

sensor.yaml

- platform: template
  sensors:
    roku_is_playing:
      friendly_name: Roku Is Playing
      entity_id:
        - media_player.roku
      value_template: >-
        {{ is_state('media_player.roku', 'playing')  }}

This is the card as it appears in my GUI:

homecard1

This is the Media Players item expanded:

homecard2

OT: Anyone know how to add border to uploaded pics in this forum?

Look in the ‘States’ tab /dev-state/ to see what the status of your entities actually is and how that changes - that will give you a hint what you can expect to see.

And then try this:

home_status:
  name: Home Status
  control: hidden  
  entities:
    - group.residents
    - media_player.roku
    - sensor.roku_is_playing

The group will not work properly for entity_id items that have different state options, e.g. your sensor sensor.roku_is_playing can have the states ‘true’ or ‘false’ while the 2nd item in the group media_player.roku will have a status like ‘playing’, ‘paused’, etc. - this is hard to summarize in the same group status.

@chairstacker Thanks for the reply.
The states report correctly:

group.residents	        home 
media_player.roku       playing
sensor.roku_is_playing  True

The last bit you mentioned is what I was suspecting was the issue, but I wanted to hear someone else say it also. I’ll experiment with setting up binary sensors for all my groups to sanitize the outputs.

Kinda on the same thought though- is there a way to create a “summary” card like I was trying to do? One that would work with displaying different values?

If you do as I described, you will see in the home status card what you’re asking for:

home_status:
  name: Home Status
  control: hidden  
  entities:
    - group.residents
    - media_player.roku
    - sensor.roku_is_playing

You are correct. I had overlooked removing group.media_players. Taking that out and it resolves as expected. I can adjust the sensor to monitor multiple media players and get the desired results.
Thanks!

As extra info, the media_player.roku does not appear on the card. It already has a default card that showed up, and I’m assuming it is not compatible with the other format. That is fine for my purpose.

home_status:
  name: Home Status
  control: hidden  
  entities:
    - group.residents
    - media_player.roku 
    - sensor.roku_is_playing

Results in:

image