which gave me ‘Error: Template rendered invalid entity IDs: [’’]’
So I guess, this is a list and the list is empty. So it renders nothing. If this is any useful.
I have to agree that it doesn’t appear to work the way it did in the past. I don’t remember seeing it described in recent Release Notes but perhaps I missed it. Or, like you said, it’s a bug.
One of the most recent examples of using trigger.event.data.entity_id is in pnbruckner’s post back in April:
However, I can confirm that this simple automation fails to report the entity_id (the generated persistent_notification lacks an entity_id).
In other words, entity_id is part of service_data and its value contains a list. By using a template to get the list and flatten it, it produces light.hallway_light.
In theory, trigger.event.data.entity_id should have worked. However, for whatever reason, it now doesn’t.
won’t get the job done, which is (with my little knowledge) somehow logic, because it is not part of the event.
Maybe I can find a solution.
End goal is to send a MQTT message via zigbee2mqtt, but there you either need the friendly name or the ID. Maybe I can do something with split, don’t know. Let’s see.
Edit: This '{{ trigger.event.data.service_data.topic.split("/")[1] }}' gives me the friendly name from zigbee2mqtt, which in my case is the same as in HA.
btw: I don’t want to spam you all, but I thought I’ll have this monologue so others can see my way of progress/thoughts and some other could learn from this in the future. So I thought I’ll write it down. If this is not desired by this forum, tell me.
In this case, I could not use the quotation. Otherwise they would be sent in the topic. Like zigbee2mqtt/'FRIENDLY_NAME'/set
When I leave the template without quotations, the quotations are gone.
Does someone know why? Wonder how the template was registered as a template then.
The outer quotes are needed when you define the template on the same line as the option. They serve to define the boundary of the string value being assigned to the option.
The outer quotes are not needed when you define the template on a separate line using the line-continuation character (either a greater than symbol or a vertical bar).
If you do use them in this case then they will be included in the final result (i.e. they are used literally).
In the Building Templates section, the first example shows the use of a line continuation character and a template spread out over multiple lines. You’ll notice none of the phrases are delimited by quotes because they would be considered to be part of the phrase and shown in the final result.
Could you maybe help me out one more time.
Triggering the automation by mqtt message open and close works fine. I am trying to set the trigger for set position also.
Automation:
I had no luck with different variations for the payload part in the trigger. Doesn’t work.
I actually wanted to trigger the automation by setting the position to any kind of value. I took a step back and was trying to get it with a given value.