Nerwyn / android-tv-card

A completely customizable universal remote card for Home Assistant. Supports multiple platforms out of the box.
Apache License 2.0
254 stars 13 forks source link

Smart mute/unmute icon #86

Closed felipecrs closed 6 months ago

felipecrs commented 6 months ago

It would be nice if the card could automatically detect whether the volume is 0% or not and render the mute icon for the mute button as muted/unmuted.

Nerwyn commented 6 months ago

This would be out of scope of the project, as determining what indicates whether the volume is 0% is not standard if the user doesn't link a media player to this card. You can however do it yourself using templates.

custom_actions:
  volume_mute:
    icon: |-
      {% if is_state_attr("media_player.lounge_chromecast", "is_volume_muted", true) or is_state_attr("media_player.lounge_chromecast", "volume_level", 0) %}
      mdi:volume-variant-off
      {% else %}
      mdi:volume-low
      {% endif %}
felipecrs commented 6 months ago

That's awesome. Thanks a lot for the template.