Everyone coming to this thread
This will create all activities as switches
Simply copy/paste the following code chunk into your template editor.
Code Chunk:
{% set entity = 'remote.living_room' %}
switch:
- platform: template
switches:
{%- for activity in state_attr(entity, 'activity_list') %}
{%- set name = device_attr(entity, 'name_by_user') or device_attr(entity, 'name') %}
### {{ name }} {{ activity }} Harmony Activty ###
{{ (name ~ ' ' ~ activity) | slugify }}:
unique_id: harmony-activity-{{ name | slugify }}-{{ activity | slugify }}
friendly_name: {{ name }} {{ activity }}
value_template: >
{% raw %}{{{% endraw %} is_state_attr('{{ entity }}', 'current_activity', '{{ activity }}') {% raw %}}}{% endraw %}
turn_on:
service: remote.turn_on
target:
entity_id: {{ entity }}
data:
activity: {{ activity }}
turn_off:
service: remote.turn_on
target:
entity_id: {{ entity }}
data:
activity: PowerOff
{% endfor %}
Next, change
{% set entity = 'remote.living_room' %}
to whatever your remote entity is. for example, if it’s remote.lounge_room
…
{% set entity = 'remote.lounge_room' %}
If you don’t have a switch section in configuration.yaml, copy the entire response from the template editor and paste it into your configuration.yaml.
If you do have a switch section in configuration.yaml, only copy everything after the switch:
line.