这是indexloc提供的服务,不要输入任何密码
Skip to content

AppleTV Integration: Why isn't 'device_class' attribute set ? #2713

@Jokanaan78

Description

@Jokanaan78

Describe the bug

Could you set the 'device_class' attribute both for AppleTV and HomePods (to 'receiver' and 'speaker' respectively) ?

Trying to have some custom made sensors to count how many devices (per class) are 'playing' or 'on' and currently only possible by listing them all individually, without a 'device_class' group ...

Ex.:

- name: "Set-top Boxes on"
  unique_id: "settopboxes_on"
  icon: 'mdi:set-top-box'
  state: >
    {{ states.media_player
      | rejectattr('attributes.entity_id', 'defined')
      **| selectattr('attributes.device_class', 'eq', 'receiver')**
      | selectattr('state', 'search', '(playing|on)')
      | list | count }}

- name: "Speakers on"
  unique_id: "speakers_on"
  icon: 'mdi:speaker'
  state: >
    {{ states.media_player
      | rejectattr('attributes.entity_id', 'defined')
      **| selectattr('attributes.device_class', 'eq', 'speaker')**
      | selectattr('state', 'search', '(playing|on)')
      | list | count }}

How to reproduce the bug?

Feature request

What is expected behavior?

Current attributes set on 'AppleTV':

  • source_list
  • media_position
  • media_position_updated_at
  • media_title
  • app_id
  • app_name
  • icon
  • friendly_name
  • supported_features

Current attributes set on 'Homepod':

  • volume_level
  • icon
  • friendly_name
  • supported_features

Device

AppleTV and HomePod

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions