Oh sorry guys, bad news:
it does still not work. I only thought it would work, because when I checked the code with the validating feature in the UI, it told me to be “Valid!”, but when I restart HA it fails . Dammit…
I’ll edit the post above accordingly.
So when I restart HA, it fails with the message:
ERROR (Thread-2) [homeassistant.util.yaml] while parsing a block mapping in "/home/homeassistant/.homeassistant/automations.yaml", line 89, column 7
expected <block end>, but found '<scalar>' in "/home/homeassistant/.homeassistant/automations.yaml", line 90, column 67
When I now replace all nested {{trigger.entity_id.split(’.’)[1]}} with just dinning_room, HA starts, but it throws a lot of errors regarding automation:
2017-12-14 14:04:01 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: Entity ID input_number.{{trigger.entity_id.split('.')[1]}} is an invalid entity id for dictionary value @ data['action'][0]['entity_id']. Got None
invalid template (TemplateSyntaxError: expected name or number) for dictionary value @ data['action'][0]['data_template']['value']. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 156). Please check the docs at https://home-assistant.io/components/automation/
2017-12-14 14:04:01 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: Entity ID cover.{{trigger.entity_id.split('.')[1]}} is an invalid entity id for dictionary value @ data['action'][0]['entity_id']. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 156). Please check the docs at https://home-assistant.io/components/automation/
This is actually bad, because it seems to me as if this nice idea does just not work in general .
I also tried to use another component (input_text and template_sensor) as some kind of “buffer” for the trigger entity, that I don’t need to use nested templates. But this fails, too, with similar errors (“no valid entity_id” or so). If someone likes to investigate that with me, this would be welcome, of course.
I don’t know, if it is useful to let the idea of @brg468 marked as the solution. Sure, it extracts the name of the entity that triggerd the automation. But in the end, I was not able to use this for my problem. What do you think?
Until now I have tried A LOT of things, nothing worked as I hoped it would. So for now, I’ll give up and figure out another solution.
Thank you guys anyway. The beers are still here for you .
Greetings