I have two scripts to change the TV volume through Harmony Hub:
This one is working with fixed button presses:
tv_much_quieter:
alias: TV viel leiser
sequence:
- data_template:
device: '36473354'
command: ['VolumeDown', 'VolumeDown']
entity_id: remote.wohnzimmer
service: remote.send_command
This one with templating and variables not:
tv_n_times_quieter:
alias: TV n mal leiser
sequence:
- data_template:
device: '36473354'
command: "['VolumeDown'{% for n in range(times - 1) %}, 'VolumeDown'{% endfor %}]"
entity_id: remote.wohnzimmer
service: remote.send_command
I enabled logging to check what is going on. It looks the same to me?!?
From script 1 (working one): 2018-02-08 19:28:08 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=remote, service=send_command, service_data=device=36473354, command=['VolumeDown', 'VolumeDown'], entity_id=remote.wohnzimmer, service_call_id=139807374105568-74>
From script 2 (not working): 2018-02-08 19:40:29 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=remote, service=send_command, service_data=device=36473354, command=['VolumeDown', 'VolumeDown'], entity_id=remote.wohnzimmer, service_call_id=139807374105568-82>
There is more output in the log but it also looks the same. Any idea what happens here? What am I missing?
I don’t use Remote Harmony component or Harmony remote for that matter, but looking at the documentation does not mention working with template as commands.
Ok, I thought templating to be something generic? Like it first renders the template and then processes it. That would not have to be supported then by the implementation of the service because it happens before. Wouldn’t it?
Where did you find that answer? I’ve been trying to help people with returning lists for the past few weeks. Every attempt fails. I haven’t found it in writing, but I had that hunch. Do you have a link?