Is it possible to change the MDI icon based on the activity chosen for Harmony Hub?
I’m using Petro’s code again (Thanks again Petro) to determine what activity my harmony is engaged in but cant see to make my picture elements card change the icon based on the activity. Specifically, I want a single icon to represent my tv on my floorplan card and for that icon to change based on the activity.
Current yaml in my elements card that only shows a blue eye regardless if its on/off or activity. When clicked, the more info box does show whats current active.
- type: state-icon
title: Game Room TV
tap_action:
action: more-info
entity: sensor.game_room_harmony_hub_activity
style:
top: 11%
left: 73%
- type: state-icon
title: Living Room TV
tap_action:
action: more-info
entity: sensor.living_room_harmony_hub_activity
style:
top: 25%
left: 39%
this didn’t work, any ideas?
living_room_harmony_hub_activity:
value_template: >
{% if is_state("remote.living_room_harmony_hub", 'on') %}
{{ states.remote.living_room_harmony_hub.attributes.current_activity }}
{% else %}
PowerOff
{% endif %}
living_room_harmony_hub_icon:
value_template: "{{ states('sensor.living_room_harmony_hub_activity') }}"
icon_template: >
{% if is_state('states.remote.living_room_harmony_hub.attributes.current_activity', 'Watch Apple TV') %}
mdi:apple
{% elif is_state('states.remote.living_room_harmony_hub.attributes.current_activity', 'Play Nintendo') %}
mdi:nintendo-switch
{% elif is_state('states.remote.living_room_harmony_hub.attributes.current_activity', 'LR Music') %}
mdi:music
{% elif is_state('states.remote.living_room_harmony_hub.attributes.current_activity', 'LR Blu-Ray') %}
mdi:disc-player
{% elif is_state('states.remote.living_room_harmony_hub.attributes.current_activity', 'Mirror Computer') %}
mdi:webcam
{% else %}
mdi:television
{% endif %}
game_room_harmony_hub_activity:
value_template: >
{% if is_state("remote.game_room_harmony_hub", 'on') %}
{{ states.remote.game_room_harmony_hub.attributes.current_activity }}
{% else %}
PowerOff
{% endif %}
game_room_harmony_hub_icon:
value_template: "{{ states('sensor.game_room_harmony_hub_activity') }}"
icon_template: >
{% if is_state('states.remote.game_room_harmony_hub.attributes.current_activity', 'Watch Apple TV') %}
mdi:apple
{% elif is_state('states.remote.game_room_harmony_hub.attributes.current_activity', 'Play Switch') %}
mdi:nintendo-switch
{% elif is_state('states.remote.game_room_harmony_hub.attributes.current_activity', 'Play Wii U') %}
mdi:nintendo-wiiu
{% elif is_state('states.remote.game_room_harmony_hub.attributes.current_activity', 'Play Classic Console') %}
mdi:gamepad-variant
{% elif is_state('states.remote.game_room_harmony_hub.attributes.current_activity', 'Play Xbox One') %}
mdi:microsoft-xbox
{% elif is_state('states.remote.game_room_harmony_hub.attributes.current_activity', 'Play Xbox 360') %}
mdi:microsoft-xbox
{% elif is_state('states.remote.game_room_harmony_hub.attributes.current_activity', 'Raspberry Pi') %}
mdi:raspberry-pi
{% else %}
mdi:television
{% endif %}