Hi,
Is there a YAML code to reference a media.player source in a mushroom chip card or a reciever’s volume?
Thanks
type: custom:mushroom-chips-card
chips:
- type: entity
entity: media_player.fire_TV
content_info: "fire TV source"
- type: entity
entity: media_player.receiver
content_info: "volume"
Use Template chips instead of a Entity chips.
type: custom:mushroom-chips-card
chips:
- type: template
entity: media_player.fire_tv
content: '{{ state_attr(entity, ''source'')}}'
- type: template
entity: media_player.receiver
content: '{{ state_attr(entity, ''volume_level'')}}'
Amazing, thank you. Again, apologies for the beginner questions but would this be the same place to insert if/then language? WOuld like the output to be 0 or Off if the receiver is off rather than:
{{ state_attr(entity, 'volume_level') | float*100 }}
Yep…
type: custom:mushroom-chips-card
chips:
- type: template
entity: media_player.fire_tv
content: '{{ state_attr(entity, ''source'')}}'
- type: template
entity: media_player.receiver
content: >
{% set level = (state_attr(entity, ''volume_level'') | float(0) * 100) | int %}
{{ iif( level == 0, 'Off', level) }}
Awesome, thanks, i read the documentation and came up with the below, but yours works better
- type: template
entity: media_player.lg_webos_smart_tv
content: '{{ state_attr(entity, ''source'') if is_state(entity, ''on'') else ''TV Off'' }}'
icon: mdi:television
- type: template
entity: media_player.living_room
content: >-
{{ state_attr(entity, 'volume_level') |float*100 if is_state(entity, 'on')
else 'Receiver Off' }}
icon: mdi:volume-high
- type: template
entity: media_player.fire_tv_192_168_1_183
content: >-
{{ state_attr(entity, 'source') if is_state(entity, 'idle') else 'FireTV
Off' }}
icon: mdi:multimedia